15
15
CARGO_NET_RETRY : 10
16
16
CI : 1
17
17
RUST_BACKTRACE : short
18
- RUSTFLAGS : " -D warnings -D elided_lifetimes_in_paths -D explicit_outlives_requirements -D unsafe_op_in_unsafe_fn -D unused_extern_crates -D unused_lifetimes -D unreachable_pub"
19
18
RUSTUP_MAX_RETRIES : 10
20
19
21
20
jobs :
25
24
pull-requests : read
26
25
outputs :
27
26
typescript : ${{ steps.filter.outputs.typescript }}
28
- proc_macros : ${{ steps.filter.outputs.proc_macros }}
29
27
steps :
30
28
- uses : actions/checkout@v4
31
29
- uses : dorny/paths-filter@1441771bbfdd59dcd748680ee64ebd8faab1a242
@@ -34,23 +32,46 @@ jobs:
34
32
filters : |
35
33
typescript:
36
34
- 'editors/code/**'
37
- proc_macros:
38
- - 'crates/proc-macro-api/**'
39
- - 'crates/proc-macro-srv/**'
40
- - 'crates/proc-macro-srv-cli/**'
35
+
36
+ proc-macro-srv :
37
+ if : github.repository == 'rust-lang/rust-analyzer'
38
+ name : proc-macro-srv
39
+ runs-on : ubuntu-latest
40
+ env :
41
+ RUSTFLAGS : " -D warnings"
42
+
43
+ steps :
44
+ - name : Checkout repository
45
+ uses : actions/checkout@v4
46
+ with :
47
+ ref : ${{ github.event.pull_request.head.sha }}
48
+
49
+ - name : Install Rust toolchain
50
+ run : |
51
+ rustup update --no-self-update nightly
52
+ rustup default nightly
53
+ rustup component add --toolchain nightly rust-src rustfmt
54
+ # https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
55
+ - name : Install Rust Problem Matcher
56
+ run : echo "::add-matcher::.github/rust.json"
57
+
58
+ # We don't cache this job, as it will be invalidated every day due to nightly usage
59
+
60
+ - name : Test
61
+ run : cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
62
+
63
+ - name : Check salsa dependency
64
+ run : " ! (cargo tree -p proc-macro-srv-cli | grep -q salsa)"
41
65
42
66
rust :
43
- needs : changes
44
67
if : github.repository == 'rust-lang/rust-analyzer'
45
68
name : Rust
46
69
runs-on : ${{ matrix.os }}
47
70
env :
71
+ RUSTFLAGS : " -Dwarnings"
48
72
CC : deny_c
49
- RUST_CHANNEL : " ${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable' }}"
50
- USE_SYSROOT_ABI : " ${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || '' }}"
51
73
52
74
strategy :
53
- fail-fast : false
54
75
matrix :
55
76
os : [ubuntu-latest, windows-latest, macos-latest]
56
77
@@ -62,77 +83,121 @@ jobs:
62
83
63
84
- name : Install Rust toolchain
64
85
run : |
65
- rustup update --no-self-update ${{ env.RUST_CHANNEL }}
66
- rustup default ${{ env.RUST_CHANNEL }}
67
- rustup component add --toolchain ${{ env.RUST_CHANNEL }} rust-src
86
+ rustup update --no-self-update stable
87
+ rustup default stable
88
+ rustup component add --toolchain stable rust-src clippy
68
89
# We always use a nightly rustfmt, regardless of channel, because we need
69
90
# --file-lines.
70
- rustup toolchain add nightly --profile minimal
71
- rustup component add --toolchain nightly rustfmt
91
+ rustup toolchain install nightly --profile minimal --component rustfmt
72
92
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
73
93
- name : Install Rust Problem Matcher
74
94
if : matrix.os == 'ubuntu-latest'
75
95
run : echo "::add-matcher::.github/rust.json"
76
96
77
- - name : Cache Dependencies
78
- uses : Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
79
- with :
80
- key : ${{ env.RUST_CHANNEL }}
97
+ # - name: Cache Dependencies
98
+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
99
+ # with:
100
+ # workspaces: |
101
+ # . -> target
102
+ # ./crates/proc-macro-srv/proc-macro-test/imp -> target
81
103
82
- - name : Bump opt-level
83
- if : matrix.os == 'ubuntu-latest'
84
- run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
104
+ - uses : taiki-e/install-action@nextest
85
105
86
106
- name : Codegen checks (rust-analyzer)
107
+ if : matrix.os == 'ubuntu-latest'
87
108
run : cargo codegen --check
88
109
89
110
- name : Compile (tests)
90
- run : cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
91
-
92
- # It's faster to `test` before `build` ¯\_(ツ)_/¯
93
- - name : Compile (rust-analyzer)
94
- if : matrix.os == 'ubuntu-latest'
95
- run : cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
111
+ run : cargo test --no-run
96
112
97
113
- name : Test
98
- if : matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
99
- run : cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
114
+ run : cargo nextest run --no-fail-fast --hide-progress-bar --status-level fail
115
+
116
+ - name : clippy
117
+ if : matrix.os == 'macos-latest'
118
+ run : cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
119
+
120
+ analysis-stats :
121
+ if : github.repository == 'rust-lang/rust-analyzer'
122
+ runs-on : ubuntu-latest
123
+ env :
124
+ RUSTC_BOOTSTRAP : 1
100
125
101
- - name : Switch to stable toolchain
126
+ steps :
127
+ - name : Checkout repository
128
+ uses : actions/checkout@v4
129
+
130
+ - name : Install Rust toolchain
102
131
run : |
103
132
rustup update --no-self-update stable
104
- rustup component add --toolchain stable rust-src clippy
105
133
rustup default stable
134
+ rustup component add rustfmt
106
135
107
- - name : Run analysis-stats on rust-analyzer
108
- if : matrix.os == 'ubuntu-latest'
109
- run : target/${{ matrix.target }}/debug/rust-analyzer analysis-stats .
136
+ # - name: Cache Dependencies
137
+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
110
138
111
- - name : Run analysis-stats on the rust standard libraries
112
- if : matrix.os == 'ubuntu-latest'
113
- env :
114
- RUSTC_BOOTSTRAP : 1
115
- run : target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/
139
+ - name : Bump opt-level
140
+ run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
116
141
117
- - name : clippy
118
- if : matrix.os == 'windows-latest'
119
- run : cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
142
+ - run : cargo build -p rust-analyzer
120
143
121
- - name : rustfmt
122
- if : matrix.os == 'ubuntu-latest'
123
- run : cargo fmt -- --check
144
+ - name : ./rust-analyzer
145
+ run : ./target/debug/rust-analyzer analysis-stats . -q
146
+
147
+ - name : sysroot/lib/rustlib/src/rust/library/
148
+ run : ./target/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/ -q
149
+
150
+ rustfmt :
151
+ if : github.repository == 'rust-lang/rust-analyzer'
152
+ runs-on : ubuntu-latest
153
+
154
+ steps :
155
+ - name : Checkout repository
156
+ uses : actions/checkout@v4
157
+
158
+ - name : Install Rust toolchain
159
+ run : |
160
+ rustup update --no-self-update stable
161
+ rustup default stable
162
+ rustup component add rustfmt
163
+
164
+ - run : cargo fmt -- --check
165
+
166
+ miri :
167
+ if : github.repository == 'rust-lang/rust-analyzer'
168
+ runs-on : ubuntu-latest
169
+
170
+ steps :
171
+ - name : Checkout repository
172
+ uses : actions/checkout@v4
173
+
174
+ - name : Install Rust toolchain
175
+ run : |
176
+ rustup update --no-self-update nightly
177
+ rustup default nightly
178
+ rustup component add miri
179
+
180
+ # - name: Cache Dependencies
181
+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
182
+
183
+ - run : cargo miri test -p intern
124
184
125
185
# Weird targets to catch non-portable code
126
186
rust-cross :
127
187
if : github.repository == 'rust-lang/rust-analyzer'
128
188
name : Rust Cross
129
189
runs-on : ubuntu-latest
130
190
191
+ strategy :
192
+ matrix :
193
+ target : [powerpc-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-unknown]
194
+ include :
195
+ # The rust-analyzer binary is not expected to compile on WASM, but the IDE
196
+ # crate should
197
+ - target : wasm32-unknown-unknown
198
+ ide-only : true
131
199
env :
132
- targets : " powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
133
- # The rust-analyzer binary is not expected to compile on WASM, but the IDE
134
- # crate should
135
- targets_ide : " wasm32-unknown-unknown"
200
+ RUSTFLAGS : " -Dwarnings"
136
201
137
202
steps :
138
203
- name : Checkout repository
@@ -141,23 +206,19 @@ jobs:
141
206
- name : Install Rust toolchain
142
207
run : |
143
208
rustup update --no-self-update stable
144
- rustup target add ${{ env.targets }} ${{ env.targets_ide }}
209
+ rustup target add ${{ matrix.target }}
145
210
146
- - name : Cache Dependencies
147
- uses : Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
211
+ # - name: Cache Dependencies
212
+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
148
213
149
- - name : Check
150
- run : |
151
- for target in ${{ env.targets }}; do
152
- cargo check --target=$target --all-targets
153
- done
154
- for target in ${{ env.targets_ide }}; do
155
- cargo check -p ide --target=$target --all-targets
156
- done
214
+ - run : cargo check --target=${{ matrix.target }} --all-targets -p ide
215
+ if : ${{ matrix.ide-only }}
216
+ - run : cargo check --target=${{ matrix.target }} --all-targets
217
+ if : ${{ !matrix.ide-only }}
157
218
158
219
typescript :
159
220
needs : changes
160
- if : github.repository == 'rust-lang/rust-analyzer'
221
+ if : github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
161
222
name : TypeScript
162
223
strategy :
163
224
fail-fast : false
@@ -169,21 +230,18 @@ jobs:
169
230
steps :
170
231
- name : Checkout repository
171
232
uses : actions/checkout@v4
172
- if : needs.changes.outputs.typescript == 'true'
173
233
174
234
- name : Install Nodejs
175
235
uses : actions/setup-node@v4
176
236
with :
177
237
node-version : 22
178
- if : needs.changes.outputs.typescript == 'true'
179
238
180
239
- name : Install xvfb
181
- if : matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
240
+ if : matrix.os == 'ubuntu-latest'
182
241
run : sudo apt-get install -y xvfb
183
242
184
243
- run : npm ci
185
244
working-directory : ./editors/code
186
- if : needs.changes.outputs.typescript == 'true'
187
245
188
246
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
189
247
# if: runner.os == 'Linux'
@@ -192,35 +250,31 @@ jobs:
192
250
# If this steps fails, your code's type integrity might be wrong at some places at TypeScript level.
193
251
- run : npm run typecheck
194
252
working-directory : ./editors/code
195
- if : needs.changes.outputs.typescript == 'true'
196
253
197
254
# You may fix the code automatically by running `npm run lint:fix` if this steps fails.
198
255
- run : npm run lint
199
256
working-directory : ./editors/code
200
- if : needs.changes.outputs.typescript == 'true'
201
257
202
258
# To fix this steps, please run `npm run format`.
203
259
- run : npm run format:check
204
260
working-directory : ./editors/code
205
- if : needs.changes.outputs.typescript == 'true'
206
261
207
262
- name : Run VS Code tests (Linux)
208
- if : matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
263
+ if : matrix.os == 'ubuntu-latest'
209
264
env :
210
265
VSCODE_CLI : 1
211
266
run : xvfb-run npm test
212
267
working-directory : ./editors/code
213
268
214
269
- name : Run VS Code tests (Windows)
215
- if : matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
270
+ if : matrix.os == 'windows-latest'
216
271
env :
217
272
VSCODE_CLI : 1
218
273
run : npm test
219
274
working-directory : ./editors/code
220
275
221
276
- run : npm run package --scripts-prepend-node-path
222
277
working-directory : ./editors/code
223
- if : needs.changes.outputs.typescript == 'true'
224
278
225
279
typo-check :
226
280
name : Typo Check
@@ -242,7 +296,7 @@ jobs:
242
296
run : typos
243
297
244
298
conclusion :
245
- needs : [rust, rust-cross, typescript, typo-check]
299
+ needs : [rust, rust-cross, typescript, typo-check, proc-macro-srv, miri, rustfmt, analysis-stats ]
246
300
# We need to ensure this job does *not* get skipped if its dependencies fail,
247
301
# because a skipped job is considered a success by GitHub. So we have to
248
302
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -257,5 +311,5 @@ jobs:
257
311
run : |
258
312
# Print the dependent jobs to see them in the CI log
259
313
jq -C <<< '${{ toJson(needs) }}'
260
- # Check if all jobs that we depend on (in the needs array) were successful.
261
- jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
314
+ # Check if all jobs that we depend on (in the needs array) were successful (or have been skipped) .
315
+ jq --exit-status 'all(.result == "success" or .result == "skipped" )' <<< '${{ toJson(needs) }}'
0 commit comments