Skip to content

Commit 411e9d9

Browse files
committed
ci: add Azure integration tests GitHub Actions workflow
Runs `go test -tags azure ./test/azure/...` against a real Azure subscription on push to main, PRs from same-repo branches, and workflow_dispatch. Authenticates via OIDC federated credentials using the AZURE_CLIENT_ID / AZURE_TENANT_ID / AZURE_SUBSCRIPTION_ID secrets, so no client secret is stored in the repo. PRs from forks are blocked at the job level so secrets are never exposed. A concurrency group cancels superseded runs on the same ref to avoid overlapping Azure resource provisioning.
1 parent e3a3d87 commit 411e9d9

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Azure Integration Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'modules/azure/**'
8+
- 'test/azure/**'
9+
- 'examples/azure/**'
10+
- 'go.mod'
11+
- 'go.sum'
12+
- 'mise.toml'
13+
- '.github/workflows/azure-integration-tests.yml'
14+
pull_request:
15+
paths:
16+
- 'modules/azure/**'
17+
- 'test/azure/**'
18+
- 'examples/azure/**'
19+
- 'go.mod'
20+
- 'go.sum'
21+
- 'mise.toml'
22+
- '.github/workflows/azure-integration-tests.yml'
23+
workflow_dispatch:
24+
25+
concurrency:
26+
group: azure-integration-tests-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
azure-integration-tests:
31+
name: Azure Integration Tests
32+
if: >-
33+
github.event_name != 'pull_request' ||
34+
github.event.pull_request.head.repo.full_name == github.repository
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 60
37+
permissions:
38+
id-token: write
39+
contents: read
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Install mise
45+
uses: jdx/mise-action@v3
46+
with:
47+
version: 2025.12.10
48+
experimental: true
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Go module cache
53+
uses: actions/cache@v4
54+
with:
55+
path: |
56+
~/go/pkg/mod
57+
~/.cache/go-build
58+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
59+
restore-keys: |
60+
${{ runner.os }}-go-
61+
62+
- name: Download Go modules
63+
run: go mod download
64+
65+
- name: Azure login (OIDC)
66+
uses: azure/login@v2
67+
with:
68+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
69+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
70+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
71+
72+
- name: Run Azure integration tests
73+
env:
74+
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
75+
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
76+
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
77+
ARM_USE_OIDC: "true"
78+
run: |
79+
mkdir -p /tmp/logs
80+
go test -v -p 1 -tags azure -count=1 -timeout 45m ./test/azure/... 2>&1 | tee /tmp/logs/azure-integration-tests.log
81+
82+
- name: Upload test logs
83+
if: always()
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: azure-integration-test-logs
87+
path: /tmp/logs/
88+
retention-days: 14

0 commit comments

Comments
 (0)