From d815103c44a766914ebdcad2b7b3a4c9d398915c Mon Sep 17 00:00:00 2001 From: Balazs Czoma Date: Fri, 22 Mar 2024 13:57:31 -0400 Subject: [PATCH] Test improvements, doc fixes --- .github/workflows/module-test-pipeline.yml | 75 +++++++++++++++++-- VERSION | 2 +- examples/basic/README.md | 2 +- examples/local-transactions-support/README.md | 2 +- examples/xa-transactions-support/README.md | 2 +- 5 files changed, 74 insertions(+), 9 deletions(-) diff --git a/.github/workflows/module-test-pipeline.yml b/.github/workflows/module-test-pipeline.yml index 9bc924a..e084f50 100644 --- a/.github/workflows/module-test-pipeline.yml +++ b/.github/workflows/module-test-pipeline.yml @@ -7,11 +7,6 @@ jobs: name: Run Provider setup and tests runs-on: ubuntu-latest steps: - # - name: Set up Go - # uses: actions/setup-go@v3 - # with: - # go-version: "1.21" - - name: Check out code uses: actions/checkout@v4 @@ -37,3 +32,73 @@ jobs: run: | for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done # ci/scripts/test-module.sh examples/non-exclusive-queue + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: "1.22" + + - name: Checkout generator + uses: actions/checkout@v4 + with: + repository: SolaceDev/broker-terraform-code-generator + token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT + path: broker-terraform-code-generator + ref: "main" + + - name: Build and install generator + run: | + pushd broker-terraform-code-generator + go install . + ls ~/go/bin + popd + + - name: Generate provider code + run: | + SWAGGER_SPEC_NAME=`ls ci/swagger_spec` + echo "Generating code using spec $SWAGGER_SPEC_NAME" + rm ./*.tf + SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="ci/swagger_spec/$SWAGGER_SPEC_NAME" MODULE_TEMPLATE_FOLDER="internal/gen-template" ~/go/bin/broker-terraform-code-generator software-module + + - name: Add copyright headers where needed + run: | + go install github.com/google/addlicense@latest + addlicense -c 'Solace Corporation. All rights reserved.' -v -l apache ./*.tf + addlicense -c 'Solace Corporation. All rights reserved.' -v -l apache $(find ./examples -name "*.tf" -type f -print0 | xargs -0) + + - name: Ensure version reflects release candidate version + run: | + VERSION=$(echo "${GITHUB_REF_NAME}" | cut -d'v' -f2) + echo $VERSION > VERSION + + - name: Check changed files + uses: tj-actions/verify-changed-files@v17 + id: check-changed-files + with: + files: | + !broker-terraform-code-generator + + - name: Run step only when any of the above files change. + if: steps.check-changed-files.outputs.files_changed == 'true' + run: | + echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}" + + - name: Commit back any updated source code + if: steps.check-changed-files.outputs.files_changed == 'true' + uses: EndBug/add-and-commit@v9 + with: + committer_name: GitHub Actions + committer_email: actions@github.com + message: 'Updating generated source' + add: ". ':!broker-terraform-code-generator'" + new_branch: GeneratedSourceUpdates-${{ github.ref_name }} + + - name: Create pull request + if: steps.check-changed-files.outputs.files_changed == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + CURRENT_BRANCH=${GITHUB_REF_NAME} + gh pr create -B ${CURRENT_BRANCH} -H "GeneratedSourceUpdates-${CURRENT_BRANCH}" --title "Merge updates into ${CURRENT_BRANCH}" --body 'Created by Github action' + echo Review and approve PR before push can continue + exit 1 // force actions stop here \ No newline at end of file diff --git a/VERSION b/VERSION index 3738566..4e4c3e0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0-rc.1 +0.1.0-rc.2 \ No newline at end of file diff --git a/examples/basic/README.md b/examples/basic/README.md index 232bbe8..c6a7692 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -4,7 +4,7 @@ Configuration in this directory creates a [connection factory](https://docs.sola ## Module Configuration in the Example -### Mandatory Inputs +### Required Inputs * `msg_vpn_name` - set to `default` in the example * `connection_factory_name` - set to `/JNDI/CF/GettingStarted` in the example diff --git a/examples/local-transactions-support/README.md b/examples/local-transactions-support/README.md index ca68f29..ad2c18e 100644 --- a/examples/local-transactions-support/README.md +++ b/examples/local-transactions-support/README.md @@ -4,7 +4,7 @@ Configuration in this directory creates a [connection factory](https://docs.sola ## Module Configuration in the Example -### Mandatory Inputs +### Required Inputs * `msg_vpn_name` - set to `default` in the example * `connection_factory_name` - set to `/JNDI/CF/LocalTransSupport` in the example diff --git a/examples/xa-transactions-support/README.md b/examples/xa-transactions-support/README.md index e2a4fb9..ff8eca9 100644 --- a/examples/xa-transactions-support/README.md +++ b/examples/xa-transactions-support/README.md @@ -4,7 +4,7 @@ Configuration in this directory creates a [connection factory](https://docs.sola ## Module Configuration in the Example -### Mandatory Inputs +### Required Inputs * `msg_vpn_name` - set to `default` in the example * `connection_factory_name` - set to `/JNDI/CF/XATransSupport` in the example