Call REST API to assert agents (#428) #1770
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: Unit Testing | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'modules/**' | |
- 'test/**' | |
pull_request: | |
jobs: | |
test: | |
name: Automated Testing | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Go environment | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.18' | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v2 | |
with: | |
version: latest | |
args: --timeout 3m0s | |
working-directory: test/ | |
# Optional: if set to true then the action will use pre-installed Go. | |
skip-go-installation: true | |
- name: Setup dependencies | |
working-directory: test/ | |
run: go get -v -t -d ./... && go mod tidy | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_IAM_ROLE }} | |
role-session-name: DCTerraformSession | |
role-duration-seconds: 7200 | |
- name: Unit tests | |
working-directory: test/unittest | |
run: | | |
TESTS=$(go test -list . | grep -v 'ok\s\+github.com/atlassian-labs/data-center-terraform/test/unittest') | |
for test in ${TESTS[@]}; do | |
go test -run ${test} -v | |
rm -rf /tmp/* >/dev/null 2>&1 || true | |
done |