Skip to content

Commit

Permalink
Auto merge of rust-lang#14909 - Veykril:ci-proc-macros, r=Veykril
Browse files Browse the repository at this point in the history
Run CI on nightly rust when proc-macro-* crates change
  • Loading branch information
bors committed May 26, 2023
2 parents 08f0c29 + ee8c18c commit 9e6ae6b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,21 @@ jobs:
filters: |
typescript:
- 'editors/code/**'
proc_macros:
- 'crates/proc-macro-api/**'
- 'crates/proc-macro-srv/**'
- 'crates/proc-macro-srv-cli/**'
- 'crates/proc-macro-test/**'
rust:
needs: changes
if: github.repository == 'rust-lang/rust-analyzer'
name: Rust
runs-on: ${{ matrix.os }}
env:
CC: deny_c
# we want to build r-a on stable to check that it keeps building on stable,
# but we also want to test our proc-macro-srv which depends on nightly features
RUSTC_BOOTSTRAP: 1
RUST_CHANNEL: "${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable'}}"
USE_SYSROOT_ABI: "${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || ''}}"

strategy:
fail-fast: false
Expand All @@ -57,26 +62,28 @@ jobs:

- name: Install Rust toolchain
run: |
rustup update --no-self-update stable
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
rustup component add rustfmt rust-src
- name: Cache Dependencies
uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
with:
key: ${{ env.RUST_CHANNEL }}

- name: Bump opt-level
if: matrix.os == 'ubuntu-latest'
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml

- 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` ¯\_(ツ)_/¯
- name: Compile (rust-analyzer)
if: matrix.os == 'ubuntu-latest'
run: cargo build --quiet --features sysroot-abi
run: cargo build --quiet ${{ env.USE_SYSROOT_ABI }}

- 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
if: matrix.os == 'ubuntu-latest'
Expand Down Expand Up @@ -108,7 +115,7 @@ jobs:
rustup target add ${{ env.targets }} ${{ env.targets_ide }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@76686c56f2b581d1bb5bda44b51f7e24bd9b8b8e
uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894

- name: Check
run: |
Expand Down
3 changes: 3 additions & 0 deletions crates/rust-analyzer/tests/slow-tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,9 @@ fn main() {
"enable": true
},
"sysroot": null,
"extraEnv": {
"RUSTC_BOOTSTRAP": "1"
}
}
}))
.server()
Expand Down

0 comments on commit 9e6ae6b

Please sign in to comment.