Skip to content

Commit 7e8c6a7

Browse files
committed
ci: split ci into privileged and unprivileged workflows
(cherry picked from commit 35ac47e)
1 parent f51cea7 commit 7e8c6a7

File tree

2 files changed

+177
-45
lines changed

2 files changed

+177
-45
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
# Developers can make one-off pushes to `ci-*` branches to manually trigger full CI
1010
# prior to opening a pull request.
1111
- ci-*
12-
pull_request:
13-
types: [opened, synchronize, reopened]
1412

1513
concurrency:
1614
group: ${{ github.workflow }}-${{ github.ref }}
@@ -42,12 +40,7 @@ jobs:
4240
runs-on: ubuntu-latest
4341
steps:
4442
- name: Initialize environment
45-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
46-
- name: Setup ESLint Caching
47-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
48-
with:
49-
path: .eslintcache
50-
key: ${{ runner.os }}-${{ hashFiles('.eslintrc.json') }}
43+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
5144
- name: Install node modules
5245
run: yarn install --frozen-lockfile --ignore-scripts
5346
- name: Run ESLint
@@ -60,47 +53,30 @@ jobs:
6053
run: yarn -s admin validate
6154
- name: Check tooling setup
6255
run: yarn -s check-tooling-setup
63-
- name: Check commit message
64-
# Commit message validation is only done on pull requests as its too late to validate once
65-
# it has been merged.
66-
if: github.event_name == 'pull_request'
67-
run: yarn ng-dev commit-message validate-range ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
68-
- name: Check code format
69-
# Code formatting checks are only done on pull requests as its too late to validate once
70-
# it has been merged.
71-
if: github.event_name == 'pull_request'
72-
run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }}
7356

7457
build:
7558
runs-on: ubuntu-latest
7659
steps:
7760
- name: Initialize environment
78-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
61+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
7962
- name: Setup Bazel
80-
uses: angular/dev-infra/github-actions/bazel/setup@128f3277d17e083606346fcb85f3cd934e5bbe60
63+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
8164
- name: Setup Bazel RBE
82-
uses: angular/dev-infra/github-actions/bazel/configure-remote@128f3277d17e083606346fcb85f3cd934e5bbe60
65+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
8366
- name: Install node modules
8467
run: yarn install --frozen-lockfile
8568
- name: Build release targets
8669
run: yarn ng-dev release build
87-
- name: Store PR release packages
88-
if: github.event_name == 'pull_request'
89-
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
90-
with:
91-
name: packages
92-
path: dist/releases/*.tgz
93-
retention-days: 14
9470

9571
test:
9672
runs-on: ubuntu-latest
9773
steps:
9874
- name: Initialize environment
99-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
75+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
10076
- name: Setup Bazel
101-
uses: angular/dev-infra/github-actions/bazel/setup@128f3277d17e083606346fcb85f3cd934e5bbe60
77+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
10278
- name: Setup Bazel RBE
103-
uses: angular/dev-infra/github-actions/bazel/configure-remote@128f3277d17e083606346fcb85f3cd934e5bbe60
79+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
10480
- name: Install node modules
10581
run: yarn install --frozen-lockfile
10682
- name: Run module tests
@@ -135,19 +111,19 @@ jobs:
135111
runs-on: ${{ matrix.os }}
136112
steps:
137113
- name: Initialize environment
138-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
114+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
139115
- name: Install node modules
140116
run: yarn install --frozen-lockfile
141117
- name: Setup Bazel
142-
uses: angular/dev-infra/github-actions/bazel/setup@128f3277d17e083606346fcb85f3cd934e5bbe60
118+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
143119
- name: Setup Bazel RBE
144-
uses: angular/dev-infra/github-actions/bazel/configure-remote@128f3277d17e083606346fcb85f3cd934e5bbe60
120+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
145121
- name: Run CLI E2E tests
146122
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 }}
147123

148124
e2e-snapshots:
149125
needs: analyze
150-
if: needs.analyze.outputs.snapshots == 'true' || github.event_name == 'push'
126+
if: needs.analyze.outputs.snapshots == 'true'
151127
strategy:
152128
fail-fast: false
153129
matrix:
@@ -158,31 +134,30 @@ jobs:
158134
runs-on: ${{ matrix.os }}
159135
steps:
160136
- name: Initialize environment
161-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
137+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
162138
- name: Install node modules
163139
run: yarn install --frozen-lockfile
164140
- name: Setup Bazel
165-
uses: angular/dev-infra/github-actions/bazel/setup@128f3277d17e083606346fcb85f3cd934e5bbe60
141+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
166142
- name: Setup Bazel RBE
167-
uses: angular/dev-infra/github-actions/bazel/configure-remote@128f3277d17e083606346fcb85f3cd934e5bbe60
143+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
168144
- name: Run CLI E2E tests
169145
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 }}
170146

171147
browsers:
172-
if: github.event_name == 'push'
173148
runs-on: ubuntu-latest
174149
name: Browser Compatibility Tests
175150
env:
176151
SAUCE_TUNNEL_IDENTIFIER: angular-cli-${{ github.workflow }}-${{ github.run_number }}
177152
steps:
178153
- name: Initialize environment
179-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
154+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
180155
- name: Install node modules
181156
run: yarn install --frozen-lockfile
182157
- name: Setup Bazel
183-
uses: angular/dev-infra/github-actions/bazel/setup@128f3277d17e083606346fcb85f3cd934e5bbe60
158+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
184159
- name: Setup Bazel RBE
185-
uses: angular/dev-infra/github-actions/bazel/configure-remote@128f3277d17e083606346fcb85f3cd934e5bbe60
160+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
186161
- name: Run E2E Browser tests
187162
env:
188163
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
@@ -204,17 +179,16 @@ jobs:
204179
path: ${{ env.SAUCE_CONNECT_DIR_IN_HOST }}/sauce-connect.log
205180

206181
publish-snapshots:
207-
if: github.event_name == 'push'
208182
runs-on: ubuntu-latest
209183
env:
210184
CIRCLE_BRANCH: ${{ github.ref_name }}
211185
steps:
212186
- name: Initialize environment
213-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@128f3277d17e083606346fcb85f3cd934e5bbe60
187+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
214188
- name: Install node modules
215189
run: yarn install --frozen-lockfile
216190
- name: Setup Bazel
217-
uses: angular/dev-infra/github-actions/bazel/setup@128f3277d17e083606346fcb85f3cd934e5bbe60
191+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
218192
- run: yarn admin snapshots --verbose
219193
env:
220194
SNAPSHOT_BUILDS_GITHUB_TOKEN: ${{ secrets.SNAPSHOT_BUILDS_GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions: {}
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
17+
jobs:
18+
analyze:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
snapshots: ${{ steps.filter.outputs.snapshots }}
22+
steps:
23+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
24+
with:
25+
persist-credentials: false
26+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
27+
id: filter
28+
with:
29+
filters: |
30+
snapshots:
31+
- 'tests/legacy-cli/e2e/ng-snapshot/package.json'
32+
33+
lint:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Initialize environment
37+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
38+
- name: Setup ESLint Caching
39+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
40+
with:
41+
path: .eslintcache
42+
key: ${{ runner.os }}-${{ hashFiles('.eslintrc.json') }}
43+
- name: Install node modules
44+
run: yarn install --frozen-lockfile --ignore-scripts
45+
- name: Run ESLint
46+
run: yarn lint --cache-strategy content
47+
- name: Validate NgBot Configuration
48+
run: yarn ng-dev ngbot verify
49+
- name: Validate Circular Dependencies
50+
run: yarn ts-circular-deps check
51+
- name: Run Validation
52+
run: yarn -s admin validate
53+
- name: Check tooling setup
54+
run: yarn -s check-tooling-setup
55+
- name: Check commit message
56+
# Commit message validation is only done on pull requests as its too late to validate once
57+
# it has been merged.
58+
run: yarn ng-dev commit-message validate-range ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
59+
- name: Check code format
60+
# Code formatting checks are only done on pull requests as its too late to validate once
61+
# it has been merged.
62+
run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }}
63+
64+
build:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Initialize environment
68+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
69+
- name: Setup Bazel
70+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
71+
- name: Setup Bazel RBE
72+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
73+
- name: Install node modules
74+
run: yarn install --frozen-lockfile
75+
- name: Build release targets
76+
run: yarn ng-dev release build
77+
- name: Store PR release packages
78+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
79+
with:
80+
name: packages
81+
path: dist/releases/*.tgz
82+
retention-days: 14
83+
84+
test:
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Initialize environment
88+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
89+
- name: Setup Bazel
90+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
91+
- name: Setup Bazel RBE
92+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
93+
- name: Install node modules
94+
run: yarn install --frozen-lockfile
95+
- name: Run module tests
96+
run: yarn bazel test //modules/...
97+
- name: Run package tests
98+
run: yarn bazel test //packages/...
99+
100+
e2e:
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
os: [ubuntu-latest, windows-latest]
105+
node: [18, 20, 22]
106+
subset: [npm, yarn, esbuild]
107+
shard: [0, 1, 2, 3, 4, 5]
108+
exclude:
109+
# Exclude Node.js v18 when running on a PR
110+
- node: ${{ github.event_name != 'pull_request' && 'none' || '18' }}
111+
# Exclude Node.js v20 when running on a PR
112+
- node: ${{ github.event_name != 'pull_request' && 'none' || '20' }}
113+
# Exclude Windows when running on a PR
114+
- os: ${{ github.event_name != 'pull_request' && 'none' || 'windows-latest' }}
115+
# Skip yarn subset on Windows
116+
- os: windows-latest
117+
subset: yarn
118+
# Skip Node.js v18 tests on Windows
119+
- os: windows-latest
120+
node: 18
121+
# Skip Node.js v20 tests on Windows
122+
- os: windows-latest
123+
node: 20
124+
runs-on: ${{ matrix.os }}
125+
steps:
126+
- name: Initialize environment
127+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
128+
- name: Install node modules
129+
run: yarn install --frozen-lockfile
130+
- name: Setup Bazel
131+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
132+
- name: Setup Bazel RBE
133+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
134+
- name: Run CLI E2E tests
135+
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 }}
136+
137+
e2e-snapshots:
138+
needs: analyze
139+
if: needs.analyze.outputs.snapshots == 'true'
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
os: [ubuntu-latest]
144+
node: [18]
145+
subset: [npm, yarn, esbuild]
146+
shard: [0, 1, 2, 3, 4, 5]
147+
runs-on: ${{ matrix.os }}
148+
steps:
149+
- name: Initialize environment
150+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
151+
- name: Install node modules
152+
run: yarn install --frozen-lockfile
153+
- name: Setup Bazel
154+
uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
155+
- name: Setup Bazel RBE
156+
uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d
157+
- name: Run CLI E2E tests
158+
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 }}

0 commit comments

Comments
 (0)