Skip to content

Commit 05a6286

Browse files
committed
Auto merge of rust-lang#14446 - Veykril:ci, r=Veykril
internal: Only run typescript CI when VSCode files change
2 parents 41ee5ca + 40adedc commit 05a6286

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ env:
1818
RUSTUP_MAX_RETRIES: 10
1919

2020
jobs:
21+
changes:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
pull-requests: read
25+
outputs:
26+
typescript: ${{ steps.filter.outputs.typescript }}
27+
steps:
28+
- uses: actions/checkout@v3
29+
- uses: dorny/paths-filter@v2
30+
id: filter
31+
with:
32+
filters: |
33+
typescript:
34+
- 'editors/code/**'
35+
2136
rust:
2237
if: github.repository == 'rust-lang/rust-analyzer'
2338
name: Rust
@@ -105,6 +120,7 @@ jobs:
105120
done
106121
107122
typescript:
123+
needs: changes
108124
if: github.repository == 'rust-lang/rust-analyzer'
109125
name: TypeScript
110126
strategy:
@@ -117,45 +133,51 @@ jobs:
117133
steps:
118134
- name: Checkout repository
119135
uses: actions/checkout@v3
136+
if: needs.changes.outputs.typescript == 'true'
120137

121138
- name: Install Nodejs
122139
uses: actions/setup-node@v3
123140
with:
124141
node-version: 16
142+
if: needs.changes.outputs.typescript == 'true'
125143

126144
- name: Install xvfb
127-
if: matrix.os == 'ubuntu-latest'
145+
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
128146
run: sudo apt-get install -y xvfb
129147

130148
- run: npm ci
131149
working-directory: ./editors/code
150+
if: needs.changes.outputs.typescript == 'true'
132151

133152
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
134153
# if: runner.os == 'Linux'
135154
# working-directory: ./editors/code
136155

137156
- run: npm run lint
138157
working-directory: ./editors/code
158+
if: needs.changes.outputs.typescript == 'true'
139159

140160
- name: Run VS Code tests (Linux)
141-
if: matrix.os == 'ubuntu-latest'
161+
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
142162
env:
143163
VSCODE_CLI: 1
144164
run: xvfb-run npm test
145165
working-directory: ./editors/code
146166

147167
- name: Run VS Code tests (Windows)
148-
if: matrix.os == 'windows-latest'
168+
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
149169
env:
150170
VSCODE_CLI: 1
151171
run: npm test
152172
working-directory: ./editors/code
153173

154174
- run: npm run pretest
155175
working-directory: ./editors/code
176+
if: needs.changes.outputs.typescript == 'true'
156177

157178
- run: npm run package --scripts-prepend-node-path
158179
working-directory: ./editors/code
180+
if: needs.changes.outputs.typescript == 'true'
159181

160182
end-success:
161183
name: bors build finished
@@ -168,7 +190,7 @@ jobs:
168190

169191
end-failure:
170192
name: bors build finished
171-
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
193+
if: github.event.pusher.name == 'bors' && !success()
172194
runs-on: ubuntu-latest
173195
needs: [rust, rust-cross, typescript]
174196
steps:

0 commit comments

Comments
 (0)