Skip to content

Commit f6b359b

Browse files
Split CI jobs related to vscode extension to know what job is failed
This aims to improve CI status check more readable. This patch was tried to use `jobs.<job_id>.if` to make the configuration more shortly. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif but it could not fire the `end-success` or `end-failure` if some jobs in the workflow were skipped. This causes an integration problem with bors. By their reasons, this patch uses `jobs.<job_id>.steps[*].if`.
1 parent 19f6f50 commit f6b359b

File tree

2 files changed

+111
-33
lines changed

2 files changed

+111
-33
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Prepare TypeScript CI job
2+
description: This action prepare CI job for TypeScript
3+
4+
inputs:
5+
working-directory:
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Install Nodejs
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: 16
15+
- name: Install dependencies
16+
shell: bash
17+
run: npm ci
18+
working-directory: ${{ inputs.working-directory }}

.github/workflows/ci.yaml

Lines changed: 93 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -127,48 +127,68 @@ jobs:
127127
cargo check -p ide --target=$target --all-targets
128128
done
129129
130-
typescript:
130+
typescript-format:
131131
needs: changes
132132
if: github.repository == 'rust-lang/rust-analyzer'
133-
name: TypeScript
134-
strategy:
135-
fail-fast: false
136-
matrix:
137-
os: [ubuntu-latest, windows-latest]
138-
139-
runs-on: ${{ matrix.os }}
140-
133+
runs-on: ubuntu-latest
141134
steps:
142135
- name: Checkout repository
143136
uses: actions/checkout@v3
144137
if: needs.changes.outputs.typescript == 'true'
145138

146-
- name: Install Nodejs
147-
uses: actions/setup-node@v3
139+
- name: Setup Node.js
140+
uses: ./.github/actions/prepare-typescript
148141
with:
149-
node-version: 16
142+
working-directory: ./editors/code
150143
if: needs.changes.outputs.typescript == 'true'
151144

152-
- name: Install xvfb
153-
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
154-
run: sudo apt-get install -y xvfb
155-
156-
- run: npm ci
145+
# To fix this steps, please run `npm run format`.
146+
- run: npm run format:check
157147
working-directory: ./editors/code
158148
if: needs.changes.outputs.typescript == 'true'
159149

160-
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
161-
# if: runner.os == 'Linux'
162-
# working-directory: ./editors/code
150+
typescript-lint:
151+
needs: changes
152+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
153+
runs-on: ubuntu-latest
154+
steps:
155+
- name: Checkout repository
156+
uses: actions/checkout@v3
157+
if: needs.changes.outputs.typescript == 'true'
158+
159+
- name: Setup Node.js
160+
uses: ./.github/actions/prepare-typescript
161+
with:
162+
working-directory: ./editors/code
163+
if: needs.changes.outputs.typescript == 'true'
163164

164165
# You may fix the code automatically by running `npm run lint:fix` if this steps fails.
165166
- run: npm run lint
166167
working-directory: ./editors/code
167168
if: needs.changes.outputs.typescript == 'true'
168169

169-
# To fix this steps, please run `npm run format`.
170-
- run: npm run format:check
171-
working-directory: ./editors/code
170+
typescript-test:
171+
needs: changes
172+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
173+
strategy:
174+
fail-fast: false
175+
matrix:
176+
os: [ubuntu-latest, windows-latest]
177+
178+
runs-on: ${{ matrix.os }}
179+
steps:
180+
- name: Checkout repository
181+
uses: actions/checkout@v3
182+
if: needs.changes.outputs.typescript == 'true'
183+
184+
- name: Install xvfb
185+
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
186+
run: sudo apt-get install -y xvfb
187+
188+
- name: Setup Node.js
189+
uses: ./.github/actions/prepare-typescript
190+
with:
191+
working-directory: ./editors/code
172192
if: needs.changes.outputs.typescript == 'true'
173193

174194
- name: Run VS Code tests (Linux)
@@ -178,9 +198,26 @@ jobs:
178198
run: xvfb-run npm test
179199
working-directory: ./editors/code
180200

181-
# To fix this steps, please run `npm run format`.
182-
- run: npm run format:check
201+
- name: Run VS Code tests (Windows)
202+
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
203+
env:
204+
VSCODE_CLI: 1
205+
run: npm test
183206
working-directory: ./editors/code
207+
208+
typescript-build:
209+
needs: changes
210+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
211+
runs-on: ubuntu-latest
212+
steps:
213+
- name: Checkout repository
214+
uses: actions/checkout@v3
215+
if: needs.changes.outputs.typescript == 'true'
216+
217+
- name: Setup Node.js
218+
uses: ./.github/actions/prepare-typescript
219+
with:
220+
working-directory: ./editors/code
184221
if: needs.changes.outputs.typescript == 'true'
185222

186223
# If this steps fails, your code's type integrity might be wrong at some places.
@@ -191,12 +228,20 @@ jobs:
191228
working-directory: ./editors/code
192229
if: needs.changes.outputs.typescript == 'true'
193230

194-
- name: Run VS Code tests (Windows)
195-
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
196-
env:
197-
VSCODE_CLI: 1
198-
run: npm test
199-
working-directory: ./editors/code
231+
typescript-package:
232+
needs: changes
233+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
234+
runs-on: ubuntu-latest
235+
steps:
236+
- name: Checkout repository
237+
uses: actions/checkout@v3
238+
if: needs.changes.outputs.typescript == 'true'
239+
240+
- name: Setup Node.js
241+
uses: ./.github/actions/prepare-typescript
242+
with:
243+
working-directory: ./editors/code
244+
if: needs.changes.outputs.typescript == 'true'
200245

201246
- run: npm run package --scripts-prepend-node-path
202247
working-directory: ./editors/code
@@ -206,7 +251,15 @@ jobs:
206251
name: bors build finished
207252
if: github.event.pusher.name == 'bors' && success()
208253
runs-on: ubuntu-latest
209-
needs: [rust, rust-cross, typescript]
254+
needs:
255+
- rust
256+
- rust-cross
257+
- typescript-format
258+
- typescript-lint
259+
- typescript-build
260+
- typescript-test
261+
- typescript-package
262+
210263
steps:
211264
- name: Mark the job as successful
212265
run: exit 0
@@ -215,7 +268,14 @@ jobs:
215268
name: bors build finished
216269
if: github.event.pusher.name == 'bors' && !success()
217270
runs-on: ubuntu-latest
218-
needs: [rust, rust-cross, typescript]
271+
needs:
272+
- rust
273+
- rust-cross
274+
- typescript-format
275+
- typescript-lint
276+
- typescript-build
277+
- typescript-test
278+
- typescript-package
219279
steps:
220280
- name: Mark the job as a failure
221281
run: exit 1

0 commit comments

Comments
 (0)