18
18
RUSTUP_MAX_RETRIES : 10
19
19
20
20
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@4067d885736b84de7c414f582ac45897079b0a78
30
+ id : filter
31
+ with :
32
+ filters : |
33
+ typescript:
34
+ - 'editors/code/**'
35
+ proc_macros:
36
+ - 'crates/proc-macro-api/**'
37
+ - 'crates/proc-macro-srv/**'
38
+ - 'crates/proc-macro-srv-cli/**'
39
+ - 'crates/proc-macro-test/**'
40
+
21
41
rust :
42
+ needs : changes
22
43
if : github.repository == 'rust-lang/rust-analyzer'
23
44
name : Rust
24
45
runs-on : ${{ matrix.os }}
25
46
env :
26
47
CC : deny_c
48
+ RUST_CHANNEL : " ${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable'}}"
49
+ USE_SYSROOT_ABI : " ${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || ''}}"
27
50
28
51
strategy :
29
52
fail-fast : false
@@ -35,30 +58,31 @@ jobs:
35
58
uses : actions/checkout@v3
36
59
with :
37
60
ref : ${{ github.event.pull_request.head.sha }}
38
- fetch-depth : 20
39
61
40
62
- name : Install Rust toolchain
41
63
run : |
42
- rustup update --no-self-update stable
64
+ rustup update --no-self-update ${{ env.RUST_CHANNEL }}
43
65
rustup component add rustfmt rust-src
44
66
45
67
- name : Cache Dependencies
46
- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
68
+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
69
+ with :
70
+ key : ${{ env.RUST_CHANNEL }}
47
71
48
72
- name : Bump opt-level
49
73
if : matrix.os == 'ubuntu-latest'
50
74
run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
51
75
52
76
- name : Compile (tests)
53
- run : cargo test --no-run --locked
77
+ run : cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
54
78
55
79
# It's faster to `test` before `build` ¯\_(ツ)_/¯
56
80
- name : Compile (rust-analyzer)
57
81
if : matrix.os == 'ubuntu-latest'
58
- run : cargo build --quiet
82
+ run : cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
59
83
60
84
- name : Test
61
- run : cargo test -- --nocapture --quiet
85
+ run : cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
62
86
63
87
- name : Run analysis-stats on rust-analyzer
64
88
if : matrix.os == 'ubuntu-latest'
90
114
rustup target add ${{ env.targets }} ${{ env.targets_ide }}
91
115
92
116
- name : Cache Dependencies
93
- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
117
+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
94
118
95
119
- name : Check
96
120
run : |
@@ -102,6 +126,7 @@ jobs:
102
126
done
103
127
104
128
typescript :
129
+ needs : changes
105
130
if : github.repository == 'rust-lang/rust-analyzer'
106
131
name : TypeScript
107
132
strategy :
@@ -114,45 +139,51 @@ jobs:
114
139
steps :
115
140
- name : Checkout repository
116
141
uses : actions/checkout@v3
142
+ if : needs.changes.outputs.typescript == 'true'
117
143
118
144
- name : Install Nodejs
119
145
uses : actions/setup-node@v3
120
146
with :
121
147
node-version : 16
148
+ if : needs.changes.outputs.typescript == 'true'
122
149
123
150
- name : Install xvfb
124
- if : matrix.os == 'ubuntu-latest'
151
+ if : matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
125
152
run : sudo apt-get install -y xvfb
126
153
127
154
- run : npm ci
128
155
working-directory : ./editors/code
156
+ if : needs.changes.outputs.typescript == 'true'
129
157
130
158
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
131
159
# if: runner.os == 'Linux'
132
160
# working-directory: ./editors/code
133
161
134
162
- run : npm run lint
135
163
working-directory : ./editors/code
164
+ if : needs.changes.outputs.typescript == 'true'
136
165
137
166
- name : Run VS Code tests (Linux)
138
- if : matrix.os == 'ubuntu-latest'
167
+ if : matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
139
168
env :
140
169
VSCODE_CLI : 1
141
170
run : xvfb-run npm test
142
171
working-directory : ./editors/code
143
172
144
173
- name : Run VS Code tests (Windows)
145
- if : matrix.os == 'windows-latest'
174
+ if : matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
146
175
env :
147
176
VSCODE_CLI : 1
148
177
run : npm test
149
178
working-directory : ./editors/code
150
179
151
180
- run : npm run pretest
152
181
working-directory : ./editors/code
182
+ if : needs.changes.outputs.typescript == 'true'
153
183
154
184
- run : npm run package --scripts-prepend-node-path
155
185
working-directory : ./editors/code
186
+ if : needs.changes.outputs.typescript == 'true'
156
187
157
188
end-success :
158
189
name : bors build finished
@@ -165,7 +196,7 @@ jobs:
165
196
166
197
end-failure :
167
198
name : bors build finished
168
- if : github.event.pusher.name == 'bors' && (failure() || cancelled() )
199
+ if : github.event.pusher.name == 'bors' && !success( )
169
200
runs-on : ubuntu-latest
170
201
needs : [rust, rust-cross, typescript]
171
202
steps :
0 commit comments