-
Notifications
You must be signed in to change notification settings - Fork 7
133 lines (113 loc) Β· 6.15 KB
/
Copy pathe2e-tests.yaml
File metadata and controls
133 lines (113 loc) Β· 6.15 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
---
name: π§ͺ E2E Tests
# This GitHub action runs your tests before merging a pull request via merge groups
# Merge Group Discussions: https://github.com/orgs/community/discussions/51120
on:
pull_request:
merge_group:
workflow_dispatch:
schedule:
- cron: 0 21 * * *
permissions: {}
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
e2e-tests:
if: github.event_name != 'pull_request'
name: π§ͺ E2E Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2025]
type: [arm, bicep, terraform]
permissions:
contents: read
id-token: write
steps:
- name: π©Ί Debug
uses: raven-actions/debug@9dbdeb7eea607a7d73411895c65987e71d59a466 # v1.2.0
- name: β€΅οΈ Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: π§Ή Clean Terraform sample artifacts
if: matrix.type == 'terraform'
run: git clean -ffdx samples/terraform
- name: π§ Setup Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
cache: true
- name: π§ Setup Task
uses: go-task/setup-task@01a4adf9db2d14c1de7a560f09170b6e0df736aa # v2.1.0
- name: π Download Go dependencies
run: task deps:download
- name: π¨ Setup Test tools
run: task go:tools:test
- name: π¦ Install Bicep
if: matrix.type == 'bicep'
run: task az:install:bicep
- name: π¦ Install Terraform
if: matrix.type == 'terraform'
run: task tf:install:terraform
- name: π Ensure bin path
if: runner.os == 'Linux'
run: |
INSTALL_PATH="$HOME/.local/bin"
echo "$INSTALL_PATH" >> "${GITHUB_PATH}"
export PATH="$INSTALL_PATH:$PATH"
shell: bash
- name: π Ensure bin path
if: runner.os == 'Windows'
run: |
$INSTALL_PATH = "$env:USERPROFILE\.local\bin"
$INSTALL_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:PATH = "$INSTALL_PATH;$env:PATH"
$INSTALL_PATH = "$env:LOCALAPPDATA\Microsoft\WinGet\Links"
$INSTALL_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:PATH = "$INSTALL_PATH;$env:PATH"
$INSTALL_PATH = "$env:LOCALAPPDATA\Microsoft\WindowsApps"
$INSTALL_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:PATH = "$INSTALL_PATH;$env:PATH"
shell: pwsh
- name: π Azure Login
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
with:
client-id: ${{ secrets.AZURE_OID_CLIENT_ID }}
tenant-id: ${{ secrets.MPF_TENANTID }}
subscription-id: ${{ secrets.MPF_SUBSCRIPTIONID }}
- name: π§ͺ Run ${{ matrix.type }} E2E Tests
if: runner.os == 'Linux'
run: task teste2e:${{ matrix.type }}
env:
MPF_SUBSCRIPTIONID: ${{ secrets.MPF_SUBSCRIPTIONID }}
MPF_TENANTID: ${{ secrets.MPF_TENANTID }}
MPF_SPCLIENTID: ${{ matrix.type == 'terraform' && secrets[format('MPF_TERRAFORM_{0}_SPCLIENTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || matrix.type == 'arm' && secrets[format('MPF_ARM_{0}_SPCLIENTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || secrets[format('MPF_BICEP_{0}_SPCLIENTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] }}
MPF_SPCLIENTSECRET: ${{ matrix.type == 'terraform' && secrets[format('MPF_TERRAFORM_{0}_SPCLIENTSECRET', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || matrix.type == 'arm' && secrets[format('MPF_ARM_{0}_SPCLIENTSECRET', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || secrets[format('MPF_BICEP_{0}_SPCLIENTSECRET', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] }}
MPF_SPOBJECTID: ${{ matrix.type == 'terraform' && secrets[format('MPF_TERRAFORM_{0}_SPOBJECTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || matrix.type == 'arm' && secrets[format('MPF_ARM_{0}_SPOBJECTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || secrets[format('MPF_BICEP_{0}_SPOBJECTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] }}
- name: π§ͺ Run ${{ matrix.type }} CLI Tests
run: task testcli:${{ matrix.type }}
env:
MPF_SUBSCRIPTIONID: ${{ secrets.MPF_SUBSCRIPTIONID }}
MPF_TENANTID: ${{ secrets.MPF_TENANTID }}
MPF_SPCLIENTID: ${{ matrix.type == 'terraform' && secrets[format('MPF_TERRAFORM_{0}_SPCLIENTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || matrix.type == 'arm' && secrets[format('MPF_ARM_{0}_SPCLIENTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || secrets[format('MPF_BICEP_{0}_SPCLIENTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] }}
MPF_SPCLIENTSECRET: ${{ matrix.type == 'terraform' && secrets[format('MPF_TERRAFORM_{0}_SPCLIENTSECRET', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || matrix.type == 'arm' && secrets[format('MPF_ARM_{0}_SPCLIENTSECRET', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || secrets[format('MPF_BICEP_{0}_SPCLIENTSECRET', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] }}
MPF_SPOBJECTID: ${{ matrix.type == 'terraform' && secrets[format('MPF_TERRAFORM_{0}_SPOBJECTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || matrix.type == 'arm' && secrets[format('MPF_ARM_{0}_SPOBJECTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] || secrets[format('MPF_BICEP_{0}_SPOBJECTID', runner.os == 'Windows' && 'WINDOWS' || 'LINUX')] }}
check-e2e-tests:
if: always()
name: π§ͺ Check E2E Tests
needs: e2e-tests
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: β
OK
if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
run: exit 0
- name: π Failure
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1