|
| 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 | + set -o pipefail |
| 80 | + mkdir -p /tmp/logs |
| 81 | + # Scope: OIDC-compatible examples only (AzureRM provider >= 3.7). |
| 82 | + # Examples on AzureRM 2.x cannot authenticate via OIDC and are |
| 83 | + # gated behind a follow-up provider-upgrade effort. |
| 84 | + go test -v -p 1 -tags azure -count=1 -timeout 45m \ |
| 85 | + -run '^(TestTerraformAzureContainerAppExample|TestTerraformAzureKeyVaultExample)$' \ |
| 86 | + ./test/azure/... 2>&1 | tee /tmp/logs/azure-integration-tests.log |
| 87 | +
|
| 88 | + - name: Upload test logs |
| 89 | + if: always() |
| 90 | + uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: azure-integration-test-logs |
| 93 | + path: /tmp/logs/ |
| 94 | + retention-days: 14 |
0 commit comments