-
Notifications
You must be signed in to change notification settings - Fork 18
70 lines (59 loc) · 2.03 KB
/
build_tests.yaml
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
name: Build & Tests
on:
push:
branches:
- main
- develop
- sims2cloud
pull_request:
branches:
- main
- develop
- sims2cloud
jobs:
core-unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- {python-version: 3.8, use_mpi: 'no-mpi'}
- {python-version: 3.8, use_mpi: 'mpi'}
- {python-version: 3.9, use_mpi: 'no-mpi'}
- {python-version: '3.10', use_mpi: 'no-mpi'}
env:
USE_MPI: ${{ matrix.config.use_mpi }}
# Please retain a cov score of ~96% to avoid unit tests marginally failing.
COVERAGE_FLAGS: "--cov=flamingpy --cov-report=xml --cov-report=term-missing --cov-fail-under=95"
XDIST_FLAGS: "-n auto --dist=loadfile"
steps:
- uses: actions/checkout@v2
- name: Setup python ${{ matrix.config.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config.python-version }}
- name: Get the latest pip
run: python -m pip install --upgrade pip
- name: Install compilation and testing requirements of flamingpy
run: |
if [ "$USE_MPI" == "mpi" ]; then
sudo apt install -y libopenmpi-dev
python -m pip install mpi4py>=3.1.3
fi
python -m pip install -r dev_requirements.txt
- name: Build flamingpy from Source
run: |
python setup.py develop
python setup.py build_cmake --inplace
- name: Run tests
run: |
python -m pytest tests/ $COVERAGE_FLAGS $XDIST_FLAGS
if [ "$USE_MPI" == "mpi" ]; then
mpirun -np 2 python flamingpy/simulations.py
fi
- name: Adjust coverage file for Codecov
run: bash <(sed -i 's/filename=\"/filename=\"flamingpy\//g' coverage.xml)
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml