Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 40adedc

Browse files
committed
internal: Only run typescript CI when VSCode files change
1 parent 5351c21 commit 40adedc

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
@@ -102,6 +117,7 @@ jobs:
102117
done
103118
104119
typescript:
120+
needs: changes
105121
if: github.repository == 'rust-lang/rust-analyzer'
106122
name: TypeScript
107123
strategy:
@@ -114,45 +130,51 @@ jobs:
114130
steps:
115131
- name: Checkout repository
116132
uses: actions/checkout@v3
133+
if: needs.changes.outputs.typescript == 'true'
117134

118135
- name: Install Nodejs
119136
uses: actions/setup-node@v3
120137
with:
121138
node-version: 16
139+
if: needs.changes.outputs.typescript == 'true'
122140

123141
- name: Install xvfb
124-
if: matrix.os == 'ubuntu-latest'
142+
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
125143
run: sudo apt-get install -y xvfb
126144

127145
- run: npm ci
128146
working-directory: ./editors/code
147+
if: needs.changes.outputs.typescript == 'true'
129148

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

134153
- run: npm run lint
135154
working-directory: ./editors/code
155+
if: needs.changes.outputs.typescript == 'true'
136156

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

144164
- name: Run VS Code tests (Windows)
145-
if: matrix.os == 'windows-latest'
165+
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
146166
env:
147167
VSCODE_CLI: 1
148168
run: npm test
149169
working-directory: ./editors/code
150170

151171
- run: npm run pretest
152172
working-directory: ./editors/code
173+
if: needs.changes.outputs.typescript == 'true'
153174

154175
- run: npm run package --scripts-prepend-node-path
155176
working-directory: ./editors/code
177+
if: needs.changes.outputs.typescript == 'true'
156178

157179
end-success:
158180
name: bors build finished
@@ -165,7 +187,7 @@ jobs:
165187

166188
end-failure:
167189
name: bors build finished
168-
if: github.event.pusher.name == 'bors' && (failure() || cancelled())
190+
if: github.event.pusher.name == 'bors' && !success()
169191
runs-on: ubuntu-latest
170192
needs: [rust, rust-cross, typescript]
171193
steps:

0 commit comments

Comments
 (0)