Skip to content

Commit

Permalink
Added code generate to the test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma committed Mar 22, 2024
1 parent c794d6f commit 1c5907d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 61,385 deletions.
70 changes: 65 additions & 5 deletions .github/workflows/module-test-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@ 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

- name: Set up Terraform latest
uses: hashicorp/setup-terraform@v2

- 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="ci/gen-template" ~/go/bin/broker-terraform-code-generator software-module
popd
- name: Ensure version reflects release candidate version
run: |
VERSION=$(echo "${{ github.event.inputs.release_branch_name }}" | cut -d'v' -f2)
echo $VERSION > VERSION
- name: Setup test broker
run: |
mkdir -p $HOME/solace; chmod 777 $HOME/solace
Expand All @@ -38,3 +66,35 @@ jobs:
shopt -s extglob
for d in examples/!(basic-client-username)/; do (ci/scripts/test-module.sh "$d"); done
# ci/scripts/test-module.sh examples/basic-client-username/ -var-file=secret.tfvars
- 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: [email protected]
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
2 changes: 1 addition & 1 deletion .github/workflows/prep-internal-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
go-version: "1.22"

- name: Checkout the code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-registry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
go-version: "1.22"

- name: Check out code
uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit 1c5907d

Please sign in to comment.