-
Notifications
You must be signed in to change notification settings - Fork 2
161 lines (137 loc) · 4.58 KB
/
tests.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#schema: https://github.com/softprops/github-actions-schemas/blob/master/workflow.json
name: "Test"
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
permissions:
id-token: write
actions: write
contents: read
packages: write
env:
ANNOY_COMPILER_ARGS: "-DANNOYLIB_MULTITHREADED_BUILD,-mno-avx512f"
jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
if: ${{ !github.event.act }}
with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "true"
do_not_skip: '["workflow_dispatch"]'
paths_filter: |
python:
paths:
- 'pyproject.toml'
- 'poetry.lock'
- 'src/pixelator/**'
- 'tests/**'
paths_ignore:
- 'tests/**/*.md'
test:
name: Test - python ${{ matrix.py }}
if: needs.pre_job.outputs.should_skip == '{}' || !fromJSON(needs.pre_job.outputs.paths_result).python.should_skip
runs-on: ubuntu-latest
needs: [pre_job]
strategy:
fail-fast: false
matrix:
py:
- "3.11"
- "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python environment - ${{ matrix.py }}
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.py }}
- uses: supplypike/setup-bin@v3
with:
uri: 'https://opengene.org/fastp/fastp'
name: 'fastp'
version: '0.23.2'
- name: Generate tox env for python version
uses: actions/github-script@v6
id: set_tox_env
with:
script: |
const pythonVersion = "${{ matrix.py }}"
const toxEnv = "py" + pythonVersion.replace(/\./g, '')
core.setOutput("tox_env", toxEnv)
- name: Install dependencies
run: |
python -m pip install --user pipx
python -m pipx ensurepath
pipx install poetry
pip install tox
poetry self add poetry-plugin-export
poetry export --output dev_requirements.txt --quiet --no-interaction --no-ansi --without-hashes --with dev
pip install -r dev_requirements.txt
pip install -e .
- name: Run test suite on local python version
run: tox -e ${{ steps.set_tox_env.outputs.tox_env }} --current-env
test-coverage:
name: "Check the test coverage"
runs-on: ubuntu-latest
needs:
- pre_job
if: needs.pre_job.outputs.should_skip == '{}' || !fromJSON(needs.pre_job.outputs.paths_result).python.should_skip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python environment
uses: ./.github/actions/setup-python
with:
python-version: "3.11"
- name: Create dependencies file
run: |
pip install poetry
poetry export --output requirements.txt --without-hashes --no-interaction --no-ansi --with dev
pip install -r requirements.txt
- name: Run test suite
run: |
pytest --cov=src/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-workflow:
name: Test small workflow - ${{ matrix.case }}
runs-on: ubuntu-latest
needs: [ pre_job ]
strategy:
fail-fast: false
matrix:
case:
- mpx_v1
- mpx_v2
if: needs.pre_job.outputs.should_skip == '{}' || !fromJSON(needs.pre_job.outputs.paths_result).python.should_skip
steps:
- uses: actions/checkout@v4
- name: Set up Python environment
uses: ./.github/actions/setup-python
with:
python-version: "3.11"
- uses: supplypike/setup-bin@v3
with:
uri: 'https://opengene.org/fastp/fastp'
name: 'fastp'
version: '0.23.2'
- name: Install dependencies
run: |
pip install poetry
poetry export --output requirements.txt --without-hashes --no-interaction --no-ansi --with dev
pip install -r requirements.txt
- name: Run workflow tests
run: |
pytest -s -m "workflow_test" --basetemp=/tmp/pytest-results tests/integration/test_small_${{ matrix.case }}.yaml --log-cli-level=DEBUG