-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We now commit `Cargo.lock` for MSRV development and testing, in line with modern Rust library development practice.
- Loading branch information
Showing
6 changed files
with
343 additions
and
79 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,104 @@ | ||
name: CI checks | ||
|
||
on: [push, pull_request] | ||
on: | ||
pull_request: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
test-msrv: | ||
name: Test MSRV on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.56.0 | ||
override: true | ||
|
||
# Ensure all code has been formatted with rustfmt | ||
- run: rustup component add rustfmt | ||
- name: Check formatting | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: -- --check --color always | ||
- uses: actions/checkout@v4 | ||
- name: Run tests | ||
run: cargo test --verbose --all-features | ||
- name: Run tests (without bitvec) | ||
run: cargo test --verbose --no-default-features --features derive | ||
- name: Verify working directory is clean | ||
run: git diff --exit-code | ||
|
||
test: | ||
name: Test on ${{ matrix.os }} | ||
test-latest: | ||
name: Test latest on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.56.0 | ||
override: true | ||
- name: cargo fetch | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fetch | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
id: toolchain | ||
- run: rustup override set ${{steps.toolchain.outputs.name}} | ||
- name: Remove lockfile to build with latest dependencies | ||
run: rm Cargo.lock | ||
- name: Run tests | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --verbose --all-features | ||
run: cargo test --verbose --all-features | ||
- name: Run tests (without bitvec) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --verbose --no-default-features --features derive | ||
run: cargo test --verbose --no-default-features --features derive | ||
- name: Verify working directory is clean (excluding lockfile) | ||
run: git diff --exit-code ':!Cargo.lock' | ||
|
||
no-std: | ||
name: Check no-std compatibility | ||
build-nodefault: | ||
name: Build target ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
target: | ||
- wasm32-wasi | ||
- thumbv6m-none-eabi | ||
- thumbv7em-none-eabihf | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
with: | ||
toolchain: 1.56.0 | ||
override: true | ||
- run: rustup target add thumbv6m-none-eabi | ||
- name: cargo fetch | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fetch | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --verbose --target thumbv6m-none-eabi --no-default-features | ||
- name: Build with bits feature | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --verbose --target thumbv6m-none-eabi --no-default-features --features bits | ||
path: crate_root | ||
# We use a synthetic crate to ensure no dev-dependencies are enabled, which can | ||
# be incompatible with some of these targets. | ||
- name: Create synthetic crate for testing | ||
run: cargo init --edition 2021 --lib ci-build | ||
- name: Copy Rust version into synthetic crate | ||
run: cp crate_root/rust-toolchain.toml ci-build/ | ||
- name: Copy patch directives into synthetic crate | ||
run: | | ||
echo "[patch.crates-io]" >> ./ci-build/Cargo.toml | ||
cat ./crate_root/Cargo.toml | sed "0,/.\+\(patch.crates.\+\)/d" >> ./ci-build/Cargo.toml | ||
- name: Add no_std pragma to lib.rs | ||
run: | | ||
echo "#![no_std]" > ./ci-build/src/lib.rs | ||
- name: Add ff as a dependency of the synthetic crate | ||
working-directory: ./ci-build | ||
# run: cargo add --no-default-features --path ../crate_root | ||
run: sed -i 's;\[dependencies\];\[dependencies\]\nff = { path = "../crate_root", default-features = false };g' ./Cargo.toml | ||
- name: Add target | ||
working-directory: ./ci-build | ||
run: rustup target add ${{ matrix.target }} | ||
- name: Build for target | ||
working-directory: ./ci-build | ||
run: cargo build --verbose --target ${{ matrix.target }} | ||
- name: Enable the bits feature of ff | ||
working-directory: ./ci-build | ||
# run: cargo add --no-default-features --features bits --path ../crate_root | ||
run: sed -i 's;ff = { path = "../crate_root", default-features = false };ff = { path = "../crate_root", default-features = false, features = ["bits"] };g' ./Cargo.toml | ||
- name: Build for target with the bits feature | ||
working-directory: ./ci-build | ||
run: cargo build --verbose --target ${{ matrix.target }} | ||
|
||
doc-links: | ||
name: Documentation | ||
name: Intra-doc links | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.56.0 | ||
override: true | ||
- name: cargo fetch | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fetch | ||
|
||
- uses: actions/checkout@v4 | ||
- run: cargo fetch | ||
# Requires #![deny(rustdoc::broken_intra_doc_links)] in crates. | ||
- run: sudo apt-get -y install libfontconfig1-dev | ||
- name: Check intra-doc links | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: doc | ||
args: --document-private-items | ||
run: cargo doc --all-features --document-private-items | ||
|
||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: cargo fmt -- --check |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
target/ | ||
**/*.rs.bk | ||
Cargo.lock |
Oops, something went wrong.