-
Notifications
You must be signed in to change notification settings - Fork 8
80 lines (71 loc) · 2.68 KB
/
pytest.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
name: pytest
# Controls when the workflow will run
on: [push, pull_request, workflow_dispatch]
# Triggers the workflow on push or pull request events but only for the master branch
# workflow_dispatch allows you to run this workflow manually from the Actions tab
jobs:
test:
# The type of runner and python versions that the job will run on
strategy:
matrix:
os: [windows-latest, ubuntu-20.04, ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]
full-test:
- ${{ contains(github.ref, 'master') || contains(github.ref, 'main') || startsWith(github.ref, 'refs/heads/release') }}
exclude:
- full-test: false
python-version: "3.10"
- full-test: false
os: "ubuntu-20.04"
fail-fast: false
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Install python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Install module
- name: Install module
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install -y build-essential tcl-dev less
curl -LJO https://github.com/cea-hpc/modules/releases/download/v5.3.1/modules-5.3.1.tar.gz
tar xfz modules-5.3.1.tar.gz
cd modules-5.3.1
./configure
make
sudo make install
# Install dependencies
- name: Install dependencies
run: |
pip install -e .
pip install pytest pytest-cov
# Activate environment and run pytest
- name: Testing - Linux
if: runner.os == 'Linux'
run: |
set -o pipefail
source /usr/local/Modules/init/sh
pytest --cov=. -cov-config=jade.coveragerc --cov-report xml
env:
ACCESS_TOKEN_GITHUB: ${{ secrets.ACCESS_TOKEN_GITHUB }}
# Activate environment and run pytest
- name: Testing - Windows
if: runner.os == 'Windows'
run: |
pytest
env:
ACCESS_TOKEN_GITHUB: ${{ secrets.ACCESS_TOKEN_GITHUB }}
# Upload coverage to Codecov. Do it only for one case of the matrix.
- name: Upload coverage to Codecov
# do it only once for python 3.10
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}