Skip to content

General spliner class #101

General spliner class

General spliner class #101

Workflow file for this run

name: Rust tests
on:
push:
branches: [master]
pull_request:
# Check all PR
concurrency:
group: rust-tests-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
tests:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / rust ${{ matrix.rust-version }} ${{ matrix.extra-name }}
container: ${{ matrix.container }}
strategy:
matrix:
include:
- os: ubuntu-20.04
rust-version: stable
rust-target: x86_64-unknown-linux-gnu
build-type: debug
test-static-lib: true
extra-name: / static C library
- os: ubuntu-20.04
rust-version: stable
rust-target: x86_64-unknown-linux-gnu
build-type: release
cargo-build-flags: --release
do-valgrind: true
extra-name: / release valgrind
# check the build on a stock Ubuntu 20.04, including cmake 3.16
- os: ubuntu-20.04
rust-version: "1.64"
container: ubuntu:20.04
rust-target: x86_64-unknown-linux-gnu
build-type: debug
extra-name: / cmake 3.16
- os: macos-11
rust-version: stable
rust-target: x86_64-apple-darwin
build-type: debug
steps:
- name: install dependencies in container
if: matrix.container == 'ubuntu:20.04'
run: |
apt update
apt install -y software-properties-common
apt install -y cmake make gcc g++ git curl python3-pip python3-venv
ln -s /usr/bin/python3 /usr/bin/python
- name: free disk space
if: matrix.os == 'ubuntu-20.04'
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android || true
- uses: actions/checkout@v3
- name: setup Python
uses: actions/setup-python@v4
if: "!matrix.container"
with:
python-version: "3.11"
- name: setup rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: ${{ matrix.rust-target }}
- name: install valgrind
if: matrix.do-valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Setup sccache environnement variables
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
- name: unit tests
run: cargo test --lib --target ${{ matrix.rust-target }} ${{ matrix.cargo-build-flags }}
- name: documentation tests
run: cargo test --doc --target ${{ matrix.rust-target }} ${{ matrix.cargo-build-flags }}
- name: integration tests
env:
RASCALINE_TEST_WITH_STATIC_LIB: ${{ matrix.test-static-lib || 0 }}
run: |
cargo test --test "*" --package rascaline --target ${{ matrix.rust-target }} ${{ matrix.cargo-build-flags }}
cargo test --test "*" --package rascaline-c-api --target ${{ matrix.rust-target }} ${{ matrix.cargo-build-flags }}
# second set of jobs checking that (non-test) code still compiles/run as expected
prevent-bitrot:
runs-on: ubuntu-20.04
name: check examples / benchmarks
strategy:
matrix:
include:
- rust-version:
rust-target:
steps:
- uses: actions/checkout@v3
- name: setup rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Setup sccache environnement variables
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> $GITHUB_ENV
- name: check that examples compile & run
run: cargo run --release --example compute-soap -- rascaline/examples/data/water.xyz
- name: check that benchmarks compile and run once
run: cargo bench -- --test
# third set of jobs checking containing basic rust linting
lint-rust:
runs-on: ubuntu-20.04
name: Lint Rust code
strategy:
matrix:
include:
- rust-version: stable
rust-target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: setup rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
target: ${{ matrix.rust-target }}
- name: install dependencies
run: |
wget https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz
tar xf ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz
echo "$(pwd)/ripgrep-13.0.0-x86_64-unknown-linux-musl" >> $GITHUB_PATH
- name: check for leftover dbg!
run: |
# use ripgrep (rg) to check for instances of `dbg!` in rust files.
# rg will return 1 if it fails to find a match, so we invert it again
# with the `!` builtin to get the error/success in CI
! rg "dbg!" --type=rust --quiet