Repository navigation
261 lines (258 loc) · 9.64 KB
/
Copy pathlint.yml
File metadata and controls
261 lines (258 loc) · 9.64 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
name: Lint
concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]
push:
branches: [main]
permissions:
contents: read
jobs:
lint:
if: "${{ (needs.ci-reuse.result != 'success' && !cancelled()) || ((success()) && needs.ci-reuse.outputs.reuse != 'true') }}"
needs:
- ci-reuse
runs-on: ubuntu-latest
steps:
- name: Fail if tree verification failed
if: needs.ci-reuse.result != 'success'
run: exit 1
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Cache Angular
uses: actions/cache@v5
with:
path: .angular/cache
key: ${{ runner.os }}-angular-${{ hashFiles('package-lock.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-angular-${{ hashFiles('package-lock.json') }}-
${{ runner.os }}-angular-
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test:package-consumer
- run: npm run test:offline-types:nonstrict
test:
if: "${{ (needs.ci-reuse.result != 'success' && !cancelled()) || ((success()) && needs.ci-reuse.outputs.reuse != 'true') }}"
needs:
- ci-reuse
runs-on: ubuntu-latest
strategy:
matrix:
project: [demo, kit, photo-editor, scroll-header, scroll-strategies]
steps:
- name: Fail if tree verification failed
if: needs.ci-reuse.result != 'success'
run: exit 1
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Cache Angular
uses: actions/cache@v5
with:
path: .angular/cache
key: ${{ runner.os }}-angular-${{ hashFiles('package-lock.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-angular-${{ hashFiles('package-lock.json') }}-
${{ runner.os }}-angular-
- run: npm ci
- run: npm run build
- run: npm run test -- ${{ matrix.project }} --watch=false
test-actions:
if: "${{ (needs.ci-reuse.result != 'success' && !cancelled()) || ((success()) && needs.ci-reuse.outputs.reuse != 'true') }}"
needs:
- ci-reuse
runs-on: ubuntu-latest
steps:
- name: Fail if tree verification failed
if: needs.ci-reuse.result != 'success'
run: exit 1
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: '**/package-lock.json'
- run: npm ci
- run: npm run test:actions
angular-21-compat:
if: "${{ (needs.ci-reuse.result != 'success' && !cancelled()) || ((success()) && needs.ci-reuse.outputs.reuse != 'true') }}"
needs:
- ci-reuse
runs-on: ubuntu-latest
steps:
- name: Fail if tree verification failed
if: needs.ci-reuse.result != 'success'
run: exit 1
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24.15.0
cache: npm
cache-dependency-path: '**/package-lock.json'
- run: npm ci
- name: Install the Angular 21 compatibility toolchain
run: >-
npm install --no-save --force
@angular/animations@^21.2.0
@angular/build@^21.2.0
@angular/cdk@^21.2.0
@angular/cli@^21.2.0
@angular/common@^21.2.0
@angular/compiler@^21.2.0
@angular/compiler-cli@^21.2.0
@angular/core@^21.2.0
@angular/forms@^21.2.0
@angular/platform-browser@^21.2.0
@angular/platform-browser-dynamic@^21.2.0
@angular/router@^21.2.0
@angular/service-worker@^21.2.0
ng-packagr@^21.2.0
typescript@~5.9.3
- name: Build libraries and consuming demo with Angular 21
run: npm run build
- name: Type-check a consumer against packed Angular 21 artifacts
run: npm run test:package-consumer
e2e:
if: "${{ (needs.ci-reuse.result != 'success' && !cancelled()) || ((success()) && needs.ci-reuse.outputs.reuse != 'true') }}"
needs:
- ci-reuse
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.57.0-noble
steps:
- name: Fail if tree verification failed
if: needs.ci-reuse.result != 'success'
run: exit 1
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Cache Angular
uses: actions/cache@v5
with:
path: .angular/cache
key: ${{ runner.os }}-angular-${{ hashFiles('package-lock.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-angular-${{ hashFiles('package-lock.json') }}-
${{ runner.os }}-angular-
- run: npm ci
- name: Run e2e tests
run: npm run e2e
env:
CI: true
HOME: /root
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7
ci-reuse:
name: Verify tested tree
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
actions: read
pull-requests: read
outputs:
reuse: ${{ steps.lookup.outputs.reuse }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Test CI reuse guards
run: node --test .github/scripts/ci-tree-reuse.test.mjs
- name: Record the actual complete checkout
id: tree
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
with:
script: |
const { execFileSync } = await import('node:child_process');
const { writeFileSync } = await import('node:fs');
const git = (...args) => execFileSync('git', args, { encoding: 'utf8' }).trim();
const tree = git('rev-parse', 'HEAD^{tree}');
const commit = git('rev-parse', 'HEAD');
core.setOutput('tree', tree);
core.setOutput('commit', commit);
writeFileSync(`${process.env.RUNNER_TEMP}/ci-tree.txt`, `${commit}\n${tree}\n`);
- name: Reuse only the latest successful PR CI for this tree
id: lookup
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
env:
TREE: ${{ steps.tree.outputs.tree }}
with:
script: |
const { resolveReuse } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/ci-tree-reuse.mjs`);
const result = await resolveReuse(github, context, process.env.TREE, 'lint.yml');
core.setOutput('reuse', String(result.reuse));
if (result.reuse) {
await core.summary.addHeading('Reused PR validation').addLink('Latest successful PR CI', result.url)
.addRaw(`\n\nComplete repository tree: ${result.tree}\n`).write();
} else {
core.info(result.reason);
}
ci-result:
name: CI result
if: ${{ always() }}
needs:
- ci-reuse
- lint
- test
- test-actions
- angular-21-compat
- e2e
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- name: Require executed tests or verified reuse
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
env:
NEEDS: ${{ toJSON(needs) }}
REUSE: ${{ needs.ci-reuse.outputs.reuse }}
with:
script: |
const { requireResults } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/ci-tree-reuse.mjs`);
requireResults(process.env.REUSE === 'true', JSON.parse(process.env.NEEDS), ["lint", "test", "test-actions", "angular-21-compat", "e2e"], []);
- name: Record the actual complete checkout
id: tree
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
with:
script: |
const { execFileSync } = await import('node:child_process');
const { writeFileSync } = await import('node:fs');
const git = (...args) => execFileSync('git', args, { encoding: 'utf8' }).trim();
const tree = git('rev-parse', 'HEAD^{tree}');
const commit = git('rev-parse', 'HEAD');
core.setOutput('tree', tree);
core.setOutput('commit', commit);
writeFileSync(`${process.env.RUNNER_TEMP}/ci-tree.txt`, `${commit}\n${tree}\n`);
if: github.event_name == 'pull_request' && github.event.action != 'closed' && !contains(needs.*.result, 'skipped')
- name: Record PR checkout evidence
if: github.event_name == 'pull_request' && github.event.action != 'closed' && !contains(needs.*.result, 'skipped')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: ci-tree-pr-${{ github.event.pull_request.number }}-${{ steps.tree.outputs.tree }}-${{ steps.tree.outputs.commit
}}-${{ github.run_attempt }}
path: ${{ runner.temp }}/ci-tree.txt
if-no-files-found: error
retention-days: 30