-
Notifications
You must be signed in to change notification settings - Fork 20
56 lines (50 loc) · 1.46 KB
/
unit-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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