Skip to content

Commit bd3323d

Browse files
authored
Merge branch 'main' into fix/azure-with-client-tests
2 parents a3400f5 + 57fac81 commit bd3323d

38 files changed

Lines changed: 1418 additions & 441 deletions

.circleci/config.yml

Lines changed: 1 addition & 441 deletions
Large diffs are not rendered by default.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: AWS Integration Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
aws-integration-tests:
11+
name: AWS Integration Tests
12+
if: >-
13+
github.event_name != 'pull_request' ||
14+
github.event.pull_request.head.repo.full_name == github.repository
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 60
17+
permissions:
18+
id-token: write
19+
contents: read
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install mise
25+
uses: jdx/mise-action@v3
26+
with:
27+
version: 2025.12.10
28+
experimental: true
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Go module cache
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
~/go/pkg/mod
37+
~/.cache/go-build
38+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
39+
restore-keys: |
40+
${{ runner.os }}-go-
41+
42+
- name: Download Go modules
43+
run: go mod download
44+
45+
- name: Configure AWS credentials
46+
uses: aws-actions/configure-aws-credentials@v4
47+
with:
48+
role-to-assume: arn:aws:iam::087285199408:role/terratest-gha
49+
aws-region: us-east-1
50+
51+
- name: Run AWS integration tests
52+
run: |
53+
mkdir -p /tmp/logs
54+
go test -v -p 1 -tags aws -count=1 -timeout 45m ./test/... 2>&1 | tee /tmp/logs/test_output.log
55+
56+
- name: Upload test logs
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: aws-integration-test-logs
61+
path: /tmp/logs/
62+
retention-days: 14
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
release:
8+
types: [created]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: Build (${{ matrix.os }}/${{ matrix.arch }})
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [linux, darwin, windows]
20+
arch: [amd64, arm64, "386"]
21+
exclude:
22+
- os: darwin
23+
arch: "386"
24+
- os: windows
25+
arch: arm64
26+
permissions:
27+
contents: read
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Install mise
33+
uses: jdx/mise-action@v3
34+
with:
35+
version: 2025.12.10
36+
experimental: true
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Go module cache
41+
uses: actions/cache@v4
42+
with:
43+
path: |
44+
~/go/pkg/mod
45+
~/.cache/go-build
46+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47+
restore-keys: |
48+
${{ runner.os }}-go-
49+
50+
- name: Download Go modules
51+
run: go mod download
52+
53+
- name: Build binaries
54+
run: |
55+
mkdir -p cmd/bin
56+
EXT=""
57+
if [ "${{ matrix.os }}" = "windows" ]; then EXT=".exe"; fi
58+
CGO_ENABLED=0 GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \
59+
go build -o "cmd/bin/terratest_log_parser_${{ matrix.os }}_${{ matrix.arch }}${EXT}" \
60+
./cmd/terratest_log_parser
61+
CGO_ENABLED=0 GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \
62+
go build -o "cmd/bin/pick-instance-type_${{ matrix.os }}_${{ matrix.arch }}${EXT}" \
63+
./cmd/pick-instance-type
64+
65+
- name: Upload build artifacts
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: binaries-${{ matrix.os }}-${{ matrix.arch }}
69+
path: cmd/bin/
70+
retention-days: 7
71+
72+
release:
73+
name: Release
74+
if: github.event_name == 'release'
75+
needs: build
76+
runs-on: ubuntu-latest
77+
timeout-minutes: 10
78+
permissions:
79+
contents: write
80+
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Download all build artifacts
85+
uses: actions/download-artifact@v4
86+
with:
87+
path: cmd/bin/
88+
pattern: binaries-*
89+
merge-multiple: true
90+
91+
- name: Generate SHA256SUMS
92+
run: cd cmd/bin && sha256sum -- * > SHA256SUMS
93+
94+
- name: Upload release assets
95+
env:
96+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
run: |
98+
for f in cmd/bin/*; do
99+
gh release upload "${{ github.ref_name }}" "$f" --clobber
100+
done

.github/workflows/k8s-tests.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Kubernetes Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
env:
10+
K8S_VERSION: "v1.28.0"
11+
12+
jobs:
13+
kubernetes-tests:
14+
name: Kubernetes Tests
15+
if: >-
16+
github.event_name != 'pull_request' ||
17+
github.event.pull_request.head.repo.full_name == github.repository
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
permissions:
21+
id-token: write
22+
contents: read
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install mise
28+
uses: jdx/mise-action@v3
29+
with:
30+
version: 2025.12.10
31+
experimental: true
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Go module cache
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
~/go/pkg/mod
40+
~/.cache/go-build
41+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
42+
restore-keys: |
43+
${{ runner.os }}-go-
44+
45+
- name: Download Go modules
46+
run: go mod download
47+
48+
- name: Configure AWS credentials
49+
uses: aws-actions/configure-aws-credentials@v4
50+
with:
51+
role-to-assume: arn:aws:iam::087285199408:role/terratest-gha
52+
aws-region: us-east-1
53+
54+
- name: Start minikube
55+
run: minikube start --driver=docker --kubernetes-version=${{ env.K8S_VERSION }}
56+
57+
- name: Run k8s module tests
58+
run: |
59+
mkdir -p /tmp/logs
60+
go test -v -tags kubernetes -count=1 -timeout 20m ./modules/k8s/... 2>&1 | tee /tmp/logs/test_output.log
61+
62+
- name: Run k8s integration tests
63+
run: |
64+
go test -v -tags kubernetes -run TestKubernetes -count=1 -timeout 20m ./test/... 2>&1 | tee -a /tmp/logs/test_output.log
65+
66+
- name: Upload test logs
67+
if: always()
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: kubernetes-test-logs
71+
path: /tmp/logs/
72+
retention-days: 14
73+
74+
helm-tests:
75+
name: Helm Tests
76+
if: >-
77+
github.event_name != 'pull_request' ||
78+
github.event.pull_request.head.repo.full_name == github.repository
79+
runs-on: ubuntu-latest
80+
timeout-minutes: 30
81+
permissions:
82+
id-token: write
83+
contents: read
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Install mise
89+
uses: jdx/mise-action@v3
90+
with:
91+
version: 2025.12.10
92+
experimental: true
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
96+
- name: Go module cache
97+
uses: actions/cache@v4
98+
with:
99+
path: |
100+
~/go/pkg/mod
101+
~/.cache/go-build
102+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
103+
restore-keys: |
104+
${{ runner.os }}-go-
105+
106+
- name: Download Go modules
107+
run: go mod download
108+
109+
- name: Configure AWS credentials
110+
uses: aws-actions/configure-aws-credentials@v4
111+
with:
112+
role-to-assume: arn:aws:iam::087285199408:role/terratest-gha
113+
aws-region: us-east-1
114+
115+
- name: Start minikube
116+
run: minikube start --driver=docker --kubernetes-version=${{ env.K8S_VERSION }}
117+
118+
- name: Run helm module tests
119+
run: |
120+
mkdir -p /tmp/logs
121+
go test -v -tags helm -count=1 -timeout 20m ./modules/helm/... 2>&1 | tee /tmp/logs/test_output.log
122+
123+
- name: Run helm integration tests
124+
run: |
125+
go test -v -tags helm -run TestHelm -count=1 -timeout 20m ./test/... 2>&1 | tee -a /tmp/logs/test_output.log
126+
127+
- name: Upload test logs
128+
if: always()
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: helm-test-logs
132+
path: /tmp/logs/
133+
retention-days: 14
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Terraform Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
terraform-tests:
11+
name: Terraform Tests (${{ matrix.iac }})
12+
if: >-
13+
github.event_name != 'pull_request' ||
14+
github.event.pull_request.head.repo.full_name == github.repository
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 45
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
iac: [terraform, tofu]
21+
permissions:
22+
id-token: write
23+
contents: read
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install mise
29+
uses: jdx/mise-action@v3
30+
with:
31+
version: 2025.12.10
32+
experimental: true
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Go module cache
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/go/pkg/mod
41+
~/.cache/go-build
42+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43+
restore-keys: |
44+
${{ runner.os }}-go-
45+
46+
- name: Download Go modules
47+
run: go mod download
48+
49+
- name: Configure AWS credentials
50+
uses: aws-actions/configure-aws-credentials@v4
51+
with:
52+
role-to-assume: arn:aws:iam::087285199408:role/terratest-gha
53+
aws-region: us-east-1
54+
55+
- name: Switch to OpenTofu
56+
if: matrix.iac == 'tofu'
57+
run: |
58+
# Remove terraform binary so terratest auto-detects tofu
59+
# (modules/terraform/cmd.go:252 - defaultTerraformExecutable falls back to tofu)
60+
sudo rm -f "$(which terraform 2>/dev/null)" || true
61+
tofu version
62+
63+
- name: Run terraform module tests
64+
run: |
65+
mkdir -p /tmp/logs
66+
go test -v -p 1 -count=1 -timeout 30m ./modules/terraform/... 2>&1 | tee /tmp/logs/test_output.log
67+
68+
- name: Upload test logs
69+
if: always()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: terraform-test-logs-${{ matrix.iac }}
73+
path: /tmp/logs/
74+
retention-days: 14

0 commit comments

Comments
 (0)