Skip to content

Enhanced broker check #14

Enhanced broker check

Enhanced broker check #14

name: Build Terraform Provider in Development phase
on:
push:
branches-ignore:
- main
jobs:
build:
name: Build & test Terraform provider
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
- name: Check out code
uses: actions/checkout@v3
- name: Set up Terraform latest
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- name: Checkout generator
uses: actions/checkout@v3
with:
repository: SolaceDev/broker-terraform-provider-generator
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
path: broker-terraform-provider-generator
ref: "ApplianceSupport"
- name: Build and install generator
run: |
pushd broker-terraform-provider-generator
go mod tidy
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"
BASE=`pwd`
pushd internal/broker/generated
rm ./*
SEMP_V2_SWAGGER_CONFIG_EXTENDED_JSON="$BASE/ci/swagger_spec/$SWAGGER_SPEC_NAME" ~/go/bin/broker-terraform-provider-generator all
popd
- name: Build provider
run: |
go mod tidy
go fmt
make install
~/go/bin/terraform-provider-solacebrokerappliance version
~/go/bin/terraform-provider-solacebrokerappliance help
- name: Test Provider and generate documentations
run: |
make test-coverage
make generate-docs
- name: Check changed files
uses: tj-actions/verify-changed-files@v14
id: check-changed-files
with:
files: |
internal/broker/generated
docs
- 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 [skip ci]'
add: 'internal/broker/generated/*.go'
new_branch: GeneratedSourceUpdates-${{ github.ref_name }}
# - name: Create pull request
# if: steps.check-changed-files.outputs.files_changed == 'true'
# run: |
# CURRENT_BRANCH=${GITHUB_REF_NAME}
# gh pr create -B ${CURRENT_BRANCH} -H "GeneratedSourceUpdates-${CURRENT_BRANCH}" --title "Merge generated source updates into ${CURRENT_BRANCH}" --body 'Created by Github action'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Plugin-Integration-Test:
needs: build
uses: ./.github/workflows/provider-test-pipeline.yml
secrets: inherit
Plugin-Acceptance-Test:
needs: build
uses: ./.github/workflows/provider-acceptance-test.yml
secrets: inherit
CLI-Integration-Test:
needs: build
uses: ./.github/workflows/cli-test-pipeline.yml
secrets: inherit