-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (99 loc) · 2.91 KB
/
test.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Tests
on:
push:
# Run regular tests to confirm that no upstream API changes have broken the provider
schedule:
- cron: '0 7 * * *'
jobs:
build:
name: Build and lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.21.0'
check-latest: true
cache: false
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Get dependencies
run: |
go mod download
- name: Lint
uses: golangci/[email protected]
with:
args: -v --timeout 1h ./...
skip-cache: true
- name: Check for errors
run: |
make errcheck
- name: Build
run: |
go build -v .
generate-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '>=1.21.0'
check-latest: true
cache: false
- uses: actions/checkout@v4
- run: go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Uncommitted doc updated detected"; exit 1)
test:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
terraform:
- '1.3.*'
- '1.4.*'
- '1.5.*'
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.21.0'
check-latest: true
cache: false
id: go
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Get dependencies
run: |
go mod download
- name: TF acceptance tests (staging backend)
timeout-minutes: 60
env:
TF_ACC: "1" # Enables provider acceptance test mode
TF_VAR_cloudtruth_api_key: ${{ secrets.STAGING_ACCEPTANCE_TEST_TOKEN }}
CLOUDTRUTH_API_KEY: ${{ secrets.STAGING_ACCEPTANCE_TEST_TOKEN }} # for tests without provider defs
CLOUDTRUTH_PROJECT: AcceptanceTest
CLOUDTRUTH_ENVIRONMENT: default
CLOUDTRUTH_DOMAIN: api.staging.cloudtruth.io
run: |
go test -timeout 60m -v -cover ./cloudtruth
- name: TF acceptance tests (prod backend)
timeout-minutes: 60
env:
TF_ACC: "1" # Enables provider acceptance test mode
TF_VAR_cloudtruth_api_key: ${{ secrets.ACCEPTANCE_TEST_TOKEN }}
CLOUDTRUTH_API_KEY: ${{ secrets.ACCEPTANCE_TEST_TOKEN }} # for tests without provider defs
CLOUDTRUTH_PROJECT: AcceptanceTest
CLOUDTRUTH_ENVIRONMENT: default
run: |
go test -timeout 60m -v -cover ./cloudtruth