-
Notifications
You must be signed in to change notification settings - Fork 12k
209 lines (197 loc) · 8.41 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
- '[0-9]+.[0-9]+.x'
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: bash
jobs:
analyze:
runs-on: ubuntu-latest
outputs:
snapshots: ${{ steps.filter.outputs.snapshots }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: filter
with:
filters: |
snapshots:
- 'tests/legacy-cli/e2e/ng-snapshot/package.json'
lint:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup ESLint Caching
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: .eslintcache
key: ${{ runner.os }}-${{ hashFiles('.eslintrc.json') }}
- name: Install node modules
run: yarn install --frozen-lockfile --ignore-scripts
- name: Run ESLint
run: yarn lint --cache-strategy content
- name: Validate NgBot Configuration
run: yarn ng-dev ngbot verify
- name: Validate Circular Dependencies
run: yarn ts-circular-deps:check
- name: Run Validation
run: yarn -s admin validate
- name: Check tooling setup
run: yarn -s check-tooling-setup
- name: Check commit message
# Commit message validation is only done on pull requests as its too late to validate once
# it has been merged.
if: github.event_name == 'pull_request'
run: yarn ng-dev commit-message validate-range ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Check code format
# Code formatting checks are only done on pull requests as its too late to validate once
# it has been merged.
if: github.event_name == 'pull_request'
run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }}
build:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Build release targets
run: yarn ng-dev release build
- name: Store PR release packages
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: packages
path: dist/releases/*.tgz
retention-days: 14
test:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn bazel test //packages/...
e2e:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node: [18, 20]
subset: [npm, yarn, esbuild]
shard: [0, 1, 2, 3, 4, 5]
exclude:
# Exclude Node.js v18 when running on a PR
- node: ${{ github.event_name != 'pull_request' && 'none' || '18' }}
# Exclude Windows when running on a PR
- os: ${{ github.event_name != 'pull_request' && 'none' || 'windows-latest' }}
# Skip yarn subset on Windows
- os: windows-latest
subset: yarn
# Skip node 18 tests on Windows
- os: windows-latest
node: 18
runs-on: ${{ matrix.os }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
e2e-snapshots:
needs: analyze
if: needs.analyze.outputs.snapshots == 'true' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18]
subset: [npm, yarn, esbuild]
shard: [0, 1, 2, 3, 4, 5]
runs-on: ${{ matrix.os }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.snapshots.${{ matrix.subset }}_node${{ matrix.node }}
browsers:
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Browser Compatibility Tests
env:
SAUCE_TUNNEL_IDENTIFIER: angular-cli-${{ github.workflow }}-${{ github.run_number }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Run E2E Browser tests
env:
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_LOG_FILE: /tmp/angular/sauce-connect.log
SAUCE_READY_FILE: /tmp/angular/sauce-connect-ready-file.lock
SAUCE_PID_FILE: /tmp/angular/sauce-connect-pid-file.lock
SAUCE_TUNNEL_IDENTIFIER: 'angular-${{ github.run_number }}'
SAUCE_READY_FILE_TIMEOUT: 120
run: |
./scripts/saucelabs/start-tunnel.sh &
./scripts/saucelabs/wait-for-tunnel.sh
yarn bazel test --config=saucelabs //tests/legacy-cli:e2e.saucelabs
./scripts/saucelabs/stop-tunnel.sh
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: ${{ failure() }}
with:
name: sauce-connect-log
path: ${{ env.SAUCE_CONNECT_DIR_IN_HOST }}/sauce-connect.log
publish-snapshots:
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
CIRCLE_BRANCH: ${{ github.ref_name }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1337ad7c046566310c1748a4bdf3a12d89207a0d
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@1337ad7c046566310c1748a4bdf3a12d89207a0d
- run: yarn admin snapshots --verbose
env:
SNAPSHOT_BUILDS_GITHUB_TOKEN: ${{ secrets.SNAPSHOT_BUILDS_GITHUB_TOKEN }}