-
-
Notifications
You must be signed in to change notification settings - Fork 20
232 lines (203 loc) · 6.7 KB
/
Copy pathe2e.yml
File metadata and controls
232 lines (203 loc) · 6.7 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: E2E Tests
env:
CI: true
on:
pull_request:
branches:
- next
- master
workflow_dispatch:
inputs:
target_branch:
description: 'E2E Target Branch'
required: true
type: string
default: 'next'
permissions:
contents: write
id-token: write
jobs:
version-preview:
name: Version Preview
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.capture.outputs.versions }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.ref || inputs.target_branch }}
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Config Git
run: |
git config --global user.email "e2e@suites.dev"
git config --global user.name "Suites e2e"
- name: Version Packages (Preview)
run: |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
npx lerna version --yes \
--conventional-commits \
--conventional-prerelease \
--preid e2e \
--no-changelog \
--allow-branch "$BRANCH_NAME" \
--no-git-tag-version \
--no-push \
--force-publish \
--no-commit-hooks
- name: Capture Versions
id: capture
run: |
echo "## 📦 E2E Version Preview" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "These versions will be tested in the e2e workflow:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
lerna ls --json | jq -r '.[] | "- **\(.name)** → `v\(.version)`"' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🧪 Testing Matrix" >> $GITHUB_STEP_SUMMARY
echo "- **Projects**: 8 (jest/nestjs, sinon/nestjs, vitest/nestjs, esm/jest/nestjs, esm/vitest/nestjs, jest/inversify, sinon/inversify, vitest/inversify)" >> $GITHUB_STEP_SUMMARY
echo "- **Node versions**: 4 (18.x, 20.x, 22.x, 24.x)" >> $GITHUB_STEP_SUMMARY
echo "- **Total jobs**: 29 (8x4 minus 3 vitest exclusions on Node 18)" >> $GITHUB_STEP_SUMMARY
# Save versions for artifacts
lerna ls --json > versions.json
- name: Upload Version Info
uses: actions/upload-artifact@v4
with:
name: version-preview
path: versions.json
e2e:
name: E2E (${{ matrix.e2e-project }}, Node ${{ matrix.node-version }})
needs: [version-preview]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
e2e-project:
[
# NestJS
'jest/nestjs',
'vitest/nestjs',
'sinon/nestjs',
'esm/jest/nestjs',
'esm/vitest/nestjs',
# Inversify
'jest/inversify',
'vitest/inversify',
'sinon/inversify',
]
node-version: [18.x, 20.x, 22.x, 24.x]
exclude:
- e2e-project: 'vitest/nestjs'
node-version: 18.x
- e2e-project: 'esm/vitest/nestjs'
node-version: 18.x
- e2e-project: 'vitest/inversify'
node-version: 18.x
steps:
- name: Checkout
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.ref || inputs.target_branch }}
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Verdaccio Docker
run: |
docker run -d --name verdaccio \
-p 4873:4873 \
-v ${{ github.workspace }}/e2e/config.yaml:/verdaccio/conf/config.yaml \
verdaccio/verdaccio
- name: Build
run: pnpm build
- name: Setup Registry
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
registry-url: http://localhost:4873
scope: '@suites'
always-auth: false
- name: Install jq
run: sudo apt-get install jq
- name: Remove provenance from package.json files
run: |
find packages -name 'package.json' | while read filename; do
jq 'del(.publishConfig.provenance)' "$filename" > temp.json && mv temp.json "$filename"
done
- name: Config Git
run: |
git config --global user.email "e2e@suites.dev"
git config --global user.name "Suites e2e"
- name: Commit Provenance Change
run: |
git add .
git commit -am "remove provenance"
- name: Version Packages
run: |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
npx lerna version --yes \
--conventional-commits \
--conventional-prerelease \
--preid e2e \
--no-changelog \
--allow-branch "$BRANCH_NAME" \
--no-git-tag-version \
--no-push \
--force-publish \
--no-commit-hooks
- name: Commit Packages Versions
run: |
git add .
git commit -am "bump versions"
- name: Publish Packages to Verdaccio
run: |
pnpm lerna publish from-package --yes \
--no-git-tag-version \
--no-push \
--no-git-reset \
--exact \
--dist-tag e2e
- name: Parse E2E Project
run: |
project="${{ matrix.e2e-project }}"
if [[ "$project" == esm/* ]]; then
IFS='/' read -r _ library framework <<< "$project"
echo "FRAMEWORK=$framework" >> $GITHUB_ENV
echo "LIBRARY=esm/$library" >> $GITHUB_ENV
else
IFS='/' read -r library framework <<< "$project"
echo "FRAMEWORK=$framework" >> $GITHUB_ENV
echo "LIBRARY=$library" >> $GITHUB_ENV
fi
- name: Clean Source
run: |
rm -rf packages
rm -rf node_modules
rm pnpm-lock.yaml
rm package.json
rm -f .npmrc
- name: Install Dependencies from Verdaccio
run: |
cd "$PWD/e2e/$LIBRARY/$FRAMEWORK"
npm install --force --no-package-lock
npm install --dev --no-package-lock @types/node@${{ matrix.node-version }}
- name: Execute Test
run: |
cd "$PWD/e2e/$LIBRARY/$FRAMEWORK"
npm test