Skip to content

deps: diffsl 0.8.3 (#230) #781

deps: diffsl 0.8.3 (#230)

deps: diffsl 0.8.3 (#230) #781

Workflow file for this run

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
LLVM_VERSION: "17"
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: ${{ matrix.basename }} - ${{ matrix.os }} - ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
book:
- false
coverage:
- false
experimental:
- false
clippy:
- false
rustdoc:
- false
tests:
- true
toolchain:
- stable
basename:
- Tests
os:
- ubuntu-latest
- macos-latest
- macos-15-intel
- windows-latest
include:
- toolchain: stable
os: ubuntu-latest
tests: false
clippy: false
experimental: true
basename: Coverage
coverage: true
book: false
- toolchain: stable
os: ubuntu-latest
tests: false
clippy: false
experimental: false
basename: Book
coverage: false
book: true
- toolchain: beta
os: ubuntu-latest
experimental: true
tests: true
basename: Tests
coverage: false
book: false
- toolchain: nightly
os: ubuntu-latest
tests: true
experimental: true
basename: Tests
coverage: false
book: false
- toolchain: stable
os: ubuntu-latest
tests: false
clippy: true
experimental: true
basename: Clippy
coverage: false
book: false
- toolchain: nightly
os: ubuntu-latest
tests: false
rustdoc: true
experimental: true
basename: Rustdoc
coverage: false
book: false
steps:
- uses: actions/checkout@v4
- name: Extract README code example
run: python3 ./.github/workflows/extract_readme_code.py
- uses: actions/cache@v4
with:
path: |
${{ env.CARGO_HOME }}
target
key: diffsol-${{ runner.os }}-${{ matrix.toolchain}}-coverage${{ matrix.coverage }}-book${{ matrix.book }}-llvm17
- 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-latest') && matrix.book == false
with:
version: ${{ env.LLVM_VERSION }}
- name: Install LLVM for macOS Intel (Homebrew)
if: matrix.os == 'macos-15-intel' && matrix.book == false
run: |
brew install llvm@${{ env.LLVM_VERSION }}
echo /usr/local/opt/llvm@${{ env.LLVM_VERSION }}/bin >> $GITHUB_PATH
- name: Set features variable and install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest' && matrix.book == false
run: |
echo "ADDITIONAL_FEATURES_FLAGS=--features diffsl-llvm17 --features diffsl-cranelift --features suitesparse" >> $GITHUB_ENV
sudo apt-get update
sudo apt-get install -y libsuitesparse-dev
- name: Install Trunk
uses: jetli/trunk-action@v0.4.0
if: matrix.book == true
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
if: matrix.book == true
with:
mdbook-version: 'latest'
- name: Install tarpaulin
if: matrix.coverage == true
run: cargo install cargo-tarpaulin
- name: Set features variable and install dependencies (macOS)
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest'
run: |
echo "ADDITIONAL_FEATURES_FLAGS=--features diffsl-llvm17 --features diffsl-cranelift" >> $GITHUB_ENV
- name: Set features variable and install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "ADDITIONAL_FEATURES_FLAGS=--features diffsl-cranelift" >> $GITHUB_ENV
- name: Free Disk Space (Ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: jlumbroso/free-disk-space@main
with:
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Run tests - default features
if: matrix.tests == true
run: cargo test --verbose
- name: Run tests - all features (macOS Intel)
if: matrix.tests == true && matrix.os == 'macos-15-intel'
run: cargo test --verbose ${{ env.ADDITIONAL_FEATURES_FLAGS || '' }} --workspace --exclude neural-ode-weather-prediction
- name: Run tests - all features
if: matrix.tests == true && matrix.os != 'macos-15-intel'
run: cargo test --verbose ${{ env.ADDITIONAL_FEATURES_FLAGS || '' }} --workspace
- name: Clippy - all features
if: matrix.clippy == true
run: cargo clippy --verbose ${{ env.ADDITIONAL_FEATURES_FLAGS || ''}} --workspace
- name: Docs - all features
if: matrix.rustdoc == true
run: cargo rustdoc -p diffsol ${{ env.ADDITIONAL_FEATURES_FLAGS || ''}}
- name: Build book and wasm examples
if: matrix.book == true
run: |
mdbook build book
rustup target add wasm32-unknown-unknown
cd examples/population-dynamics-wasm-yew
mkdir -p ${{ github.workspace }}/book/book/examples/population-dynamics-wasm-yew
trunk build --release --public-url /diffsol/examples/population-dynamics-wasm-yew/ --dist ${{ github.workspace }}/book/book/examples/population-dynamics-wasm-yew
- name: Generate coverage report
if: matrix.coverage == true
run: cargo tarpaulin --out Xml --packages diffsol ${{ env.ADDITIONAL_FEATURES_FLAGS || '' }}
- name: Upload coverage
uses: codecov/codecov-action@v5
if: matrix.coverage == true
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: cobertura.xml
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
if: matrix.book == true
with:
path: "book/book/"
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4