@@ -32,16 +32,21 @@ jobs:
3232 filters : |
3333 typescript:
3434 - '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/**'
3540
3641 rust :
42+ needs : changes
3743 if : github.repository == 'rust-lang/rust-analyzer'
3844 name : Rust
3945 runs-on : ${{ matrix.os }}
4046 env :
4147 CC : deny_c
42- # we want to build r-a on stable to check that it keeps building on stable,
43- # but we also want to test our proc-macro-srv which depends on nightly features
44- RUSTC_BOOTSTRAP : 1
48+ RUST_CHANNEL : " ${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable'}}"
49+ USE_SYSROOT_ABI : " ${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || ''}}"
4550
4651 strategy :
4752 fail-fast : false
@@ -57,26 +62,28 @@ jobs:
5762
5863 - name : Install Rust toolchain
5964 run : |
60- rustup update --no-self-update stable
65+ rustup update --no-self-update ${{ env.RUST_CHANNEL }}
6166 rustup component add rustfmt rust-src
6267
6368 - name : Cache Dependencies
64- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
69+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
70+ with :
71+ key : ${{ env.RUST_CHANNEL }}
6572
6673 - name : Bump opt-level
6774 if : matrix.os == 'ubuntu-latest'
6875 run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
6976
7077 - name : Compile (tests)
71- run : cargo test --no-run --locked --features sysroot-abi
78+ run : cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
7279
7380 # It's faster to `test` before `build` ¯\_(ツ)_/¯
7481 - name : Compile (rust-analyzer)
7582 if : matrix.os == 'ubuntu-latest'
76- run : cargo build --quiet --features sysroot-abi
83+ run : cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
7784
7885 - name : Test
79- run : cargo test --features sysroot-abi -- --nocapture --quiet
86+ run : cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
8087
8188 - name : Run analysis-stats on rust-analyzer
8289 if : matrix.os == 'ubuntu-latest'
@@ -108,7 +115,7 @@ jobs:
108115 rustup target add ${{ env.targets }} ${{ env.targets_ide }}
109116
110117 - name : Cache Dependencies
111- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
118+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
112119
113120 - name : Check
114121 run : |
0 commit comments