Run CI on nightly rust when proc-macro-* crates change

This commit is contained in:
Lukas Wirth 2023-05-26 20:24:28 +02:00
parent 08f0c29954
commit 28442403a4

View File

@ -32,16 +32,21 @@ jobs:
filters: | filters: |
typescript: typescript:
- 'editors/code/**' - 'editors/code/**'
proc_macros:
- 'crates/proc-macro-api/**'
- 'crates/proc-macro-srv/**'
- 'crates/proc-macro-srv-cli/**'
- 'crates/proc-macro-test/**'
rust: rust:
needs: changes
if: github.repository == 'rust-lang/rust-analyzer' if: github.repository == 'rust-lang/rust-analyzer'
name: Rust name: Rust
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
CC: deny_c CC: deny_c
# we want to build r-a on stable to check that it keeps building on stable, RUST_CHANNEL: "${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable'}}"
# but we also want to test our proc-macro-srv which depends on nightly features USE_SYSROOT_ABI: "${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || ''}}"
RUSTC_BOOTSTRAP: 1
strategy: strategy:
fail-fast: false fail-fast: false
@ -57,7 +62,7 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
run: | run: |
rustup update --no-self-update stable rustup update --no-self-update ${{ env.RUST_CHANNEL }}
rustup component add rustfmt rust-src rustup component add rustfmt rust-src
- name: Cache Dependencies - name: Cache Dependencies
@ -68,15 +73,15 @@ jobs:
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
- name: Compile (tests) - name: Compile (tests)
run: cargo test --no-run --locked --features sysroot-abi run: cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }}
# It's faster to `test` before `build` ¯\_(ツ)_/¯ # It's faster to `test` before `build` ¯\_(ツ)_/¯
- name: Compile (rust-analyzer) - name: Compile (rust-analyzer)
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: cargo build --quiet --features sysroot-abi run: cargo build --quiet ${{ env.USE_SYSROOT_ABI }}
- name: Test - name: Test
run: cargo test --features sysroot-abi -- --nocapture --quiet run: cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet
- name: Run analysis-stats on rust-analyzer - name: Run analysis-stats on rust-analyzer
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'