-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 1.94 KB
/
pytest-workflow.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
name: Pytest Workflow
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- 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: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
activate-environment: SMARTER-database
channel-priority: strict
environment-file: conda-linux-64.lock
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Cache poetry
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: /.cache/pypoetry
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
${{ runner.os }}-
- name: Conda info
shell: bash -l {0}
run: conda info
- name: Install dependencies
shell: bash -l {0}
run: |
make requirements
pip install coveralls
- name: Conda list
shell: pwsh
run: conda list
- name: Test with coverage
shell: bash -l {0}
run: coverage run --source src -m pytest
- name: Uploading coverage to coveralls
shell: bash -l {0}
run: coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}