From 56b154e64eddb4c1cd04329ed8c20eb95c91b9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Czoma?= Date: Wed, 24 Jul 2024 08:21:12 -0400 Subject: [PATCH] GH test updates --- .github/workflows/broker-build-test.yml | 96 +++++++++++++++++++ .../module-test-pipeline-main-branch-only.yml | 36 +++++++ .github/workflows/module-test-pipeline.yml | 8 +- .github/workflows/verify-registry-release.yml | 2 +- 4 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/broker-build-test.yml create mode 100644 .github/workflows/module-test-pipeline-main-branch-only.yml diff --git a/.github/workflows/broker-build-test.yml b/.github/workflows/broker-build-test.yml new file mode 100644 index 0000000..57bcd8c --- /dev/null +++ b/.github/workflows/broker-build-test.yml @@ -0,0 +1,96 @@ +name: New broker build Module Test + +on: + push: + branches-ignore: + - dev* + - v* + - main + +jobs: + test: + name: Run Provider setup and tests + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - 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: Check changed files + uses: tj-actions/verify-changed-files@v17 + id: check-changed-files + with: + files: | + !broker-terraform-code-generator + !VERSION + + - name: Run step only when no change detected + if: steps.check-changed-files.outputs.files_changed == 'false' + run: | + echo "No changes detected, skipping further steps" + + - name: List changed files - from now on all tests are run only if there were changes + # if: steps.check-changed-files.outputs.files_changed == 'true' + run: | + echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}" + git diff + + - name: Set up Terraform latest + # if: steps.check-changed-files.outputs.files_changed == 'true' + uses: hashicorp/setup-terraform@v2 + with: + terraform_wrapper: false + + - name: Setup Test broker + # if: steps.check-changed-files.outputs.files_changed == 'true' + run: | + mkdir -p $HOME/solace; chmod 777 $HOME/solace + docker run -d -p 8080:8080 -p 55555:55555 --shm-size=1g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --env system_scaling_maxkafkabridgecount="10" --name=solace \ + --env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:latest + while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done + + - name: Test module from template on test broker + run: | + ci/scripts/test-module.sh ci/template-test + + - name: Test module root on test broker + run: | + ci/scripts/test-module.sh ci/module-test + + - name: Test examples + run: | + for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done + # ci/scripts/test-module.sh examples/non-exclusive-queue + diff --git a/.github/workflows/module-test-pipeline-main-branch-only.yml b/.github/workflows/module-test-pipeline-main-branch-only.yml new file mode 100644 index 0000000..6d5d978 --- /dev/null +++ b/.github/workflows/module-test-pipeline-main-branch-only.yml @@ -0,0 +1,36 @@ +name: Module Test Pipeline - Main Branch Only + +on: + push: + branches: + - main + +jobs: + test: + name: Run Provider setup and tests + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Terraform latest - with token + uses: hashicorp/setup-terraform@v3 + with: + cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} + terraform_wrapper: true + + - name: Setup test broker + run: | + mkdir -p $HOME/solace; chmod 777 $HOME/solace + docker run -d -p 8080:8080 -p 55555:55555 --shm-size=1g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --env system_scaling_maxkafkabridgecount="10" --name=solace \ + --env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:latest + while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done + + - name: Test module root on test broker + run: | + ci/scripts/test-module.sh ci/module-test + + - name: Test examples + run: | + for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done + # ci/scripts/test-module.sh examples/non-exclusive-queue diff --git a/.github/workflows/module-test-pipeline.yml b/.github/workflows/module-test-pipeline.yml index 398a644..9da1bb7 100644 --- a/.github/workflows/module-test-pipeline.yml +++ b/.github/workflows/module-test-pipeline.yml @@ -1,6 +1,10 @@ -name: Provider Test Pipeline +name: Module Test Pipeline - Development Branches -on: push +on: + push: + branches: + - dev* + - v* jobs: test: diff --git a/.github/workflows/verify-registry-release.yml b/.github/workflows/verify-registry-release.yml index 75dd774..15336e0 100644 --- a/.github/workflows/verify-registry-release.yml +++ b/.github/workflows/verify-registry-release.yml @@ -29,7 +29,7 @@ jobs: run: | mkdir -p $HOME/solace; chmod 777 $HOME/solace docker run -d -p 8080:8080 -p 55555:55555 --shm-size=1g --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --env system_scaling_maxkafkabridgecount="10" --name=solace \ - --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:latest + --env system_scaling_maxconnectioncount="1000" --mount type=bind,source=$HOME/solace,destination=/var/lib/solace,ro=false solace/solace-pubsub-standard:latest while ! curl -s localhost:8080 | grep aurelia ; do sleep 1 ; done - name: Set up Terraform latest - public