-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (98 loc) · 3.2 KB
/
run-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: 🧪 Test
on:
push:
branches:
- "**"
pull_request:
branches:
- main
jobs:
run-tests-rust:
name: Run tests (Rust)
runs-on: ubuntu-latest
strategy:
matrix:
rust-version: ["stable"]
mpi: ['mpich', 'openmpi']
steps:
- name: Get latest rlst commit id
id: rlst-commit
run: |
echo "commit=$(git ls-remote https://github.com/linalg-rs/rlst.git HEAD | cut -d' ' -f1)" >> $GITHUB_OUTPUT
- name: Restore cached dependencies
id: cache
uses: actions/cache/restore@v3
with:
path: |
target/*/deps/*rlst*
target/*/deps/*lapack*
key: rlst-${{ steps.rlst-commit.output.commit }}-${{ matrix.mpi }}
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-version }}
components: rustfmt
- name: Set up MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpi }}
- name: Install cargo-mpirun
run: cargo install cargo-mpirun
- uses: actions/checkout@v3
- name: Install LAPACK & OpenBLAS
run:
sudo apt-get install libopenblas-dev liblapack-dev
- name: Style checks
run: |
cargo fmt -- --check
cargo clippy -- -D warnings
cargo clippy --tests -- -D warnings
cargo clippy --examples -- -D warnings
- name: Build rust library
run: cargo build --features "strict"
- name: Run unit tests
run: cargo test --lib --features "strict"
- name: Run unit tests (release)
run: cargo test --lib --release --features "strict"
- name: Run unit tests (with mpi enabled)
run: cargo test --lib --features "mpi,strict"
- name: Run unit tests (release with mpi enabled)
run: cargo test --lib --release --features "mpi,strict"
- name: Run tests
run: cargo test --examples --release --features "mpi,strict"
- name: Run examples
run: |
python3 find_examples.py
chmod +x examples.sh
./examples.sh
- name: Build docs
run: cargo doc --features "strict" --no-deps
- name: Cache dependencies
uses: actions/cache/save@v3
with:
path: |
target/*/deps/*rlst*
target/*/deps/*lapack*
key: ${{ steps.cache.outputs.cache-primary-key }}
run-tests-python:
name: Run tests (Python)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Install Python requirements
run: python3 -m pip install pytest-xdist flake8
- name: Style checks
run: |
python3 -m flake8 python/test
- name: Install tomllib (for Python <3.11)
run: python3 -m pip install tomli
if: ${{ matrix.python-version == '3.7' || matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10' }}
- run: python3 -m pytest -n=auto python/test
name: Run tests