@@ -32,16 +32,21 @@ jobs:
32
32
filters : |
33
33
typescript:
34
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/**'
35
40
36
41
rust :
42
+ needs : changes
37
43
if : github.repository == 'rust-lang/rust-analyzer'
38
44
name : Rust
39
45
runs-on : ${{ matrix.os }}
40
46
env :
41
47
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' || ''}}"
45
50
46
51
strategy :
47
52
fail-fast : false
@@ -57,26 +62,28 @@ jobs:
57
62
58
63
- name : Install Rust toolchain
59
64
run : |
60
- rustup update --no-self-update stable
65
+ rustup update --no-self-update ${{ env.RUST_CHANNEL }}
61
66
rustup component add rustfmt rust-src
62
67
63
68
- name : Cache Dependencies
64
- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
69
+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
70
+ with :
71
+ key : ${{ env.RUST_CHANNEL }}
65
72
66
73
- name : Bump opt-level
67
74
if : matrix.os == 'ubuntu-latest'
68
75
run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
69
76
70
77
- name : Compile (tests)
71
- run : cargo test --no-run --locked --features sysroot-abi
78
+ run : cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
72
79
73
80
# It's faster to `test` before `build` ¯\_(ツ)_/¯
74
81
- name : Compile (rust-analyzer)
75
82
if : matrix.os == 'ubuntu-latest'
76
- run : cargo build --quiet --features sysroot-abi
83
+ run : cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
77
84
78
85
- name : Test
79
- run : cargo test --features sysroot-abi -- --nocapture --quiet
86
+ run : cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
80
87
81
88
- name : Run analysis-stats on rust-analyzer
82
89
if : matrix.os == 'ubuntu-latest'
@@ -108,7 +115,7 @@ jobs:
108
115
rustup target add ${{ env.targets }} ${{ env.targets_ide }}
109
116
110
117
- name : Cache Dependencies
111
- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
118
+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
112
119
113
120
- name : Check
114
121
run : |
0 commit comments