Skip to content

Commit ee79f3e

Browse files
committed
Run proc-macro server tests are separate CI job
Touch tt
1 parent 60da021 commit ee79f3e

File tree

1 file changed

+45
-25
lines changed
  • src/tools/rust-analyzer/.github/workflows

1 file changed

+45
-25
lines changed

Diff for: src/tools/rust-analyzer/.github/workflows/ci.yaml

+45-25
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,48 @@ jobs:
3535
typescript:
3636
- 'editors/code/**'
3737
proc_macros:
38+
- 'crates/tt/**'
3839
- 'crates/proc-macro-api/**'
3940
- 'crates/proc-macro-srv/**'
4041
- 'crates/proc-macro-srv-cli/**'
4142
42-
rust:
43+
proc-macro-srv:
4344
needs: changes
45+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.proc_macros == 'true'
46+
name: proc-macro-srv
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
with:
52+
ref: ${{ github.event.pull_request.head.sha }}
53+
54+
- name: Install Rust toolchain
55+
run: |
56+
rustup update --no-self-update nightly
57+
rustup default nightly
58+
rustup component add --toolchain nightly rust-src rustfmt
59+
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
60+
- name: Install Rust Problem Matcher
61+
if: matrix.os == 'ubuntu-latest'
62+
run: echo "::add-matcher::.github/rust.json"
63+
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+
71+
- 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
73+
74+
rust:
4475
if: github.repository == 'rust-lang/rust-analyzer'
4576
name: Rust
4677
runs-on: ${{ matrix.os }}
4778
env:
4879
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' || '' }}"
5180

5281
strategy:
5382
fail-fast: false
@@ -62,9 +91,9 @@ jobs:
6291

6392
- name: Install Rust toolchain
6493
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
94+
rustup update --no-self-update stable
95+
rustup default stable
96+
rustup component add --toolchain stable rust-src
6897
# We always use a nightly rustfmt, regardless of channel, because we need
6998
# --file-lines.
7099
rustup toolchain install nightly --profile minimal --component rustfmt
@@ -75,8 +104,6 @@ jobs:
75104

76105
- name: Cache Dependencies
77106
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
78-
with:
79-
key: ${{ env.RUST_CHANNEL }}
80107

81108
- name: Bump opt-level
82109
if: matrix.os == 'ubuntu-latest'
@@ -86,16 +113,16 @@ jobs:
86113
run: cargo codegen --check
87114

88115
- name: Compile (tests)
89-
run: cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
116+
run: cargo test --no-run --locked
90117

91118
# It's faster to `test` before `build` ¯\_(ツ)_/¯
92119
- name: Compile (rust-analyzer)
93120
if: matrix.os == 'ubuntu-latest'
94-
run: cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
121+
run: cargo build --quiet
95122

96123
- name: Test
97124
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
98-
run: cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
125+
run: cargo test -- --quiet
99126

100127
- name: Switch to stable toolchain
101128
run: |
@@ -156,7 +183,7 @@ jobs:
156183
157184
typescript:
158185
needs: changes
159-
if: github.repository == 'rust-lang/rust-analyzer'
186+
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
160187
name: TypeScript
161188
strategy:
162189
fail-fast: false
@@ -168,21 +195,18 @@ jobs:
168195
steps:
169196
- name: Checkout repository
170197
uses: actions/checkout@v4
171-
if: needs.changes.outputs.typescript == 'true'
172198

173199
- name: Install Nodejs
174200
uses: actions/setup-node@v4
175201
with:
176202
node-version: 22
177-
if: needs.changes.outputs.typescript == 'true'
178203

179204
- name: Install xvfb
180-
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
205+
if: matrix.os == 'ubuntu-latest'
181206
run: sudo apt-get install -y xvfb
182207

183208
- run: npm ci
184209
working-directory: ./editors/code
185-
if: needs.changes.outputs.typescript == 'true'
186210

187211
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
188212
# if: runner.os == 'Linux'
@@ -191,35 +215,31 @@ jobs:
191215
# If this steps fails, your code's type integrity might be wrong at some places at TypeScript level.
192216
- run: npm run typecheck
193217
working-directory: ./editors/code
194-
if: needs.changes.outputs.typescript == 'true'
195218

196219
# You may fix the code automatically by running `npm run lint:fix` if this steps fails.
197220
- run: npm run lint
198221
working-directory: ./editors/code
199-
if: needs.changes.outputs.typescript == 'true'
200222

201223
# To fix this steps, please run `npm run format`.
202224
- run: npm run format:check
203225
working-directory: ./editors/code
204-
if: needs.changes.outputs.typescript == 'true'
205226

206227
- name: Run VS Code tests (Linux)
207-
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true'
228+
if: matrix.os == 'ubuntu-latest'
208229
env:
209230
VSCODE_CLI: 1
210231
run: xvfb-run npm test
211232
working-directory: ./editors/code
212233

213234
- name: Run VS Code tests (Windows)
214-
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true'
235+
if: matrix.os == 'windows-latest'
215236
env:
216237
VSCODE_CLI: 1
217238
run: npm test
218239
working-directory: ./editors/code
219240

220241
- run: npm run package --scripts-prepend-node-path
221242
working-directory: ./editors/code
222-
if: needs.changes.outputs.typescript == 'true'
223243

224244
typo-check:
225245
name: Typo Check
@@ -241,7 +261,7 @@ jobs:
241261
run: typos
242262

243263
conclusion:
244-
needs: [rust, rust-cross, typescript, typo-check]
264+
needs: [rust, rust-cross, typescript, typo-check, proc-macro-srv]
245265
# We need to ensure this job does *not* get skipped if its dependencies fail,
246266
# because a skipped job is considered a success by GitHub. So we have to
247267
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -256,5 +276,5 @@ jobs:
256276
run: |
257277
# Print the dependent jobs to see them in the CI log
258278
jq -C <<< '${{ toJson(needs) }}'
259-
# Check if all jobs that we depend on (in the needs array) were successful.
260-
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
279+
# Check if all jobs that we depend on (in the needs array) were successful (or have been skipped).
280+
jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'

0 commit comments

Comments
 (0)