-
Notifications
You must be signed in to change notification settings - Fork 75
111 lines (90 loc) · 2.95 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
name: Test
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
GOTOOLCHAIN: local
jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- run: go test -v -timeout=30s -parallel=8 -coverprofile=coverage.txt -coverpkg=./... ./...
- uses: codecov/codecov-action@v5
if: >
!startsWith(github.head_ref, 'renovate/') &&
!startsWith(github.head_ref, 'release-please--')
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit
e2e:
if: >
github.event_name == 'push' ||
github.event.pull_request.draft == false
needs: [unit]
runs-on: ubuntu-latest
permissions:
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.tool }}-${{ matrix.version }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
include:
- tool: opentofu
version: v1.7.x
- tool: opentofu
version: v1.8.x
- tool: terraform
version: v1.8.x
- tool: terraform
version: v1.9.x
steps:
- uses: actions/checkout@v4
- if: matrix.tool == 'terraform'
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.version }}
terraform_wrapper: false
- if: matrix.tool == 'opentofu'
uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.version }}
tofu_wrapper: false
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- uses: hetznercloud/tps-action@main
- if: matrix.tool == 'opentofu'
run: |
echo TF_ACC_TERRAFORM_PATH="$(which tofu)" >> $GITHUB_ENV
echo TF_ACC_PROVIDER_NAMESPACE="hashicorp" >> $GITHUB_ENV
echo TF_ACC_PROVIDER_HOST="registry.opentofu.org" >> $GITHUB_ENV
- run: go test -v -timeout=30m -parallel=8 -coverprofile=coverage.txt -coverpkg=./... ./...
env:
# Domain must be available in the account running the tests. This domain is
# available in the account running the public integration tests.
CERT_DOMAIN: hc-integrations-test.de
TF_ACC: 1
TF_LOG: DEBUG
TF_LOG_PATH_MASK: test-%s.log
TEST_DATACENTER: ${{ vars.TEST_DATACENTER }}
TEST_LOCATION: ${{ vars.TEST_LOCATION }}
- uses: codecov/codecov-action@v5
if: >
!startsWith(github.head_ref, 'renovate/') &&
!startsWith(github.head_ref, 'release-please--')
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: debug-logs-${{ matrix.tool }}-${{ matrix.version }}
path: internal/**/test-*.log