Skip to content

Commit 1ad3f9e

Browse files
authored
workflow: make build/test faster and consume less space (#1188)
* workflow: make build/test faster and consume less space * fix: only provide `-C split-debuginfo=off` for macOS * bring back Rust cache with tuning
1 parent 99c4155 commit 1ad3f9e

File tree

6 files changed

+40
-10
lines changed

6 files changed

+40
-10
lines changed

.github/workflows/_docs_release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
environment: docs-release
1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 1
1618
- uses: actions/setup-node@v4
1719
with:
1820
cache: yarn

.github/workflows/_test.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,23 @@ jobs:
1717
platform:
1818
- { runner: ubuntu-latest, python_exec: ".venv/bin/python" }
1919
- { runner: ubuntu-24.04-arm, python_exec: ".venv/bin/python" }
20-
- { runner: macos-latest, python_exec: ".venv/bin/python" }
21-
- { runner: macos-13, python_exec: ".venv/bin/python" }
20+
- { runner: macos-latest, python_exec: ".venv/bin/python", extra_rustflags: "-C split-debuginfo=off"}
21+
- { runner: macos-13, python_exec: ".venv/bin/python", extra_rustflags: "-C split-debuginfo=off"}
2222
- { runner: windows-latest, python_exec: ".venv\\Scripts\\python" }
2323
runs-on: ${{ matrix.platform.runner }}
24+
env:
25+
RUSTFLAGS: "-C debuginfo=0 ${{ matrix.platform.extra_rustflags }}"
26+
CARGO_INCREMENTAL: "0"
27+
SCCACHE_GHA_ENABLED: "true"
28+
RUSTC_WRAPPER: "sccache"
29+
2430
steps:
2531
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 1
34+
35+
- name: Run sccache-cache
36+
uses: mozilla-actions/[email protected]
2637

2738
- uses: actions/setup-python@v5
2839
id: setup_python
@@ -31,23 +42,21 @@ jobs:
3142
cache: 'pip'
3243

3344
- run: rustup toolchain install stable --profile minimal
45+
3446
- name: Rust Cache
3547
uses: Swatinem/rust-cache@v2
3648
with:
3749
key: rust-${{ matrix.platform.runner }}-${{ matrix.python-version }}
50+
cache-targets: 'false'
51+
cache-all-crates: 'false'
52+
cache-workspace-crates: 'false'
53+
3854
- name: Rust tests (no default features)
3955
run: cargo test --no-default-features --verbose
4056

4157
- name: Rust tests
4258
run: cargo test --verbose
4359

44-
- uses: actions/cache@v4
45-
with:
46-
path: .venv
47-
key: pyenv-${{ matrix.platform.runner }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }}
48-
restore-keys: |
49-
pyenv-${{ matrix.platform.runner }}-${{ steps.setup_python.outputs.python-version }}-
50-
5160
- name: Setup venv
5261
run: |
5362
python -m venv .venv
@@ -56,7 +65,7 @@ jobs:
5665
${{ matrix.platform.python_exec }} -m pip install maturin mypy pytest pytest-asyncio
5766
- name: Python build
5867
run: |
59-
${{ matrix.platform.python_exec }} -m maturin develop -E all
68+
${{ matrix.platform.python_exec }} -m maturin develop --strip -E all
6069
- name: Python type check (mypy)
6170
run: |
6271
${{ matrix.platform.python_exec }} -m mypy python
@@ -68,6 +77,8 @@ jobs:
6877
runs-on: ubuntu-latest
6978
steps:
7079
- uses: actions/checkout@v4
80+
with:
81+
fetch-depth: 1
7182
- name: Install Rust toolchain
7283
uses: dtolnay/rust-toolchain@stable
7384
- uses: taiki-e/install-action@v2

.github/workflows/docs_test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 1
1820
- uses: actions/setup-node@v4
1921
with:
2022
cache: yarn

.github/workflows/format.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 1
3234
- uses: dtolnay/rust-toolchain@stable
3335
with:
3436
components: rustfmt
@@ -41,6 +43,8 @@ jobs:
4143
runs-on: ubuntu-latest
4244
steps:
4345
- uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 1
4448
- uses: actions/setup-python@v5
4549
with:
4650
python-version: 3.11

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 1
2224
- run: ./.github/scripts/update_version.sh
2325
- uses: actions/upload-artifact@v4
2426
with:
@@ -30,6 +32,8 @@ jobs:
3032
needs: [create-versioned-toml]
3133
steps:
3234
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 1
3337
- uses: actions/download-artifact@v4
3438
with:
3539
name: Cargo.toml
@@ -61,6 +65,8 @@ jobs:
6165
- { os: windows, runner: windows-latest, target: x64 }
6266
steps:
6367
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 1
6470
- uses: actions/download-artifact@v4
6571
with:
6672
name: Cargo.toml
@@ -107,6 +113,8 @@ jobs:
107113
needs: [create-versioned-toml, generate-3p-notices]
108114
steps:
109115
- uses: actions/checkout@v4
116+
with:
117+
fetch-depth: 1
110118
- uses: actions/download-artifact@v4
111119
with:
112120
name: Cargo.toml
@@ -138,6 +146,8 @@ jobs:
138146
environment: release
139147
steps:
140148
- uses: actions/checkout@v4
149+
with:
150+
fetch-depth: 1
141151
- uses: actions/download-artifact@v4
142152
with:
143153
name: Cargo.toml

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ license = "Apache-2.0"
99

1010
[profile.release]
1111
codegen-units = 1
12+
strip = "symbols"
1213
lto = true
1314

1415
[lib]

0 commit comments

Comments
 (0)