1515 CARGO_NET_RETRY : 10
1616 CI : 1
1717 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"
1918 RUSTUP_MAX_RETRIES : 10
2019
2120jobs :
2524 pull-requests : read
2625 outputs :
2726 typescript : ${{ steps.filter.outputs.typescript }}
28- proc_macros : ${{ steps.filter.outputs.proc_macros }}
2927 steps :
3028 - uses : actions/checkout@v4
3129 - uses : dorny/paths-filter@1441771bbfdd59dcd748680ee64ebd8faab1a242
@@ -34,52 +32,54 @@ jobs:
3432 filters : |
3533 typescript:
3634 - 'editors/code/**'
37- proc_macros:
38- - 'crates/tt/**'
39- - 'crates/proc-macro-api/**'
40- - 'crates/proc-macro-srv/**'
41- - 'crates/proc-macro-srv-cli/**'
4235
4336 proc-macro-srv :
44- needs : changes
45- if : github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.proc_macros == 'true'
37+ if : github.repository == 'rust-lang/rust-analyzer'
4638 name : proc-macro-srv
4739 runs-on : ubuntu-latest
40+ env :
41+ RUSTFLAGS : " -D warnings"
42+
4843 steps :
4944 - name : Checkout repository
5045 uses : actions/checkout@v4
5146 with :
5247 ref : ${{ github.event.pull_request.head.sha }}
5348
49+ - name : Install rustup-toolchain-install-master
50+ run :
cargo install [email protected] 51+
52+ # Install a pinned rustc commit to avoid surprises
5453 - name : Install Rust toolchain
5554 run : |
56- rustup update --no-self-update nightly
57- rustup default nightly
58- rustup component add --toolchain nightly rust-src rustfmt
55+ RUSTC_VERSION=`cat rust-version`
56+ rustup-toolchain-install-master ${RUSTC_VERSION} -c rust-src -c rustfmt
57+ rustup default ${RUSTC_VERSION}
58+
59+ # Emulate a nightly toolchain, because the toolchain installed above does not have "nightly"
60+ # in its version string.
61+ - name : Emulate a nightly toolchain
62+ run : echo "RUSTC_BOOTSTRAP=1" >> $GITHUB_ENV
63+
5964 # https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
6065 - name : Install Rust Problem Matcher
61- if : matrix.os == 'ubuntu-latest'
6266 run : echo "::add-matcher::.github/rust.json"
6367
64- - name : Cache Dependencies
65- uses : Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
66-
67- - name : Bump opt-level
68- if : matrix.os == 'ubuntu-latest'
69- run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
70-
7168 - name : Test
72- run : cargo test --features sysroot-abi -p rust-analyzer -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
69+ run : cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
70+
71+ - name : Check salsa dependency
72+ run : " ! (cargo tree -p proc-macro-srv-cli | grep -q salsa)"
7373
7474 rust :
7575 if : github.repository == 'rust-lang/rust-analyzer'
7676 name : Rust
7777 runs-on : ${{ matrix.os }}
7878 env :
79+ RUSTFLAGS : " -Dwarnings"
7980 CC : deny_c
8081
8182 strategy :
82- fail-fast : false
8383 matrix :
8484 os : [ubuntu-latest, windows-latest, macos-latest]
8585
9393 run : |
9494 rustup update --no-self-update stable
9595 rustup default stable
96- rustup component add --toolchain stable rust-src
96+ rustup component add --toolchain stable rust-src clippy
9797 # We always use a nightly rustfmt, regardless of channel, because we need
9898 # --file-lines.
9999 rustup toolchain install nightly --profile minimal --component rustfmt
@@ -102,63 +102,122 @@ jobs:
102102 if : matrix.os == 'ubuntu-latest'
103103 run : echo "::add-matcher::.github/rust.json"
104104
105- - name : Cache Dependencies
106- uses : Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
105+ # - name: Cache Dependencies
106+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
107+ # with:
108+ # workspaces: |
109+ # . -> target
110+ # ./crates/proc-macro-srv/proc-macro-test/imp -> target
107111
108- - name : Bump opt-level
109- if : matrix.os == 'ubuntu-latest'
110- run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
112+ - name : Install nextest
113+ uses : taiki-e/install-action@nextest
111114
112115 - name : Codegen checks (rust-analyzer)
116+ if : matrix.os == 'ubuntu-latest'
113117 run : cargo codegen --check
114118
115- - name : Compile ( tests)
116- run : cargo test --no-run --locked
119+ - name : Compile tests
120+ run : cargo test --no-run
117121
118- # It's faster to `test` before `build` ¯\_(ツ)_/¯
119- - name : Compile (rust-analyzer)
120- if : matrix.os == 'ubuntu-latest'
121- run : cargo build --quiet
122+ - name : Run tests
123+ run : cargo nextest run --no-fail-fast --hide-progress-bar --status-level fail
122124
123- - name : Test
124- if : matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
125- run : cargo test -- --quiet
125+ - name : Cancel parallel jobs
126+ if : failure()
127+ run : |
128+ # https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#cancel-a-workflow-run
129+ curl -L \
130+ -X POST \
131+ -H "Accept: application/vnd.github.v3+json" \
132+ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
133+ -H "X-GitHub-Api-Version: 2022-11-28" \
134+ https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
135+
136+ - name : Run Clippy
137+ if : matrix.os == 'macos-latest'
138+ run : cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
126139
127- - name : Switch to stable toolchain
140+ analysis-stats :
141+ if : github.repository == 'rust-lang/rust-analyzer'
142+ runs-on : ubuntu-latest
143+ env :
144+ RUSTC_BOOTSTRAP : 1
145+
146+ steps :
147+ - name : Checkout repository
148+ uses : actions/checkout@v4
149+
150+ - name : Install Rust toolchain
128151 run : |
129152 rustup update --no-self-update stable
130- rustup component add --toolchain stable rust-src clippy
131153 rustup default stable
154+ rustup component add rustfmt
132155
133- - name : Run analysis-stats on rust-analyzer
134- if : matrix.os == 'ubuntu-latest'
135- run : target/${{ matrix.target }}/debug/rust-analyzer analysis-stats .
156+ # - name: Cache Dependencies
157+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
136158
137- - name : Run analysis-stats on the rust standard libraries
138- if : matrix.os == 'ubuntu-latest'
139- env :
140- RUSTC_BOOTSTRAP : 1
141- run : target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/
159+ - name : Bump opt-level
160+ run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
142161
143- - name : clippy
144- if : matrix.os == 'windows-latest'
145- run : cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
162+ - run : cargo build -p rust-analyzer
146163
147- - name : rustfmt
148- if : matrix.os == 'ubuntu-latest'
149- run : cargo fmt -- --check
164+ - name : ./rust-analyzer
165+ run : ./target/debug/rust-analyzer analysis-stats . -q
166+
167+ - name : sysroot/lib/rustlib/src/rust/library/
168+ run : ./target/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/ -q
169+
170+ rustfmt :
171+ if : github.repository == 'rust-lang/rust-analyzer'
172+ runs-on : ubuntu-latest
173+
174+ steps :
175+ - name : Checkout repository
176+ uses : actions/checkout@v4
177+
178+ - name : Install Rust toolchain
179+ run : |
180+ rustup update --no-self-update stable
181+ rustup default stable
182+ rustup component add rustfmt
183+
184+ - run : cargo fmt -- --check
185+
186+ miri :
187+ if : github.repository == 'rust-lang/rust-analyzer'
188+ runs-on : ubuntu-latest
189+
190+ steps :
191+ - name : Checkout repository
192+ uses : actions/checkout@v4
193+
194+ - name : Install Rust toolchain
195+ run : |
196+ rustup update --no-self-update nightly
197+ rustup default nightly
198+ rustup component add miri
199+
200+ # - name: Cache Dependencies
201+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
202+
203+ - run : cargo miri test -p intern
150204
151205 # Weird targets to catch non-portable code
152206 rust-cross :
153207 if : github.repository == 'rust-lang/rust-analyzer'
154208 name : Rust Cross
155209 runs-on : ubuntu-latest
156210
211+ strategy :
212+ matrix :
213+ target : [powerpc-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-unknown]
214+ include :
215+ # The rust-analyzer binary is not expected to compile on WASM, but the IDE
216+ # crate should
217+ - target : wasm32-unknown-unknown
218+ ide-only : true
157219 env :
158- targets : " powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
159- # The rust-analyzer binary is not expected to compile on WASM, but the IDE
160- # crate should
161- targets_ide : " wasm32-unknown-unknown"
220+ RUSTFLAGS : " -Dwarnings"
162221
163222 steps :
164223 - name : Checkout repository
@@ -167,19 +226,15 @@ jobs:
167226 - name : Install Rust toolchain
168227 run : |
169228 rustup update --no-self-update stable
170- rustup target add ${{ env.targets }} ${{ env.targets_ide }}
229+ rustup target add ${{ matrix.target }}
171230
172- - name : Cache Dependencies
173- uses : Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
231+ # - name: Cache Dependencies
232+ # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
174233
175- - name : Check
176- run : |
177- for target in ${{ env.targets }}; do
178- cargo check --target=$target --all-targets
179- done
180- for target in ${{ env.targets_ide }}; do
181- cargo check -p ide --target=$target --all-targets
182- done
234+ - run : cargo check --target=${{ matrix.target }} --all-targets -p ide
235+ if : ${{ matrix.ide-only }}
236+ - run : cargo check --target=${{ matrix.target }} --all-targets
237+ if : ${{ !matrix.ide-only }}
183238
184239 typescript :
185240 needs : changes
@@ -261,7 +316,7 @@ jobs:
261316 run : typos
262317
263318 conclusion :
264- needs : [rust, rust-cross, typescript, typo-check, proc-macro-srv]
319+ needs : [rust, rust-cross, typescript, typo-check, proc-macro-srv, miri, rustfmt, analysis-stats ]
265320 # We need to ensure this job does *not* get skipped if its dependencies fail,
266321 # because a skipped job is considered a success by GitHub. So we have to
267322 # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
0 commit comments