Skip to content

CI

CI #676

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- master
schedule:
- cron: 0 14 * * MON-FRI # Every weekday at 14:00 UTC
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
go-version: [1.20.x, 1.21.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ matrix.go-version }}
# Need terraform to format the examples
- name: Setup Terraform
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
with:
terraform_version: '1.4.*'
terraform_wrapper: false
- name: Generate
run: make generate
- name: Confirm no diff
run: |
git diff --compact-summary --exit-code || \
(echo "*** Unexpected differences after code generation. Run 'make generate' and commit."; exit 1)
- name: Build
run: make build
test:
needs: build
name: 'Acceptance Tests (OS: ${{ matrix.cases.os }} / TF: ${{ matrix.cases.terraform }})'
runs-on: ${{ matrix.cases.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
cases:
- { os: ubuntu-latest, terraform: '1.0.*' }
- { os: ubuntu-latest, terraform: '1.1.*' }
- { os: ubuntu-latest, terraform: '1.2.*' }
- { os: ubuntu-latest, terraform: '1.3.*' }
- { os: ubuntu-latest, terraform: '1.4.*' }
# Two additional cases to test on macos and windows for latest TF
# version
- { os: macos-latest, terraform: '1.4.*' }
- { os: windows-latest, terraform: '1.4.*' }
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: 'go.mod'
- name: Setup Terraform ${{ matrix.cases.terraform }}
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
with:
terraform_version: ${{ matrix.cases.terraform }}
terraform_wrapper: false
- name: Run acceptance tests
run: make testacc | tee test_result.txt
shell: bash
env:
ACCTEST_PARALLELISM: 10
BASTIONZERO_API_SECRET: ${{ secrets.ACCEPTANCE_TESTS_API_SECRET }}
BASTIONZERO_HOST: ${{ vars.ACCEPTANCE_TESTS_BASTIONZERO_HOST }}
- name: Check that no test is skipped
run: >-
grep "SKIP" test_result.txt -B 2;
retVal=$?;
if [ $retVal -ne 1 ]; then
echo "*** Some tests were skipped. Please ensure that no tests are skipped by creating the respective API objects listed above.";
exit 1;
else
echo "*** No tests were skipped!";
exit 0;
fi
shell: bash {0} # override -e default