-
Notifications
You must be signed in to change notification settings - Fork 92
51 lines (50 loc) · 1.7 KB
/
default_plan_unit_tests.yml
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
name: Default Plan Unit Tests
on:
push:
branches: ['**'] # '*' will cause the workflow to run on all commits to all branches.
jobs:
go-tests:
name: Default Plan Unit Tests
runs-on: ubuntu-latest
environment: terraformSecrets
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
cache: false
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.9.6
terraform_wrapper: false
- name: Install terratest_log_parser
run: |
go install github.com/gruntwork-io/terratest/cmd/terratest_log_parser@latest
- name: Download Go Modules
working-directory: test
run: go mod download
- name: Set ssh keys for github remote download
working-directory: test
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_GITHUB }}" > ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa.pub
- name: Run Tests
working-directory: test
run: |
go test ./... -timeout 30m | tee test_output.log
terratest_log_parser -testlog test_output.log -outputdir test_output
env:
# TF ENVIRONMENT
TF_VAR_subscription_id: "${{ secrets.TF_VAR_SUBSCRIPTION_ID }}"
TF_VAR_tenant_id: "${{ secrets.TF_VAR_TENANT_ID }}"
TF_VAR_client_id: "${{ secrets.TF_VAR_CLIENT_ID }}"
TF_VAR_client_secret: "${{ secrets.TF_VAR_CLIENT_SECRET }}"
- name: Show Test Results log
working-directory: test
run: |
cat test_output/summary.log
- name: Check Results
working-directory: test/test_output
run: |
go run parse_results.go