Skip to content

Commit 84a8107

Browse files
authored
Rebuild ruff binary instead of sharing it across jobs (astral-sh#21361)
1 parent f44598d commit 84a8107

2 files changed

Lines changed: 60 additions & 79 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 60 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ jobs:
254254
persist-credentials: false
255255
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
256256
with:
257+
shared-key: ruff-linux-debug
257258
save-if: ${{ github.ref == 'refs/heads/main' }}
258259
- name: "Install Rust toolchain"
259260
run: rustup show
@@ -295,14 +296,6 @@ jobs:
295296
env:
296297
# Setting RUSTDOCFLAGS because `cargo doc --check` isn't yet implemented (https://github.com/rust-lang/cargo/issues/10025).
297298
RUSTDOCFLAGS: "-D warnings"
298-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
299-
with:
300-
name: ruff
301-
path: target/debug/ruff
302-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
303-
with:
304-
name: ty
305-
path: target/debug/ty
306299

307300
cargo-test-linux-release:
308301
name: "cargo test (linux, release)"
@@ -462,9 +455,7 @@ jobs:
462455
fuzz-parser:
463456
name: "fuzz parser"
464457
runs-on: ubuntu-latest
465-
needs:
466-
- cargo-test-linux
467-
- determine_changes
458+
needs: determine_changes
468459
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.parser == 'true' || needs.determine_changes.outputs.py-fuzzer == 'true') }}
469460
timeout-minutes: 20
470461
env:
@@ -474,26 +465,23 @@ jobs:
474465
with:
475466
persist-credentials: false
476467
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
477-
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
478-
name: Download Ruff binary to test
479-
id: download-cached-binary
468+
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
480469
with:
481-
name: ruff
482-
path: ruff-to-test
470+
shared-key: ruff-linux-debug
471+
save-if: false
472+
- name: "Install Rust toolchain"
473+
run: rustup show
474+
- name: Build Ruff binary
475+
run: cargo build --bin ruff
483476
- name: Fuzz
484-
env:
485-
DOWNLOAD_PATH: ${{ steps.download-cached-binary.outputs.download-path }}
486477
run: |
487-
# Make executable, since artifact download doesn't preserve this
488-
chmod +x "${DOWNLOAD_PATH}/ruff"
489-
490478
(
491479
uv run \
492480
--python="${PYTHON_VERSION}" \
493481
--project=./python/py-fuzzer \
494482
--locked \
495483
fuzz \
496-
--test-executable="${DOWNLOAD_PATH}/ruff" \
484+
--test-executable=target/debug/ruff \
497485
--bin=ruff \
498486
0-500
499487
)
@@ -535,53 +523,57 @@ jobs:
535523
ecosystem:
536524
name: "ecosystem"
537525
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-latest-8' || 'ubuntu-latest' }}
538-
needs:
539-
- cargo-test-linux
540-
- determine_changes
526+
needs: determine_changes
541527
# Only runs on pull requests, since that is the only we way we can find the base version for comparison.
542528
# Ecosystem check needs linter and/or formatter changes.
543529
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && github.event_name == 'pull_request' && needs.determine_changes.outputs.code == 'true' }}
544530
timeout-minutes: 20
545531
steps:
546532
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
547533
with:
534+
ref: ${{ github.event.pull_request.base.ref }}
548535
persist-credentials: false
536+
549537
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
550538
with:
551539
python-version: ${{ env.PYTHON_VERSION }}
552540
activate-environment: true
553541

554-
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
555-
name: Download comparison Ruff binary
556-
id: ruff-target
542+
- name: "Install Rust toolchain"
543+
run: rustup show
544+
545+
- name: "Install mold"
546+
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
547+
548+
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
557549
with:
558-
name: ruff
559-
path: target/debug
550+
shared-key: ruff-linux-debug
551+
save-if: false
552+
553+
- name: Build baseline version
554+
run: |
555+
cargo build --bin ruff
556+
mv target/debug/ruff target/debug/ruff-baseline
560557
561-
- uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8
562-
name: Download baseline Ruff binary
558+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
563559
with:
564-
name: ruff
565-
branch: ${{ github.event.pull_request.base.ref }}
566-
workflow: "ci.yaml"
567-
check_artifacts: true
560+
persist-credentials: false
561+
clean: false
562+
563+
- name: Build comparison version
564+
run: cargo build --bin ruff
568565

569566
- name: Install ruff-ecosystem
570567
run: |
571568
uv pip install ./python/ruff-ecosystem
572569
573570
- name: Run `ruff check` stable ecosystem check
574571
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
575-
env:
576-
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
577572
run: |
578-
# Make executable, since artifact download doesn't preserve this
579-
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
580-
581573
# Set pipefail to avoid hiding errors with tee
582574
set -eo pipefail
583575
584-
ruff-ecosystem check ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable
576+
ruff-ecosystem check ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable
585577
586578
cat ecosystem-result-check-stable > "$GITHUB_STEP_SUMMARY"
587579
echo "### Linter (stable)" > ecosystem-result
@@ -590,16 +582,11 @@ jobs:
590582
591583
- name: Run `ruff check` preview ecosystem check
592584
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
593-
env:
594-
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
595585
run: |
596-
# Make executable, since artifact download doesn't preserve this
597-
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
598-
599586
# Set pipefail to avoid hiding errors with tee
600587
set -eo pipefail
601588
602-
ruff-ecosystem check ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview
589+
ruff-ecosystem check ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview
603590
604591
cat ecosystem-result-check-preview > "$GITHUB_STEP_SUMMARY"
605592
echo "### Linter (preview)" >> ecosystem-result
@@ -608,16 +595,11 @@ jobs:
608595
609596
- name: Run `ruff format` stable ecosystem check
610597
if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
611-
env:
612-
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
613598
run: |
614-
# Make executable, since artifact download doesn't preserve this
615-
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
616-
617599
# Set pipefail to avoid hiding errors with tee
618600
set -eo pipefail
619601
620-
ruff-ecosystem format ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable
602+
ruff-ecosystem format ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable
621603
622604
cat ecosystem-result-format-stable > "$GITHUB_STEP_SUMMARY"
623605
echo "### Formatter (stable)" >> ecosystem-result
@@ -626,16 +608,11 @@ jobs:
626608
627609
- name: Run `ruff format` preview ecosystem check
628610
if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
629-
env:
630-
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
631611
run: |
632-
# Make executable, since artifact download doesn't preserve this
633-
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
634-
635612
# Set pipefail to avoid hiding errors with tee
636613
set -eo pipefail
637614
638-
ruff-ecosystem format ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview
615+
ruff-ecosystem format ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview
639616
640617
cat ecosystem-result-format-preview > "$GITHUB_STEP_SUMMARY"
641618
echo "### Formatter (preview)" >> ecosystem-result
@@ -731,7 +708,7 @@ jobs:
731708
- name: "Install mold"
732709
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
733710
- name: "Run ty completion evaluation"
734-
run: cargo run --release --package ty_completion_eval -- all --threshold 0.4 --tasks /tmp/completion-evaluation-tasks.csv
711+
run: cargo run --profile profiling --package ty_completion_eval -- all --threshold 0.4 --tasks /tmp/completion-evaluation-tasks.csv
735712
- name: "Ensure there are no changes"
736713
run: diff ./crates/ty_completion_eval/completion-evaluation-tasks.csv /tmp/completion-evaluation-tasks.csv
737714

@@ -866,47 +843,54 @@ jobs:
866843
name: "test ruff-lsp"
867844
runs-on: ubuntu-latest
868845
timeout-minutes: 5
869-
needs:
870-
- cargo-test-linux
871-
- determine_changes
846+
needs: determine_changes
872847
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
873848
steps:
874849
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
875850
env:
876851
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
877852

878853
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
879-
name: "Download ruff-lsp source"
854+
name: "Checkout ruff source"
855+
with:
856+
persist-credentials: false
857+
858+
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
859+
with:
860+
shared-key: ruff-linux-debug
861+
save-if: false
862+
863+
- name: "Install Rust toolchain"
864+
run: rustup show
865+
866+
- name: Build Ruff binary
867+
run: cargo build -p ruff --bin ruff
868+
869+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
870+
name: "Checkout ruff-lsp source"
880871
with:
881872
persist-credentials: false
882873
repository: "astral-sh/ruff-lsp"
874+
path: ruff-lsp
883875

884876
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
885877
with:
886878
# installation fails on 3.13 and newer
887879
python-version: "3.12"
888880

889-
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
890-
name: Download development ruff binary
891-
id: ruff-target
892-
with:
893-
name: ruff
894-
path: target/debug
895-
896881
- name: Install ruff-lsp dependencies
897882
run: |
883+
cd ruff-lsp
898884
just install
899885
900886
- name: Run ruff-lsp tests
901-
env:
902-
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
903887
run: |
904888
# Setup development binary
905889
pip uninstall --yes ruff
906-
chmod +x "${DOWNLOAD_PATH}/ruff"
907-
export PATH="${DOWNLOAD_PATH}:${PATH}"
890+
export PATH="${PWD}/target/debug:${PATH}"
908891
ruff version
909892
893+
cd ruff-lsp
910894
just test
911895
912896
check-playground:

python/ruff-ecosystem/ruff_ecosystem/projects.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ def to_ruff_args(self) -> list[str]:
206206
"check",
207207
"--no-cache",
208208
"--exit-zero",
209-
# Ignore internal test rules
210-
"--ignore",
211-
"RUF9",
212209
# Never apply fixes, as they pollute the comparison results
213210
"--no-fix",
214211
# Use the concise format for comparing violations

0 commit comments

Comments
 (0)