Skip to content

Some minor optimizations #1190

Some minor optimizations

Some minor optimizations #1190

Workflow file for this run

name: argmin CI
on:
pull_request:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
tests-argmin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test (default features)
run: cargo test -p argmin
- name: Test (all features)
run: cargo test -p argmin --all-features
tests-argmin-serde1-feature:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test (no default features)
run: cargo test -p argmin --no-default-features
- name: Test with serde1 feature
run: cargo test -p argmin --no-default-features --features "serde1"
tests-argmin-observer-slog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test without default features
run: cargo test -p argmin-observer-slog --no-default-features
- name: Test with serde1 feature
run: cargo test -p argmin-observer-slog --no-default-features --features "serde1"
tests-argmin-observer-paramwriter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test
run: cargo test -p argmin-observer-paramwriter
tests-argmin-checkpointing-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test
run: cargo test -p argmin-checkpointing-file
tests-argmin-observer-spectator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test (spectator observer)
run: cargo test -p argmin-observer-spectator
- name: Test (spectator)
run: cargo test -p spectator
tests-argmin-testfunctions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test (testfunctions)
run: cargo test -p argmin_testfunctions
tests-finitediff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: Test (testfunctions)
run: cargo test -p finitediff --all-features
tests-argmin-math:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
# NOTE: These are in series on purpose, in the hope that not everything
# has to be recompiled every time.
# Default features
- name: argmin-math (primitives)
run: cargo test -p argmin-math --no-default-features --features "primitives"
- name: argmin-math (vec)
run: cargo test -p argmin-math --no-default-features --features "vec"
# ndarray without linalg
- name: argmin-math (ndarray_latest-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest-nolinalg"
- name: argmin-math (ndarray_v0_15-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_15-nolinalg"
- name: argmin-math (ndarray_v0_14-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14-nolinalg"
- name: argmin-math (ndarray_v0_13-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-nolinalg"
# ndarray with linalg
- name: argmin-math (ndarray_latest)
run: cargo test --manifest-path ./crates/argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml
- name: argmin-math (ndarray_v0_15)
run: cargo test --manifest-path ./crates/argmin-math/ndarray-linalg-tests/ndarray_0_15/Cargo.toml
- name: argmin-math (ndarray_v0_14)
run: cargo test --manifest-path ./crates/argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml
- name: argmin-math (ndarray_v0_13)
run: cargo test --manifest-path ./crates/argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml
# nalgebra
- name: argmin-math (nalgebra_latest)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_latest"
- name: argmin-math (nalgebra_v0_32)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_32"
- name: argmin-math (nalgebra_v0_31)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_31"
- name: argmin-math (nalgebra_v0_30)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_30"
- name: argmin-math (nalgebra_v0_29)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_29"
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@beta
with:
components: clippy
- name: Clippy (argmin-math)
run: cargo clippy -p argmin-math --all-targets --features "primitives,vec,nalgebra_latest,ndarray_latest" -- -D warnings
- name: Clippy (argmin) with all features
run: cargo clippy -p argmin --all-targets --features "_full_dev" -- -D warnings
- name: Clippy (argmin-observer-slog)
run: cargo clippy -p argmin-observer-slog --all-targets --features "serde1" -- -D warnings
- name: Clippy (argmin-observer-paramwriter)
run: cargo clippy -p argmin-observer-paramwriter --all-targets -- -D warnings
- name: Clippy (argmin-observer-spectator)
run: cargo clippy -p argmin-observer-spectator --all-targets -- -D warnings
- name: Clippy (argmin-checkpointing-file)
run: cargo clippy -p argmin-checkpointing-file --all-targets -- -D warnings
- name: Clippy (spectator)
run: cargo clippy -p spectator --all-targets -- -D warnings
- name: Clippy (examples)
run: cargo clippy -p 'example-*' --all-targets --all-features -- -D warnings
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@beta
with:
components: rustfmt
- run: cargo fmt --all -- --check
docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
- name: argmin docs
run: cargo rustdoc -p argmin --all-features -- -D warnings
- name: argmin-math docs
run: cargo rustdoc -p argmin-math --features "latest_all" -- -D warnings
wasm-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown,wasm32-unknown-emscripten,wasm32-wasi
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build target wasm32-unknown-unknown
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --exclude "example-*" --exclude argmin-testfunctions-py --target wasm32-unknown-unknown --features wasm-bindgen
- name: Build target wasm32-wasi with feature wasm-bindgen
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --exclude "example-*" --exclude argmin-testfunctions-py --target wasm32-wasi --features wasm-bindgen
- name: Build target wasm32-unknown-emscripten
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --exclude "example-*" --exclude argmin-testfunctions-py --target wasm32-unknown-emscripten --no-default-features --features wasm-bindgen
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}