Create selection on device in metatensor-core #4226
Workflow file for this run
This file contains hidden or 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 tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| # Check all PR | |
| concurrency: | |
| group: rust-tests-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| rust-tests: | |
| name: ${{ matrix.os }} / Rust ${{ matrix.rust-version }}${{ matrix.extra-name }} | |
| runs-on: ${{ matrix.os }} | |
| container: ${{ matrix.container }} | |
| defaults: | |
| run: | |
| shell: "bash" | |
| env: | |
| CMAKE_CXX_COMPILER: ${{ matrix.cxx }} | |
| CMAKE_C_COMPILER: ${{ matrix.cc }} | |
| CMAKE_GENERATOR: ${{ matrix.cmake-generator }} | |
| strategy: | |
| matrix: | |
| include: | |
| # test without any feature (i.e shared build) | |
| - os: ubuntu-24.04 | |
| rust-version: stable | |
| rust-target: x86_64-unknown-linux-gnu | |
| extra-name: ", no features" | |
| cxx: g++ | |
| cc: gcc | |
| cmake-generator: Unix Makefiles | |
| # test with all features (i.e static build + rayon + bench) | |
| - os: ubuntu-24.04 | |
| rust-version: stable | |
| rust-target: x86_64-unknown-linux-gnu | |
| cargo-build-flags: --release --all-features | |
| do-valgrind: true | |
| extra-name: ", all features, release" | |
| cxx: g++ | |
| cc: gcc | |
| cmake-generator: Unix Makefiles | |
| # check the build on a stock Ubuntu 22.04, which uses cmake 3.22, and | |
| # with our minimal supported rust version | |
| - os: ubuntu-24.04 | |
| rust-version: 1.74 | |
| container: ubuntu:22.04 | |
| rust-target: x86_64-unknown-linux-gnu | |
| cargo-build-flags: --features=rayon | |
| extra-name: ", cmake 3.22" | |
| cxx: g++ | |
| cc: gcc | |
| cmake-generator: Unix Makefiles | |
| - os: macos-15 | |
| rust-version: stable | |
| rust-target: aarch64-apple-darwin | |
| cargo-build-flags: --features=rayon | |
| extra-name: "" | |
| cxx: clang++ | |
| cc: clang | |
| cmake-generator: Unix Makefiles | |
| - os: windows-2022 | |
| rust-version: stable | |
| rust-target: x86_64-pc-windows-msvc | |
| cargo-build-flags: --features=rayon | |
| extra-name: " / MSVC" | |
| cxx: cl.exe | |
| cc: cl.exe | |
| cmake-generator: Visual Studio 17 2022 | |
| - os: windows-2022 | |
| rust-version: stable | |
| rust-target: x86_64-pc-windows-gnu | |
| cargo-build-flags: --features=rayon | |
| extra-name: " / MinGW" | |
| cxx: g++.exe | |
| cc: gcc.exe | |
| cmake-generator: MinGW Makefiles | |
| steps: | |
| - name: install dependencies in container | |
| if: matrix.container == 'ubuntu:22.04' | |
| run: | | |
| apt update | |
| apt install -y software-properties-common | |
| apt install -y cmake make gcc g++ git curl python3-venv | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure git safe directory | |
| if: matrix.container == 'ubuntu:22.04' | |
| run: git config --global --add safe.directory /__w/metatensor/metatensor | |
| - name: setup rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust-version }} | |
| target: ${{ matrix.rust-target }} | |
| - name: Cache Rust dependencies | |
| uses: Leafwing-Studios/cargo-cache@v2.6.1 | |
| with: | |
| sweep-cache: true | |
| - name: install valgrind | |
| if: matrix.do-valgrind | |
| run: | | |
| sudo apt-get install -y valgrind | |
| - name: Setup sccache | |
| if: ${{ !env.ACT }} | |
| uses: mozilla-actions/sccache-action@v0.0.10 | |
| with: | |
| version: "v0.15.0" | |
| - name: Setup sccache environnement variables | |
| if: ${{ !env.ACT }} | |
| 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: Build the code | |
| run: | | |
| cargo build --package metatensor --package metatensor-core --target ${{ matrix.rust-target }} ${{ matrix.cargo-build-flags }} | |
| - name: check that the header is already generated and up to date | |
| run: | | |
| git diff --exit-code | |
| - name: run tests | |
| run: | | |
| cargo test --package metatensor --package metatensor-core --target ${{ matrix.rust-target }} ${{ matrix.cargo-build-flags }} | |
| - name: check that the code can be compiled as a standalone crate | |
| if: matrix.os != 'windows-2022' | |
| run: | | |
| ./scripts/package-core.sh rust/metatensor-sys/ | |
| cd rust/metatensor-sys | |
| cargo package --target ${{ matrix.rust-target }} --allow-dirty |