1
Fork 0

Run proc-macro server tests are separate CI job

Touch tt
This commit is contained in:
Lukas Wirth 2025-03-10 09:39:02 +01:00
parent 60da021da3
commit ee79f3e9dc

View file

@ -35,19 +35,48 @@ jobs:
typescript: typescript:
- 'editors/code/**' - 'editors/code/**'
proc_macros: proc_macros:
- 'crates/tt/**'
- 'crates/proc-macro-api/**' - 'crates/proc-macro-api/**'
- 'crates/proc-macro-srv/**' - 'crates/proc-macro-srv/**'
- 'crates/proc-macro-srv-cli/**' - 'crates/proc-macro-srv-cli/**'
rust: proc-macro-srv:
needs: changes needs: changes
if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.proc_macros == 'true'
name: proc-macro-srv
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Rust toolchain
run: |
rustup update --no-self-update nightly
rustup default nightly
rustup component add --toolchain nightly rust-src rustfmt
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
- name: Install Rust Problem Matcher
if: matrix.os == 'ubuntu-latest'
run: echo "::add-matcher::.github/rust.json"
- name: Cache Dependencies
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
- name: Bump opt-level
if: matrix.os == 'ubuntu-latest'
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml
- name: Test
run: cargo test --features sysroot-abi -p rust-analyzer -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet
rust:
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
RUST_CHANNEL: "${{ needs.changes.outputs.proc_macros == 'true' && 'nightly' || 'stable' }}"
USE_SYSROOT_ABI: "${{ needs.changes.outputs.proc_macros == 'true' && '--features sysroot-abi' || '' }}"
strategy: strategy:
fail-fast: false fail-fast: false
@ -62,9 +91,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
run: | run: |
rustup update --no-self-update ${{ env.RUST_CHANNEL }} rustup update --no-self-update stable
rustup default ${{ env.RUST_CHANNEL }} rustup default stable
rustup component add --toolchain ${{ env.RUST_CHANNEL }} rust-src rustup component add --toolchain stable rust-src
# We always use a nightly rustfmt, regardless of channel, because we need # We always use a nightly rustfmt, regardless of channel, because we need
# --file-lines. # --file-lines.
rustup toolchain install nightly --profile minimal --component rustfmt rustup toolchain install nightly --profile minimal --component rustfmt
@ -75,8 +104,6 @@ jobs:
- name: Cache Dependencies - name: Cache Dependencies
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609 uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609
with:
key: ${{ env.RUST_CHANNEL }}
- name: Bump opt-level - name: Bump opt-level
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
@ -86,16 +113,16 @@ jobs:
run: cargo codegen --check run: cargo codegen --check
- name: Compile (tests) - name: Compile (tests)
run: cargo test --no-run --locked ${{ env.USE_SYSROOT_ABI }} run: cargo test --no-run --locked
# 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 ${{ env.USE_SYSROOT_ABI }} run: cargo build --quiet
- name: Test - name: Test
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push' if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
run: cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet run: cargo test -- --quiet
- name: Switch to stable toolchain - name: Switch to stable toolchain
run: | run: |
@ -156,7 +183,7 @@ jobs:
typescript: typescript:
needs: changes needs: changes
if: github.repository == 'rust-lang/rust-analyzer' if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'
name: TypeScript name: TypeScript
strategy: strategy:
fail-fast: false fail-fast: false
@ -168,21 +195,18 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
if: needs.changes.outputs.typescript == 'true'
- name: Install Nodejs - name: Install Nodejs
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 22
if: needs.changes.outputs.typescript == 'true'
- name: Install xvfb - name: Install xvfb
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true' if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y xvfb run: sudo apt-get install -y xvfb
- run: npm ci - run: npm ci
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
# - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; } # - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }
# if: runner.os == 'Linux' # if: runner.os == 'Linux'
@ -191,27 +215,24 @@ jobs:
# If this steps fails, your code's type integrity might be wrong at some places at TypeScript level. # If this steps fails, your code's type integrity might be wrong at some places at TypeScript level.
- run: npm run typecheck - run: npm run typecheck
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
# You may fix the code automatically by running `npm run lint:fix` if this steps fails. # You may fix the code automatically by running `npm run lint:fix` if this steps fails.
- run: npm run lint - run: npm run lint
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
# To fix this steps, please run `npm run format`. # To fix this steps, please run `npm run format`.
- run: npm run format:check - run: npm run format:check
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
- name: Run VS Code tests (Linux) - name: Run VS Code tests (Linux)
if: matrix.os == 'ubuntu-latest' && needs.changes.outputs.typescript == 'true' if: matrix.os == 'ubuntu-latest'
env: env:
VSCODE_CLI: 1 VSCODE_CLI: 1
run: xvfb-run npm test run: xvfb-run npm test
working-directory: ./editors/code working-directory: ./editors/code
- name: Run VS Code tests (Windows) - name: Run VS Code tests (Windows)
if: matrix.os == 'windows-latest' && needs.changes.outputs.typescript == 'true' if: matrix.os == 'windows-latest'
env: env:
VSCODE_CLI: 1 VSCODE_CLI: 1
run: npm test run: npm test
@ -219,7 +240,6 @@ jobs:
- run: npm run package --scripts-prepend-node-path - run: npm run package --scripts-prepend-node-path
working-directory: ./editors/code working-directory: ./editors/code
if: needs.changes.outputs.typescript == 'true'
typo-check: typo-check:
name: Typo Check name: Typo Check
@ -241,7 +261,7 @@ jobs:
run: typos run: typos
conclusion: conclusion:
needs: [rust, rust-cross, typescript, typo-check] needs: [rust, rust-cross, typescript, typo-check, proc-macro-srv]
# We need to ensure this job does *not* get skipped if its dependencies fail, # We need to ensure this job does *not* get skipped if its dependencies fail,
# because a skipped job is considered a success by GitHub. So we have to # because a skipped job is considered a success by GitHub. So we have to
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@ -256,5 +276,5 @@ jobs:
run: | run: |
# Print the dependent jobs to see them in the CI log # Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}' jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful. # Check if all jobs that we depend on (in the needs array) were successful (or have been skipped).
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'