1818 RUSTUP_MAX_RETRIES : 10
1919
2020jobs :
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+
2141 rust :
42+ needs : changes
2243 if : github.repository == 'rust-lang/rust-analyzer'
2344 name : Rust
2445 runs-on : ${{ matrix.os }}
2546 env :
2647 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' || ''}}"
2750
2851 strategy :
2952 fail-fast : false
@@ -35,30 +58,31 @@ jobs:
3558 uses : actions/checkout@v3
3659 with :
3760 ref : ${{ github.event.pull_request.head.sha }}
38- fetch-depth : 20
3961
4062 - name : Install Rust toolchain
4163 run : |
42- rustup update --no-self-update stable
64+ rustup update --no-self-update ${{ env.RUST_CHANNEL }}
4365 rustup component add rustfmt rust-src
4466
4567 - name : Cache Dependencies
46- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
68+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
69+ with :
70+ key : ${{ env.RUST_CHANNEL }}
4771
4872 - name : Bump opt-level
4973 if : matrix.os == 'ubuntu-latest'
5074 run : sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
5175
5276 - name : Compile (tests)
53- run : cargo test --no-run --locked
77+ run : cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
5478
5579 # It's faster to `test` before `build` ¯\_(ツ)_/¯
5680 - name : Compile (rust-analyzer)
5781 if : matrix.os == 'ubuntu-latest'
58- run : cargo build --quiet
82+ run : cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
5983
6084 - name : Test
61- run : cargo test -- --nocapture --quiet
85+ run : cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
6286
6387 - name : Run analysis-stats on rust-analyzer
6488 if : matrix.os == 'ubuntu-latest'
90114 rustup target add ${{ env.targets }} ${{ env.targets_ide }}
91115
92116 - name : Cache Dependencies
93- uses : Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
117+ uses : Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
94118
95119 - name : Check
96120 run : |
@@ -102,6 +126,7 @@ jobs:
102126 done
103127
104128 typescript :
129+ needs : changes
105130 if : github.repository == 'rust-lang/rust-analyzer'
106131 name : TypeScript
107132 strategy :
@@ -114,45 +139,51 @@ jobs:
114139 steps :
115140 - name : Checkout repository
116141 uses : actions/checkout@v3
142+ if : needs.changes.outputs.typescript == 'true'
117143
118144 - name : Install Nodejs
119145 uses : actions/setup-node@v3
120146 with :
121147 node-version : 16
148+ if : needs.changes.outputs.typescript == 'true'
122149
123150 - name : Install xvfb
124- if : matrix.os == 'ubuntu-latest'
151+ if : matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
125152 run : sudo apt-get install -y xvfb
126153
127154 - run : npm ci
128155 working-directory : ./editors/code
156+ if : needs.changes.outputs.typescript == 'true'
129157
130158 # - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
131159 # if: runner.os == 'Linux'
132160 # working-directory: ./editors/code
133161
134162 - run : npm run lint
135163 working-directory : ./editors/code
164+ if : needs.changes.outputs.typescript == 'true'
136165
137166 - name : Run VS Code tests (Linux)
138- if : matrix.os == 'ubuntu-latest'
167+ if : matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
139168 env :
140169 VSCODE_CLI : 1
141170 run : xvfb-run npm test
142171 working-directory : ./editors/code
143172
144173 - name : Run VS Code tests (Windows)
145- if : matrix.os == 'windows-latest'
174+ if : matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
146175 env :
147176 VSCODE_CLI : 1
148177 run : npm test
149178 working-directory : ./editors/code
150179
151180 - run : npm run pretest
152181 working-directory : ./editors/code
182+ if : needs.changes.outputs.typescript == 'true'
153183
154184 - run : npm run package --scripts-prepend-node-path
155185 working-directory : ./editors/code
186+ if : needs.changes.outputs.typescript == 'true'
156187
157188 end-success :
158189 name : bors build finished
@@ -165,7 +196,7 @@ jobs:
165196
166197 end-failure :
167198 name : bors build finished
168- if : github.event.pusher.name == 'bors' && (failure() || cancelled() )
199+ if : github.event.pusher.name == 'bors' && !success( )
169200 runs-on : ubuntu-latest
170201 needs : [rust, rust-cross, typescript]
171202 steps :
0 commit comments