1# Please make sure that the `needs` field for the `conclusion` job2# are updated when adding new jobs!34name: CI5on:6 pull_request:7 merge_group:89concurrency:10 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}11 cancel-in-progress: true1213env:14 CARGO_INCREMENTAL: 015 CARGO_NET_RETRY: 1016 CI: 117 RUST_BACKTRACE: short18 RUSTUP_MAX_RETRIES: 1019 RUSTFLAGS: "-D warnings -W unreachable-pub --cfg no_salsa_async_drops"2021defaults:22 run:23 shell: bash2425jobs:26 changes:27 runs-on: ubuntu-latest28 permissions:29 pull-requests: read30 outputs:31 typescript: ${{ steps.filter.outputs.typescript }}32 steps:33 - uses: actions/checkout@v634 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.135 id: filter36 with:37 filters: |38 typescript:39 - 'editors/code/**'4041 proc-macro-srv:42 if: github.repository == 'rust-lang/rust-analyzer'43 name: proc-macro-srv44 runs-on: ubuntu-latest4546 steps:47 - name: Checkout repository48 uses: actions/checkout@v649 with:50 ref: ${{ github.event.pull_request.head.sha }}5152 - name: Install rustup-toolchain-install-master53 run: cargo install rustup-toolchain-install-master@1.11.05455 # Install a pinned rustc commit to avoid surprises56 - name: Install Rust toolchain57 run: |58 RUSTC_VERSION=$(cat rust-version)59 rustup-toolchain-install-master ${RUSTC_VERSION} -c cargo -c rust-src -c rustfmt60 rustup default ${RUSTC_VERSION}6162 # Emulate a nightly toolchain, because the toolchain installed above does not have "nightly"63 # in its version string.64 - name: Emulate a nightly toolchain65 run: echo "RUSTC_BOOTSTRAP=1" >> $GITHUB_ENV6667 # https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json68 - name: Install Rust Problem Matcher69 run: echo "::add-matcher::.github/rust.json"7071 - name: Test72 run: cargo test --features sysroot-abi -p proc-macro-srv -p proc-macro-srv-cli -p proc-macro-api -- --quiet7374 - name: Check salsa dependency75 run: "! (cargo tree -p proc-macro-srv-cli | grep -q salsa)"7677 rust:78 if: github.repository == 'rust-lang/rust-analyzer'79 name: Rust80 runs-on: ${{ matrix.os }}81 env:82 CC: deny_c8384 strategy:85 fail-fast: false86 matrix:87 os: [ubuntu-latest, windows-latest, macos-latest]8889 steps:90 - name: Checkout repository91 uses: actions/checkout@v692 with:93 ref: ${{ github.event.pull_request.head.sha }}9495 - name: Install Rust toolchain96 run: |97 rustup update --no-self-update stable98 rustup default stable99 rustup component add --toolchain stable rust-src rustfmt100 # We also install a nightly rustfmt, because we use `--file-lines` in101 # a test.102 rustup toolchain install nightly --profile minimal --component rustfmt103 # https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json104 - name: Install Rust Problem Matcher105 if: matrix.os == 'macos-latest'106 run: echo "::add-matcher::.github/rust.json"107108 # - name: Cache Dependencies109 # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6110 # with:111 # workspaces: |112 # . -> target113 # ./crates/proc-macro-srv/proc-macro-test/imp -> target114115 - name: Install nextest116 uses: taiki-e/install-action@nextest117118 - name: Codegen checks (rust-analyzer)119 if: matrix.os == 'ubuntu-latest'120 run: cargo codegen --check121122 - name: Run tests123 run: cargo nextest run --no-fail-fast --hide-progress-bar --status-level fail124125 - name: Install cargo-machete126 uses: taiki-e/install-action@cargo-machete127128 - name: Run cargo-machete129 run: cargo machete130131 analysis-stats:132 if: github.repository == 'rust-lang/rust-analyzer'133 runs-on: ubuntu-latest134 env:135 RUSTC_BOOTSTRAP: 1136137 steps:138 - name: Checkout repository139 uses: actions/checkout@v6140141 - name: Install Rust toolchain142 run: |143 rustup update --no-self-update stable144 rustup default stable145 rustup component add rustfmt146147 # - name: Cache Dependencies148 # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6149150 - name: Bump opt-level151 run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml152153 - run: cargo build -p rust-analyzer154155 - name: ./rust-analyzer156 run: ./target/debug/rust-analyzer analysis-stats . -q157158 - name: sysroot/lib/rustlib/src/rust/library/159 run: ./target/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/ -q160161 rustfmt:162 if: github.repository == 'rust-lang/rust-analyzer'163 runs-on: ubuntu-latest164165 steps:166 - name: Checkout repository167 uses: actions/checkout@v6168169 - name: Install Rust toolchain170 run: |171 rustup update --no-self-update stable172 rustup default stable173 rustup component add rustfmt174175 - run: cargo fmt -- --check176177 clippy:178 if: github.repository == 'rust-lang/rust-analyzer'179 runs-on: ubuntu-latest180181 steps:182 - name: Checkout repository183 uses: actions/checkout@v6184185 # Note that clippy output is currently dependent on whether rust-src is installed,186 # https://github.com/rust-lang/rust-clippy/issues/14625187 - name: Install Rust toolchain188 run: |189 rustup update --no-self-update stable190 rustup default stable191 rustup component add --toolchain stable rust-src clippy192193 # https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json194 - name: Install Rust Problem Matcher195 run: echo "::add-matcher::.github/rust.json"196197 - run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr198199 miri:200 if: github.repository == 'rust-lang/rust-analyzer'201 runs-on: ubuntu-latest202203 steps:204 - name: Checkout repository205 uses: actions/checkout@v6206207 - name: Install Rust toolchain208 run: |209 # FIXME: Pin nightly due to a regression in miri on nightly-2026-02-12.210 # See https://github.com/rust-lang/miri/issues/4855.211 # Revert to plain `nightly` once this is fixed upstream.212 rustup toolchain install nightly-2026-02-10213 rustup default nightly-2026-02-10214 rustup component add miri215216 # - name: Cache Dependencies217 # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6218219 - run: cargo miri test -p intern220221 # Weird targets to catch non-portable code222 rust-cross:223 if: github.repository == 'rust-lang/rust-analyzer'224 name: Rust Cross225 runs-on: ubuntu-latest226227 strategy:228 matrix:229 target: [powerpc-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-unknown]230 include:231 # The rust-analyzer binary is not expected to compile on WASM, but the IDE232 # crate should233 - target: wasm32-unknown-unknown234 ide-only: true235236 steps:237 - name: Checkout repository238 uses: actions/checkout@v6239240 - name: Install Rust toolchain241 run: |242 rustup update --no-self-update stable243 rustup target add ${{ matrix.target }}244245 # - name: Cache Dependencies246 # uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6247248 - run: cargo check --target=${{ matrix.target }} --all-targets -p ide249 if: ${{ matrix.ide-only }}250 - run: cargo check --target=${{ matrix.target }} --all-targets251 if: ${{ !matrix.ide-only }}252253 typescript:254 needs: changes255 if: github.repository == 'rust-lang/rust-analyzer' && needs.changes.outputs.typescript == 'true'256 name: TypeScript257 strategy:258 fail-fast: false259 matrix:260 os: [ubuntu-latest, windows-latest]261262 runs-on: ${{ matrix.os }}263264 steps:265 - name: Checkout repository266 uses: actions/checkout@v6267268 - name: Install Nodejs269 uses: actions/setup-node@v6270 with:271 node-version: 22272273 - name: Install xvfb274 if: matrix.os == 'ubuntu-latest'275 run: sudo apt-get install -y xvfb276277 - run: npm ci278 working-directory: ./editors/code279280 # - run: npm audit || { sleep 10 && npm audit; } || { sleep 30 && npm audit; }281 # if: runner.os == 'Linux'282 # working-directory: ./editors/code283284 # If this steps fails, your code's type integrity might be wrong at some places at TypeScript level.285 - run: npm run typecheck286 working-directory: ./editors/code287288 # You may fix the code automatically by running `npm run lint:fix` if this steps fails.289 - run: npm run lint290 working-directory: ./editors/code291292 # To fix this steps, please run `npm run format`.293 - run: npm run format:check294 working-directory: ./editors/code295296 - name: Run VS Code tests (Linux)297 if: matrix.os == 'ubuntu-latest'298 env:299 VSCODE_CLI: 1300 run: xvfb-run npm test301 working-directory: ./editors/code302303 - name: Run VS Code tests (Windows)304 if: matrix.os == 'windows-latest'305 env:306 VSCODE_CLI: 1307 run: npm test308 working-directory: ./editors/code309310 - run: npm run package --scripts-prepend-node-path311 working-directory: ./editors/code312313 typo-check:314 name: Typo Check315 runs-on: ubuntu-latest316 timeout-minutes: 10317 env:318 FORCE_COLOR: 1319 TYPOS_VERSION: v1.38.1320 steps:321 - name: download typos322 run: curl -LsSf https://github.com/crate-ci/typos/releases/download/$TYPOS_VERSION/typos-$TYPOS_VERSION-x86_64-unknown-linux-musl.tar.gz | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin323324 - name: Checkout repository325 uses: actions/checkout@v6326 with:327 ref: ${{ github.event.pull_request.head.sha }}328329 - name: check for typos330 run: typos331332 conclusion:333 needs:334 [335 rust,336 rust-cross,337 typescript,338 typo-check,339 proc-macro-srv,340 miri,341 rustfmt,342 clippy,343 analysis-stats,344 ]345 # We need to ensure this job does *not* get skipped if its dependencies fail,346 # because a skipped job is considered a success by GitHub. So we have to347 # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run348 # when the workflow is canceled manually.349 #350 # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!351 if: ${{ !cancelled() }}352 runs-on: ubuntu-latest353 steps:354 # Manually check the status of all dependencies. `if: failure()` does not work.355 - name: Conclusion356 run: |357 # Print the dependent jobs to see them in the CI log358 jq -C <<< '${{ toJson(needs) }}'359 # Check if all jobs that we depend on (in the needs array) were successful (or have been skipped).360 jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'361362 cancel-if-matrix-failed:363 needs: rust364 if: ${{ always() }}365 runs-on: ubuntu-latest366 steps:367 - name: Cancel parallel jobs368 run: |369 if jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}'; then370 exit 0371 fi372 # https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#cancel-a-workflow-run373 curl -L \374 -X POST \375 -H "Accept: application/vnd.github.v3+json" \376 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \377 -H "X-GitHub-Api-Version: 2022-11-28" \378 https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
Findings
✓ No findings reported for this file.