-
Notifications
You must be signed in to change notification settings - Fork 63
163 lines (136 loc) · 5.09 KB
/
test.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
162
163
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: precommit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pre-commit
- name: Run pre-commit
run: |
pre-commit run --color=always --show-diff-on-failure --all-files
metrics:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.9', '3.11']
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
twine check dist/*
- name: Install package with test dependencies
run: |
pip install dist/*.whl
pip install '.[test,louvain]'
- name: Test with pytest
if: ${{ matrix.os != 'macos-latest'}}
run: |
pytest --cov=scib --cov-report=xml -vv --ignore=tests/integration/ --ignore=tests/metrics/rpy2 -vv
mv coverage.xml "$(echo 'coverage_metrics_${{ matrix.os }}_${{ matrix.python }}.xml' | sed 's/[^a-z0-9\.\/]/_/g')"
- name: Upload coverage to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: metrics
path: coverage_*.xml
rpy2:
runs-on: ${{ matrix.os }}
strategy:
matrix:
r: ['4.2']
python: ['3.10']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
- name: Install dependencies
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
python -m pip install --upgrade pip
pip install '.[test,rpy2]'
Rscript -e "install.packages('remotes')"
Rscript -e "remotes::install_github('theislab/kBET')"
- name: Test with pytest
run: |
pytest --cov=scib --cov-report=xml -vv --tb=native -k rpy2
mv coverage.xml "$(echo 'coverage_rpy2_${{ matrix.os }}_${{ matrix.python }}.xml' | sed 's/[^a-z0-9\.\/]/_/g')"
- name: Upload coverage to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: rpy2
path: coverage_*.xml
integration:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.9', '3.11']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[test,scanorama,scvi,harmony]'
- name: Test with pytest
run: |
pytest --cov=scib --cov-report=xml -vv --tb=native -k integration
mv coverage.xml "$(echo 'coverage_integration_${{ matrix.os }}_${{ matrix.python }}.xml' | sed 's/[^a-z0-9\.\/]/_/g')"
- name: Upload coverage to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: integration
path: coverage_*.xml
upload-codecov:
needs: [metrics, rpy2]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download coverage from GitHub Actions
uses: actions/download-artifact@v3
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: ${{ github.repository == 'theislab/scib' }}
verbose: true
- name: Delete coverage artifacts
uses: geekyeggo/delete-artifact@v4