mirror of
https://github.com/astral-sh/ruff.git
synced 2026-05-06 08:56:57 -04:00
Speed up CI workflows by setting line-tables-only for debug info (#24833)
This commit is contained in:
@@ -268,6 +268,9 @@ jobs:
|
||||
needs: determine_changes
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
@@ -334,6 +337,9 @@ jobs:
|
||||
!contains(github.event.pull_request.labels.*.name, 'no-test') &&
|
||||
(needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main')
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_PROFILING_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
@@ -370,6 +376,9 @@ jobs:
|
||||
needs: determine_changes
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
@@ -431,6 +440,9 @@ jobs:
|
||||
needs: determine_changes
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
@@ -500,7 +512,12 @@ jobs:
|
||||
save-if: false
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
|
||||
- name: Build Ruff binary
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
run: cargo build --bin ruff
|
||||
- name: Fuzz
|
||||
run: |
|
||||
@@ -564,6 +581,9 @@ jobs:
|
||||
needs.determine_changes.outputs.formatter == 'true'
|
||||
)
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
@@ -697,6 +717,8 @@ jobs:
|
||||
- name: Fuzz
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_PROFILING_DEBUG: line-tables-only
|
||||
run: |
|
||||
echo "new commit"
|
||||
git rev-list --format=%s --max-count=1 "$GITHUB_SHA"
|
||||
@@ -741,6 +763,9 @@ jobs:
|
||||
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
|
||||
needs: determine_changes
|
||||
if: ${{ needs.determine_changes.outputs.ty == 'true' || github.ref == 'refs/heads/main' }}
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_PROFILING_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
@@ -878,6 +903,9 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
needs: determine_changes
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
|
||||
env:
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
|
||||
env:
|
||||
@@ -896,6 +924,9 @@ jobs:
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
|
||||
|
||||
- name: Build Ruff binary
|
||||
run: cargo build -p ruff --bin ruff
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ env:
|
||||
CARGO_NET_RETRY: 10
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
PACKAGE_NAME: ruff
|
||||
FORCE_COLOR: 1
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: 1
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_PROFILING_DEBUG: line-tables-only
|
||||
PYTHON_VERSION: 3.14
|
||||
|
||||
jobs:
|
||||
@@ -59,6 +61,9 @@ jobs:
|
||||
- name: Install Rust toolchain
|
||||
run: rustup show
|
||||
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
|
||||
|
||||
- name: Compute memory usage diff
|
||||
shell: bash
|
||||
env:
|
||||
|
||||
@@ -35,6 +35,8 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: 1
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_PROFILING_DEBUG: line-tables-only
|
||||
ECOSYSTEM_ANALYZER_COMMIT: e7576e66e8f992b057ea92c820c04313dceda755
|
||||
|
||||
jobs:
|
||||
@@ -60,6 +62,9 @@ jobs:
|
||||
- name: Install Rust toolchain
|
||||
run: rustup show
|
||||
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
|
||||
|
||||
- name: Build ty for both commits
|
||||
id: build
|
||||
working-directory: ruff
|
||||
|
||||
@@ -18,6 +18,8 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: 1
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_PROFILING_DEBUG: line-tables-only
|
||||
|
||||
jobs:
|
||||
ty-ecosystem-report:
|
||||
@@ -45,6 +47,9 @@ jobs:
|
||||
- name: Install Rust toolchain
|
||||
run: rustup show
|
||||
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
|
||||
|
||||
- name: Create report
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -34,6 +34,8 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: 1
|
||||
# Line-tables-only debug info: faster builds, backtraces still work.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
CONFORMANCE_SUITE_COMMIT: 5a701a037b5243df1f39622b642893d865f06205
|
||||
PYTHON_VERSION: 3.12
|
||||
|
||||
@@ -67,6 +69,9 @@ jobs:
|
||||
- name: Install Rust toolchain
|
||||
run: rustup show
|
||||
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
|
||||
|
||||
- name: Compute diagnostic diff
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -4,28 +4,28 @@ This repository contains both Ruff (a Python linter and formatter) and ty (a Pyt
|
||||
|
||||
## Running Tests
|
||||
|
||||
Run all tests (using `nextest` for faster execution, setting `CARGO_PROFILE_DEV_OPT_LEVEL=1` to enable optimizations while retaining debug info, and setting `INSTA_FORCE_PASS=1 INSTA_UPDATE=always` to ensure all snapshots are updated):
|
||||
Run all tests (using `nextest` for faster execution, setting `CARGO_PROFILE_DEV_OPT_LEVEL=1 CARGO_PROFILE_DEV_DEBUG="line-tables-only"` to enable optimizations while retaining some debug info, and setting `INSTA_FORCE_PASS=1 INSTA_UPDATE=always MDTEST_UPDATE_SNAPSHOTS=1` to ensure all snapshots are updated):
|
||||
|
||||
```sh
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always cargo nextest run
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always CARGO_PROFILE_DEV_DEBUG="line-tables-only" MDTEST_UPDATE_SNAPSHOTS=1 cargo nextest run
|
||||
```
|
||||
|
||||
Run tests for a specific crate:
|
||||
|
||||
```sh
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always cargo nextest run -p ty_python_semantic
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always CARGO_PROFILE_DEV_DEBUG="line-tables-only" MDTEST_UPDATE_SNAPSHOTS=1 cargo nextest run -p ty_python_semantic
|
||||
```
|
||||
|
||||
Run a single mdtest file. The path to the mdtest file should be relative to the `crates/ty_python_semantic/resources/mdtest` folder:
|
||||
|
||||
```sh
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always cargo nextest run -p ty_python_semantic -- mdtest::<path/to/mdtest_file.md>
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always CARGO_PROFILE_DEV_DEBUG="line-tables-only" MDTEST_UPDATE_SNAPSHOTS=1 cargo nextest run -p ty_python_semantic -- mdtest::<path/to/mdtest_file.md>
|
||||
```
|
||||
|
||||
To run a specific mdtest within a file, use a substring of the Markdown header text as `MDTEST_TEST_FILTER`. Only use this if it's necessary to isolate a single test case:
|
||||
|
||||
```sh
|
||||
MDTEST_TEST_FILTER="<filter>" CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always cargo nextest run -p ty_python_semantic -- mdtest::<path/to/mdtest_file.md>
|
||||
MDTEST_TEST_FILTER="<filter>" CARGO_PROFILE_DEV_OPT_LEVEL=1 INSTA_FORCE_PASS=1 INSTA_UPDATE=always CARGO_PROFILE_DEV_DEBUG="line-tables-only" MDTEST_UPDATE_SNAPSHOTS=1 cargo nextest run -p ty_python_semantic -- mdtest::<path/to/mdtest_file.md>
|
||||
```
|
||||
|
||||
After running the tests, always review the contents of any snapshots that have been added or updated.
|
||||
|
||||
@@ -77,6 +77,7 @@ class MDTestRunner:
|
||||
os.environ,
|
||||
CLI_COLOR="1",
|
||||
CARGO_PROFILE_DEV_OPT_LEVEL="0" if self.filters else "1",
|
||||
CARGO_PROFILE_DEV_DEBUG="line-tables-only",
|
||||
),
|
||||
stderr=subprocess.STDOUT,
|
||||
text=True,
|
||||
|
||||
Reference in New Issue
Block a user