-
Notifications
You must be signed in to change notification settings - Fork 7
53 lines (46 loc) · 1.68 KB
/
pytests.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
name: pytests
# Runs unit tests on:
# - any push to any branch
# - when a PR is opened/reopened - this is just for additional safety and covers the case of main -> develop PRs without new pushes
on:
push:
pull_request:
types: [opened, reopened]
jobs:
unit_test:
runs-on: ubuntu-latest
strategy:
matrix:
vars: [ {python-version: '3.9', sleep: '0s'}, {python-version: '3.10', sleep: '60s'},
{python-version: '3.11', sleep: '120s'}, {python-version: '3.12', sleep: '180s'} ]
name: Python ${{ matrix.vars.python-version }} Test
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Cache conda
uses: actions/cache@v4
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('environment.yml') }}
- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
with:
create-args: >-
python=${{ matrix.vars.python-version }}
pytest
environment-file: environment.yml
generate-run-shell: true
- name: Sleep for ${{ matrix.vars.sleep }} to avoid multiple pytests run concurrently
uses: jakejarvis/wait-action@master
with:
time: ${{ matrix.vars.sleep }}
- name: Run tests with pytest
run: |
echo "${{secrets.PYTEST_USER_TOKEN}}" > tests/pyincore/.incorepw
python -m pytest --ignore=tests/test_format.py --ignore=tests/pyincore/analyses
shell: micromamba-shell {0}