Skip to content

Commit

Permalink
ci: Various improvements (#194)
Browse files Browse the repository at this point in the history
- Move from [rust-cache](https://github.com/Swatinem/rust-cache) to
[sccache](https://github.com/Mozilla-Actions/sccache-action). This has
helped in other crates, but I can't say I see an improvement yet. I'll
monitor it once it's being used.

- Move the python bindings to their own job. This is where most of the
CI time is being spent, so it makes sense to run it directly from the
beginning. I added a python cache and excluded this from the merge queue
checks.

- Stop testing on the rust `nightly` channel. This test is mostly to
report back any breaks but the cache gets invalidated daily, adding to
the CI times. Testing on `beta` should suffice.
  • Loading branch information
aborgna-q authored Oct 19, 2023
1 parent dcf789b commit 7b1e95c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
40 changes: 27 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "--cfg=ci_run"
MIRIFLAGS: '-Zmiri-permissive-provenance' # Required due to warnings in bitvec 1.0.1
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
check:
Expand All @@ -26,9 +28,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v0
- uses: mozilla-actions/[email protected]
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
Expand All @@ -46,9 +46,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v0
- uses: mozilla-actions/[email protected]
- name: Build benchmarks with no features
run: cargo bench --verbose --no-run --no-default-features
- name: Build benchmarks with all features
Expand All @@ -58,7 +56,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: ['1.70', stable, beta, nightly]
rust: ['1.70', stable, beta]
# workaround to ignore non-stable tests when running the merge queue checks
# see: https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6
isMerge:
Expand All @@ -68,8 +66,6 @@ jobs:
isMerge: true
- rust: beta
isMerge: true
- rust: nightly
isMerge: true
name: tests (Rust ${{ matrix.rust }})
steps:
- uses: actions/checkout@v3
Expand All @@ -79,9 +75,7 @@ jobs:
toolchain: ${{ matrix.rust }}
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v0-rust-${{ matrix.rust }}
- uses: mozilla-actions/[email protected]
- name: Build with no features
run: cargo test --verbose --no-default-features --no-run
- name: Tests with no features
Expand All @@ -90,10 +84,30 @@ jobs:
run: cargo test --verbose --all-features --no-run
- name: Tests with all features
run: cargo test --verbose --all-features
- name: Test pyo3 bindings

py-tests:
# Not required, we can ignore it for the merge queue check.
if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
name: "python bindings"
steps:
- uses: actions/checkout@v3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: mozilla-actions/[email protected]
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Build pyo3 bindings
run: |
pip install -r requirements.txt
cd pyrs
maturin build
pip install ../target/wheels/*.whl
- name: Test pyo3 bindings
run: |
cd pyrs
pytest
6 changes: 3 additions & 3 deletions .github/workflows/unsoundness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "--cfg=ci_run"
MIRIFLAGS: '-Zmiri-permissive-provenance' # Required due to warnings in bitvec 1.0.1
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:

Expand All @@ -24,8 +26,6 @@ jobs:
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v0-miri
- uses: mozilla-actions/[email protected]
- name: Test with Miri
run: cargo miri test

0 comments on commit 7b1e95c

Please sign in to comment.