range check #522
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
# We aim to always test with the latest stable Rust toolchain, however we pin to a specific | |
# version like 1.70. Note that we only specify MAJOR.MINOR and not PATCH so that bugfixes still | |
# come automatically. If the version specified here is no longer the latest stable version, | |
# then please feel free to submit a PR that adjusts it along with the potential clippy fixes. | |
RUST_STABLE_VER: "1.81" # In quotes because otherwise (e.g.) 1.70 would be interpreted as 1.7 | |
# The purpose of checking with the minimum supported Rust toolchain is to detect its staleness. | |
# If the compilation fails, then the version specified here needs to be bumped up to reality. | |
# Be sure to also update the rust-version property in the workspace Cargo.toml file, | |
# plus all the README.md files of the affected packages. | |
RUST_MIN_VER: "1.79" | |
# List of packages that will be checked with the minimum supported Rust version. | |
# This should be limited to packages that are intended for publishing. | |
RUST_MIN_VER_PKGS: "-p algebra -p lattice -p fhe_core -p zkfhe" | |
CARGO_TERM_COLOR: always | |
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
merge_group: | |
# We run on push, even though the commit is the same as when we ran in merge_group. | |
# This allows the cache to be primed. | |
# See https://github.com/orgs/community/discussions/66430 | |
push: | |
branches: | |
- main | |
jobs: | |
fmt: | |
name: formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install stable toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_STABLE_VER }} | |
components: rustfmt | |
- name: cargo fmt | |
run: cargo fmt --all --check | |
clippy-stable: | |
name: cargo clippy | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# os: [windows-latest, macos-latest, ubuntu-latest] | |
os: [macos-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.event_name != 'merge_group' }} | |
- name: install stable toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_STABLE_VER }} | |
components: clippy | |
- name: install cargo-hack | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack | |
- name: cargo clippy | |
run: cargo hack clippy --workspace --each-feature --skip nightly --optional-deps -- -D warnings | |
- name: cargo clippy (auxiliary) | |
run: cargo hack clippy --workspace --each-feature --skip nightly --optional-deps --tests --benches --examples -- -D warnings | |
test-stable: | |
name: cargo test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: [windows-latest, macos-latest, ubuntu-latest] | |
os: [macos-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
# We intentionally do not use lfs: true here, instead using the caching method to save LFS bandwidth. | |
- name: restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.event_name != 'merge_group' }} | |
- name: install stable toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_STABLE_VER }} | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-nextest | |
- name: cargo test | |
run: cargo nextest run --workspace --no-default-features | |
- name: cargo test | |
run: cargo nextest run --workspace | |
check-msrv: | |
name: cargo check (msrv) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# os: [windows-latest, macos-latest, ubuntu-latest] | |
os: [macos-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.event_name != 'merge_group' }} | |
- name: install msrv toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_MIN_VER }} | |
- name: install cargo-hack | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack | |
- name: cargo check | |
run: cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --each-feature --skip nightly --optional-deps | |
doc: | |
name: cargo doc | |
# NOTE: We don't have any platform specific docs in this workspace, so we only run on Ubuntu. | |
# If we get per-platform docs (win/macos/linux/wasm32/..) then doc jobs should match that. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.event_name != 'merge_group' }} | |
- name: install nightly toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: cargo test doc | |
run: cargo test --doc --workspace --all-features | |
# We test documentation using nightly to match docs.rs. This prevents potential breakages | |
- name: cargo doc | |
run: cargo doc --workspace --no-default-features --features="count_ntt concrete-ntt" --no-deps --document-private-items -Zunstable-options -Zrustdoc-scrape-examples | |
# If this fails, consider changing your text or adding something to .typos.toml | |
typos: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: check typos | |
uses: crate-ci/[email protected] |