mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-17 19:27:11 +00:00
Rebuild ruff binary instead of sharing it across jobs (#21361)
This commit is contained in:
parent
f44598dc11
commit
84a810736d
2 changed files with 61 additions and 80 deletions
138
.github/workflows/ci.yaml
vendored
138
.github/workflows/ci.yaml
vendored
|
|
@ -254,6 +254,7 @@ jobs:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
|
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
|
||||||
with:
|
with:
|
||||||
|
shared-key: ruff-linux-debug
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: "Install Rust toolchain"
|
- name: "Install Rust toolchain"
|
||||||
run: rustup show
|
run: rustup show
|
||||||
|
|
@ -295,14 +296,6 @@ jobs:
|
||||||
env:
|
env:
|
||||||
# Setting RUSTDOCFLAGS because `cargo doc --check` isn't yet implemented (https://github.com/rust-lang/cargo/issues/10025).
|
# Setting RUSTDOCFLAGS because `cargo doc --check` isn't yet implemented (https://github.com/rust-lang/cargo/issues/10025).
|
||||||
RUSTDOCFLAGS: "-D warnings"
|
RUSTDOCFLAGS: "-D warnings"
|
||||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
||||||
with:
|
|
||||||
name: ruff
|
|
||||||
path: target/debug/ruff
|
|
||||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
||||||
with:
|
|
||||||
name: ty
|
|
||||||
path: target/debug/ty
|
|
||||||
|
|
||||||
cargo-test-linux-release:
|
cargo-test-linux-release:
|
||||||
name: "cargo test (linux, release)"
|
name: "cargo test (linux, release)"
|
||||||
|
|
@ -462,9 +455,7 @@ jobs:
|
||||||
fuzz-parser:
|
fuzz-parser:
|
||||||
name: "fuzz parser"
|
name: "fuzz parser"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs: determine_changes
|
||||||
- cargo-test-linux
|
|
||||||
- determine_changes
|
|
||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.parser == 'true' || needs.determine_changes.outputs.py-fuzzer == 'true') }}
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.parser == 'true' || needs.determine_changes.outputs.py-fuzzer == 'true') }}
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
env:
|
env:
|
||||||
|
|
@ -474,26 +465,23 @@ jobs:
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
|
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
|
||||||
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
|
||||||
name: Download Ruff binary to test
|
|
||||||
id: download-cached-binary
|
|
||||||
with:
|
with:
|
||||||
name: ruff
|
shared-key: ruff-linux-debug
|
||||||
path: ruff-to-test
|
save-if: false
|
||||||
|
- name: "Install Rust toolchain"
|
||||||
|
run: rustup show
|
||||||
|
- name: Build Ruff binary
|
||||||
|
run: cargo build --bin ruff
|
||||||
- name: Fuzz
|
- name: Fuzz
|
||||||
env:
|
|
||||||
DOWNLOAD_PATH: ${{ steps.download-cached-binary.outputs.download-path }}
|
|
||||||
run: |
|
run: |
|
||||||
# Make executable, since artifact download doesn't preserve this
|
|
||||||
chmod +x "${DOWNLOAD_PATH}/ruff"
|
|
||||||
|
|
||||||
(
|
(
|
||||||
uv run \
|
uv run \
|
||||||
--python="${PYTHON_VERSION}" \
|
--python="${PYTHON_VERSION}" \
|
||||||
--project=./python/py-fuzzer \
|
--project=./python/py-fuzzer \
|
||||||
--locked \
|
--locked \
|
||||||
fuzz \
|
fuzz \
|
||||||
--test-executable="${DOWNLOAD_PATH}/ruff" \
|
--test-executable=target/debug/ruff \
|
||||||
--bin=ruff \
|
--bin=ruff \
|
||||||
0-500
|
0-500
|
||||||
)
|
)
|
||||||
|
|
@ -535,9 +523,7 @@ jobs:
|
||||||
ecosystem:
|
ecosystem:
|
||||||
name: "ecosystem"
|
name: "ecosystem"
|
||||||
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-latest-8' || 'ubuntu-latest' }}
|
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-latest-8' || 'ubuntu-latest' }}
|
||||||
needs:
|
needs: determine_changes
|
||||||
- cargo-test-linux
|
|
||||||
- determine_changes
|
|
||||||
# Only runs on pull requests, since that is the only we way we can find the base version for comparison.
|
# Only runs on pull requests, since that is the only we way we can find the base version for comparison.
|
||||||
# Ecosystem check needs linter and/or formatter changes.
|
# Ecosystem check needs linter and/or formatter changes.
|
||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && github.event_name == 'pull_request' && needs.determine_changes.outputs.code == 'true' }}
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && github.event_name == 'pull_request' && needs.determine_changes.outputs.code == 'true' }}
|
||||||
|
|
@ -545,26 +531,37 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
with:
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.base.ref }}
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
|
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
activate-environment: true
|
activate-environment: true
|
||||||
|
|
||||||
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
- name: "Install Rust toolchain"
|
||||||
name: Download comparison Ruff binary
|
run: rustup show
|
||||||
id: ruff-target
|
|
||||||
with:
|
|
||||||
name: ruff
|
|
||||||
path: target/debug
|
|
||||||
|
|
||||||
- uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8
|
- name: "Install mold"
|
||||||
name: Download baseline Ruff binary
|
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
|
||||||
with:
|
with:
|
||||||
name: ruff
|
shared-key: ruff-linux-debug
|
||||||
branch: ${{ github.event.pull_request.base.ref }}
|
save-if: false
|
||||||
workflow: "ci.yaml"
|
|
||||||
check_artifacts: true
|
- name: Build baseline version
|
||||||
|
run: |
|
||||||
|
cargo build --bin ruff
|
||||||
|
mv target/debug/ruff target/debug/ruff-baseline
|
||||||
|
|
||||||
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
clean: false
|
||||||
|
|
||||||
|
- name: Build comparison version
|
||||||
|
run: cargo build --bin ruff
|
||||||
|
|
||||||
- name: Install ruff-ecosystem
|
- name: Install ruff-ecosystem
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -572,16 +569,11 @@ jobs:
|
||||||
|
|
||||||
- name: Run `ruff check` stable ecosystem check
|
- name: Run `ruff check` stable ecosystem check
|
||||||
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
|
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
|
||||||
env:
|
|
||||||
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
|
|
||||||
run: |
|
run: |
|
||||||
# Make executable, since artifact download doesn't preserve this
|
|
||||||
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
|
|
||||||
|
|
||||||
# Set pipefail to avoid hiding errors with tee
|
# Set pipefail to avoid hiding errors with tee
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
ruff-ecosystem check ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable
|
ruff-ecosystem check ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable
|
||||||
|
|
||||||
cat ecosystem-result-check-stable > "$GITHUB_STEP_SUMMARY"
|
cat ecosystem-result-check-stable > "$GITHUB_STEP_SUMMARY"
|
||||||
echo "### Linter (stable)" > ecosystem-result
|
echo "### Linter (stable)" > ecosystem-result
|
||||||
|
|
@ -590,16 +582,11 @@ jobs:
|
||||||
|
|
||||||
- name: Run `ruff check` preview ecosystem check
|
- name: Run `ruff check` preview ecosystem check
|
||||||
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
|
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
|
||||||
env:
|
|
||||||
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
|
|
||||||
run: |
|
run: |
|
||||||
# Make executable, since artifact download doesn't preserve this
|
|
||||||
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
|
|
||||||
|
|
||||||
# Set pipefail to avoid hiding errors with tee
|
# Set pipefail to avoid hiding errors with tee
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
ruff-ecosystem check ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview
|
ruff-ecosystem check ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview
|
||||||
|
|
||||||
cat ecosystem-result-check-preview > "$GITHUB_STEP_SUMMARY"
|
cat ecosystem-result-check-preview > "$GITHUB_STEP_SUMMARY"
|
||||||
echo "### Linter (preview)" >> ecosystem-result
|
echo "### Linter (preview)" >> ecosystem-result
|
||||||
|
|
@ -608,16 +595,11 @@ jobs:
|
||||||
|
|
||||||
- name: Run `ruff format` stable ecosystem check
|
- name: Run `ruff format` stable ecosystem check
|
||||||
if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
|
if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
|
||||||
env:
|
|
||||||
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
|
|
||||||
run: |
|
run: |
|
||||||
# Make executable, since artifact download doesn't preserve this
|
|
||||||
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
|
|
||||||
|
|
||||||
# Set pipefail to avoid hiding errors with tee
|
# Set pipefail to avoid hiding errors with tee
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
ruff-ecosystem format ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable
|
ruff-ecosystem format ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable
|
||||||
|
|
||||||
cat ecosystem-result-format-stable > "$GITHUB_STEP_SUMMARY"
|
cat ecosystem-result-format-stable > "$GITHUB_STEP_SUMMARY"
|
||||||
echo "### Formatter (stable)" >> ecosystem-result
|
echo "### Formatter (stable)" >> ecosystem-result
|
||||||
|
|
@ -626,16 +608,11 @@ jobs:
|
||||||
|
|
||||||
- name: Run `ruff format` preview ecosystem check
|
- name: Run `ruff format` preview ecosystem check
|
||||||
if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
|
if: ${{ needs.determine_changes.outputs.formatter == 'true' }}
|
||||||
env:
|
|
||||||
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
|
|
||||||
run: |
|
run: |
|
||||||
# Make executable, since artifact download doesn't preserve this
|
|
||||||
chmod +x ./ruff "${DOWNLOAD_PATH}/ruff"
|
|
||||||
|
|
||||||
# Set pipefail to avoid hiding errors with tee
|
# Set pipefail to avoid hiding errors with tee
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
ruff-ecosystem format ./ruff "${DOWNLOAD_PATH}/ruff" --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview
|
ruff-ecosystem format ./target/debug/ruff-baseline ./target/debug/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview
|
||||||
|
|
||||||
cat ecosystem-result-format-preview > "$GITHUB_STEP_SUMMARY"
|
cat ecosystem-result-format-preview > "$GITHUB_STEP_SUMMARY"
|
||||||
echo "### Formatter (preview)" >> ecosystem-result
|
echo "### Formatter (preview)" >> ecosystem-result
|
||||||
|
|
@ -731,7 +708,7 @@ jobs:
|
||||||
- name: "Install mold"
|
- name: "Install mold"
|
||||||
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
|
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
|
||||||
- name: "Run ty completion evaluation"
|
- name: "Run ty completion evaluation"
|
||||||
run: cargo run --release --package ty_completion_eval -- all --threshold 0.4 --tasks /tmp/completion-evaluation-tasks.csv
|
run: cargo run --profile profiling --package ty_completion_eval -- all --threshold 0.4 --tasks /tmp/completion-evaluation-tasks.csv
|
||||||
- name: "Ensure there are no changes"
|
- name: "Ensure there are no changes"
|
||||||
run: diff ./crates/ty_completion_eval/completion-evaluation-tasks.csv /tmp/completion-evaluation-tasks.csv
|
run: diff ./crates/ty_completion_eval/completion-evaluation-tasks.csv /tmp/completion-evaluation-tasks.csv
|
||||||
|
|
||||||
|
|
@ -866,9 +843,7 @@ jobs:
|
||||||
name: "test ruff-lsp"
|
name: "test ruff-lsp"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
needs:
|
needs: determine_changes
|
||||||
- cargo-test-linux
|
|
||||||
- determine_changes
|
|
||||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
|
||||||
steps:
|
steps:
|
||||||
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
|
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0
|
||||||
|
|
@ -876,37 +851,46 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
name: "Download ruff-lsp source"
|
name: "Checkout ruff source"
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
|
||||||
|
with:
|
||||||
|
shared-key: ruff-linux-debug
|
||||||
|
save-if: false
|
||||||
|
|
||||||
|
- name: "Install Rust toolchain"
|
||||||
|
run: rustup show
|
||||||
|
|
||||||
|
- name: Build Ruff binary
|
||||||
|
run: cargo build -p ruff --bin ruff
|
||||||
|
|
||||||
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
name: "Checkout ruff-lsp source"
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
repository: "astral-sh/ruff-lsp"
|
repository: "astral-sh/ruff-lsp"
|
||||||
|
path: ruff-lsp
|
||||||
|
|
||||||
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
||||||
with:
|
with:
|
||||||
# installation fails on 3.13 and newer
|
# installation fails on 3.13 and newer
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
|
|
||||||
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
|
||||||
name: Download development ruff binary
|
|
||||||
id: ruff-target
|
|
||||||
with:
|
|
||||||
name: ruff
|
|
||||||
path: target/debug
|
|
||||||
|
|
||||||
- name: Install ruff-lsp dependencies
|
- name: Install ruff-lsp dependencies
|
||||||
run: |
|
run: |
|
||||||
|
cd ruff-lsp
|
||||||
just install
|
just install
|
||||||
|
|
||||||
- name: Run ruff-lsp tests
|
- name: Run ruff-lsp tests
|
||||||
env:
|
|
||||||
DOWNLOAD_PATH: ${{ steps.ruff-target.outputs.download-path }}
|
|
||||||
run: |
|
run: |
|
||||||
# Setup development binary
|
# Setup development binary
|
||||||
pip uninstall --yes ruff
|
pip uninstall --yes ruff
|
||||||
chmod +x "${DOWNLOAD_PATH}/ruff"
|
export PATH="${PWD}/target/debug:${PATH}"
|
||||||
export PATH="${DOWNLOAD_PATH}:${PATH}"
|
|
||||||
ruff version
|
ruff version
|
||||||
|
|
||||||
|
cd ruff-lsp
|
||||||
just test
|
just test
|
||||||
|
|
||||||
check-playground:
|
check-playground:
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,6 @@ class CheckOptions(CommandOptions):
|
||||||
"check",
|
"check",
|
||||||
"--no-cache",
|
"--no-cache",
|
||||||
"--exit-zero",
|
"--exit-zero",
|
||||||
# Ignore internal test rules
|
|
||||||
"--ignore",
|
|
||||||
"RUF9",
|
|
||||||
# Never apply fixes, as they pollute the comparison results
|
# Never apply fixes, as they pollute the comparison results
|
||||||
"--no-fix",
|
"--no-fix",
|
||||||
# Use the concise format for comparing violations
|
# Use the concise format for comparing violations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue