-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (64 loc) · 2.26 KB
/
pytest_and_coverage.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
name: Test and coverage
on: [push]
jobs:
build:
strategy:
matrix:
runs-on: [macos-latest, windows-latest, ubuntu-latest]
python-version: [3.8, 3.9, '3.10', '3.11']
runs-on: ${{ matrix.runs-on }}
env:
MPLBACKEND: Agg
USE_COVERAGE: ${{ matrix.runs-on == 'ubuntu-latest' && matrix.python-version == '3.10' }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setting up OpenMP for Linux
if: matrix.runs-on == 'ubuntu-latest'
run: |
sudo apt-get update; sudo apt-get install -y libomp5 libomp-dev
- name: Setting up OpenMP for MAC-OS
if: matrix.runs-on == 'macos-latest'
run: |
brew update
brew install libomp
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r ci_requirements.txt
python3 -m pip install --upgrade -r ci_requirements.txt
- name: Install module for coverage
if: env.USE_COVERAGE == 'true'
run: |
export CYTHON_TRACE_NOGIL=1
python3 setup.py build_ext --inplace --force --define CYTHON_TRACE_NOGIL
- name: Install module
if: env.USE_COVERAGE == 'false'
run: |
python3 -m pip install .
# - name: Lint with flake8
# run: |
# pip install flake8
# # stop the build if there are Python syntax errors or undefined names
# flake8 ./compmech --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 ./compmech --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest and coverage report
if: env.USE_COVERAGE == 'true'
run: |
coverage run -m pytest compmech
coverage report
- name: Test with pytest
if: env.USE_COVERAGE == 'false'
run: |
pytest compmech
- name: Upload coverage to Codecov
if: env.USE_COVERAGE == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}
fail_ci_if_error: true
verbose: true