version 0.5.1 #423
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
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_HOME: ${{ github.workspace }}/.cargo | |
RUSTFLAGS: -D warnings -A unused-imports | |
RUSTDOCFLAGS: -D warnings | |
RUST_BACKTRACE: full | |
jobs: | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update stable --no-self-update | |
- run: rustc -Vv | |
- run: cargo fmt --all -- --check | |
unit-tests: | |
name: Tests - ${{ matrix.os }} - ${{ matrix.toolchain }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
toolchain: | |
- stable | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
include: | |
- toolchain: beta | |
os: ubuntu-latest | |
- toolchain: nightly | |
os: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3.3.2 | |
with: | |
path: | | |
${{ env.CARGO_HOME }} | |
target | |
key: diffsol-${{ runner.os }}-${{ matrix.toolchain}} | |
- name: Set up Rust | |
run: rustup default ${{ matrix.toolchain }} && rustup update ${{ matrix.toolchain }} --no-self-update && rustup component add clippy | |
- name: Rust version | |
run: rustc -Vv | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v2 | |
if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13' || matrix.os == 'macos-latest' | |
with: | |
version: "16.0" | |
- name: Set features variable and install dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
echo "ADDITIONAL_FEATURES_FLAGS=--features diffsl-llvm16 --features sundials --features suitesparse" >> $GITHUB_ENV | |
sudo apt-get update | |
sudo apt-get install -y libsuitesparse-dev libsundials-dev | |
- name: Set features variable and install dependencies (macOS) | |
if: matrix.os == 'macos-13' || matrix.os == 'macos-latest' | |
run: | | |
echo "ADDITIONAL_FEATURES_FLAGS=--features diffsl-llvm16" >> $GITHUB_ENV | |
- name: Set features variable and install dependencies (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo "ADDITIONAL_FEATURES_FLAGS=--features diffsl" >> $GITHUB_ENV | |
- name: Run tests - default features | |
run: cargo test --verbose | |
- name: Run tests - all features | |
run: cargo test --verbose ${{ env.ADDITIONAL_FEATURES_FLAGS || '' }} | |
- name: Clippy - all features | |
if : matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' | |
run: cargo clippy --verbose ${{ env.ADDITIONAL_FEATURES_FLAGS || ''}} | |
- name: Docs - all features | |
if : matrix.os == 'ubuntu-latest' && matrix.toolchain == 'nightly' | |
run: cargo rustdoc ${{ env.ADDITIONAL_FEATURES_FLAGS || ''}} | |
book: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: 'latest' | |
- run: mdbook build book | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./book/book |