Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and expand CI jobs #215

Merged
merged 9 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 43 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,55 @@ on:
pull_request:
branches: [ master ]

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"

jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable with clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Run cargo clippy
run: cargo clippy --all-targets

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust nightly with rustfmt
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt

- name: Run rustfmt --check
run: cargo fmt -- --check

test:
name: Test
needs: [clippy, fmt]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
toolchain: stable
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
toolchain: nightly
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, nightly]

steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
- name: Test nightly feature (if possible)
if: ${{ matrix.toolchain == 'nightly' }}
run: |
cargo test --target ${{ matrix.target }} --features=nightly
cargo test --target ${{ matrix.target }} --benches --features=nightly

- name: Test nightly feature
if: matrix.toolchain == 'nightly'
run: cargo test --all-targets --features=nightly

- name: Test default features
run: |
cargo test --target ${{ matrix.target }}
if: matrix.toolchain != 'nightly'
run: cargo test --all-targets

2 changes: 1 addition & 1 deletion src/distribution/cauchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ mod tests {
test_almost(0.0, 0.1, 0.9936346508990272, 1e-16, sf(-5.0));
test_almost(0.0, 0.1, 0.9682744825694465, 1e-16, sf(-1.0));
test_case(0.0, 0.1, 0.5, sf(0.0));
test_case(0.0, 0.1, 0.03172551743055352, sf(1.0));
test_almost(0.0, 0.1, 0.03172551743055352, 1e-16, sf(1.0));
test_case(0.0, 0.1, 0.006365349100972806, sf(5.0));
test_almost(0.0, 1.0, 0.9371670418109989, 1e-16, sf(-5.0));
test_case(0.0, 1.0, 0.75, sf(-1.0));
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mod tests {
#[test]
fn test_sync_send() {
// Error types should implement Sync and Send
let _ = assert_sync::<StatsError>();
let _ = assert_send::<StatsError>();
assert_sync::<StatsError>();
assert_send::<StatsError>();
}
}