-
Notifications
You must be signed in to change notification settings - Fork 38
81 lines (79 loc) · 2.54 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
81
# Test strax on each PR
name: tests
# Trigger this code when a new release is published
on:
workflow_dispatch:
release:
types: [ created ]
pull_request:
branches:
- master
- stable
push:
branches:
- master
jobs:
update:
name: "${{ matrix.test }}_py${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10"]
test: ['coveralls', 'pytest']
# Installation on py3.10 is rather slow at the moment
exclude:
- python-version: "3.10"
test: coveralls
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'extra_requirements/requirements-tests.txt'
- name: Install requirements
run: pip install -r extra_requirements/requirements-tests.txt
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.9.0
with:
mongodb-version: 4.2
# Perform coveralls (if coverage is set to True) or pytest
- name: Test package
if: matrix.test == 'pytest'
env:
TEST_MONGO_URI: 'mongodb://localhost:27017/'
run: |
pytest -v --durations 0
- name: Coverage run
if: matrix.test == 'coveralls'
env:
NUMBA_DISABLE_JIT: 1
TEST_MONGO_URI: 'mongodb://localhost:27017/'
run: |
coverage run --source=strax setup.py test -v
- name: Coverage run - backward compatibility check with straxen
if: matrix.test == 'coveralls'
env:
NUMBA_DISABLE_JIT: 1
TEST_MONGO_URI: 'mongodb://localhost:27017/'
run: |
echo "clone straxen"
straxen_dir="../straxen/"
git clone --single-branch --branch master https://github.com/XENONnT/straxen.git $straxen_dir
bash $straxen_dir/.github/scripts/create_pre_apply_function.sh $HOME
pip install -e $straxen_dir # Reinstall since tests might reflect new code.
echo "Run straxen tests"
coverage run --append --source=strax -m pytest $straxen_dir
coverage report
- name: Coveralls upload
if: matrix.test == 'coveralls'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage report
coveralls --service=github
- name: goodbye
run: echo goodbye