- don't raise error if there is no terraform version constraint in te… #132
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: | |
push: | |
branches: | |
- '*' # matches every branch that doesn't contain a '/' | |
- '*/*' # matches every branch containing a single '/' | |
- '**' # matches every branch | |
- '!master' # excludes `master` branch | |
env: | |
CGO_ENABLED: 0 # Build statically linked binaries | |
jobs: | |
fmt_and_vet: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- name: Check vet | |
run: | | |
go vet ./... | |
- name: Check fmt | |
run: | | |
go fmt ./... | |
if [[ -z "$(git status --porcelain)" ]]; then | |
echo "Formatting is consistent with 'go fmt'." | |
else | |
echo "Run 'go fmt ./...' to automatically apply standard Go style to all packages." | |
git status --porcelain | |
exit 1 | |
fi | |
integration_tests_linux: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
go_version: ['1.22'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go_version }} | |
- name: Build code | |
run: go build -v ./... | |
- name: Running unit tests | |
run: | | |
go test -v ./... | |
- name: Running integration tests | |
run: | | |
set -e | |
mkdir -p build | |
go build -v -o build/tfswitch | |
mkdir `pwd`/bin/ | |
find ./test-data/integration-tests/* -type d -print0 | while read -r -d $'\0' TEST_PATH; do | |
./build/tfswitch -c "${TEST_PATH}" -b `pwd`/bin/terraform || exit 1 | |
done | |
integration_tests_windows: | |
strategy: | |
matrix: | |
os: [windows-latest] | |
go_version: ['1.22'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go_version }} | |
- name: Running unit tests | |
run: | | |
go test -v ./... |