-
-
Notifications
You must be signed in to change notification settings - Fork 16
175 lines (152 loc) · 6.44 KB
/
ci-monday-e2e.yml
File metadata and controls
175 lines (152 loc) · 6.44 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: CI - Monday E2E
on:
schedule:
- cron: '0 6 * * 1' # Monday 06:00 UTC
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
required: false
default: 'dev'
type: string
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions: {}
jobs:
# -----------------------------------------------------------------------
# Job 1: Discover all Nx projects that have an `e2e` target and emit a
# JSON matrix with per-project runner assignments.
# -----------------------------------------------------------------------
discover:
name: Discover E2E Projects
runs-on: ubuntu-latest
timeout-minutes: 10
env:
NX_NO_CLOUD: true
permissions:
contents: read
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
has_projects: ${{ steps.matrix.outputs.has_projects }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ inputs.branch || 'dev' }}
- name: Setup Node v24
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24
- name: Setup pnpm v10
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
with:
version: 10
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build e2e matrix
id: matrix
run: |
# Get all projects with an e2e target, excluding desktop-only apps
PROJECTS=$(pnpm nx show projects --with-target e2e 2>/dev/null | grep -v '^q$' | sort)
if [ -z "$PROJECTS" ]; then
echo "No e2e projects found"
echo "has_projects=false" >> "$GITHUB_OUTPUT"
echo 'matrix={"include":[]}' >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Discovered e2e projects:"
echo "$PROJECTS"
# Build matrix entries with runner + playwright assignments.
# Heavy Docker-based tests go to arc-runner-set;
# lighter Playwright/vitest tests stay on ubuntu-latest.
ENTRIES="[]"
while IFS= read -r project; do
[ -z "$project" ] && continue
RUNNER="ubuntu-latest"
PLAYWRIGHT="true"
case "$project" in
axum-kbve-e2e|mc-e2e|edge-e2e)
RUNNER="arc-runner-set"
PLAYWRIGHT="false"
;;
devops-e2e)
PLAYWRIGHT="false"
;;
esac
ENTRIES=$(echo "$ENTRIES" | jq -c \
--arg name "$project" \
--arg runner "$RUNNER" \
--arg pw "$PLAYWRIGHT" \
'. + [{"name": $name, "runner": $runner, "playwright": ($pw == "true")}]')
done <<< "$PROJECTS"
MATRIX=$(echo "$ENTRIES" | jq -c '{include: .}')
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
echo "has_projects=true" >> "$GITHUB_OUTPUT"
echo "::group::Generated matrix"
echo "$MATRIX" | jq .
echo "::endgroup::"
# -----------------------------------------------------------------------
# Job 2: Fan out — one runner per e2e project using the reusable
# docker-test-app workflow.
# -----------------------------------------------------------------------
e2e:
name: E2E - ${{ matrix.name }}
needs: discover
if: needs.discover.outputs.has_projects == 'true'
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
uses: KBVE/kbve/.github/workflows/docker-test-app.yml@dev
with:
project: ${{ matrix.name }}
runner: ${{ matrix.runner }}
install_playwright: ${{ matrix.playwright }}
# -----------------------------------------------------------------------
# Job 3: Summary — collect results and report.
# -----------------------------------------------------------------------
summary:
name: Monday E2E Summary
needs: [discover, e2e]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Download test markers
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
pattern: test-passed-docker-*
path: ./test-results
merge-multiple: false
continue-on-error: true
- name: Report results
env:
MATRIX: ${{ needs.discover.outputs.matrix }}
run: |
echo "## Monday E2E Results" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Project | Status |" >> "$GITHUB_STEP_SUMMARY"
echo "|---------|--------|" >> "$GITHUB_STEP_SUMMARY"
TOTAL=0
PASSED=0
for project in $(echo "$MATRIX" | jq -r '.include[].name'); do
TOTAL=$((TOTAL + 1))
if [ -f "./test-results/test-passed-docker-${project}/test-result.txt" ]; then
echo "| $project | :white_check_mark: Passed |" >> "$GITHUB_STEP_SUMMARY"
PASSED=$((PASSED + 1))
else
echo "| $project | :x: Failed |" >> "$GITHUB_STEP_SUMMARY"
fi
done
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**$PASSED / $TOTAL passed**" >> "$GITHUB_STEP_SUMMARY"
if [ "$PASSED" -lt "$TOTAL" ]; then
echo ""
echo "::warning::Monday E2E: $PASSED/$TOTAL projects passed"
fi