6
6
push :
7
7
branches :
8
8
- master
9
+ tags :
10
+ - " v[0-9]+.[0-9]+.[0-9]+"
9
11
pull_request :
10
12
branches :
11
13
- master
@@ -25,12 +27,46 @@ jobs:
25
27
commit-filter : ' [ci skip];[ci-skip];[skip ci];[skip-ci]'
26
28
commit-filter-separator : ' ;'
27
29
30
+ lint :
31
+ needs : init
32
+ if : ${{ github.event_name == 'schedule' || needs.init.outputs.skip == 'false' }}
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - uses : actions/checkout@v2
36
+ with :
37
+ fetch-depth : 0
38
+ - name : Set up Python
39
+ uses : actions/setup-python@v2
40
+ with :
41
+ python-version : 3.8
42
+
43
+ - uses : actions/cache@v2
44
+ with :
45
+ path : ~/.cache/pre-commit
46
+ key : precommit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
47
+ restore-keys : |
48
+ precommit-${{ env.pythonLocation }}-
49
+ precommit-
50
+
51
+ - name : Install dependencies
52
+ run : |
53
+ python -m pip install --upgrade pip
54
+ pip install tox
55
+
56
+ - name : Linting
57
+ run : |
58
+ tox -e lint
59
+ # - name: Documentation check
60
+ # run: |
61
+ # tox -e docs-check
62
+
28
63
test :
29
64
needs : init
30
- if : ${{ needs.init.outputs.skip == 'false' }}
65
+ if : ${{ github.event_name == 'schedule' || needs.init.outputs.skip == 'false' }}
31
66
timeout-minutes : 10
32
67
runs-on : ${{ matrix.os }}
33
68
strategy :
69
+ fail-fast : false
34
70
max-parallel : 4
35
71
matrix :
36
72
python : [3.8] # , 3.7, 3.9]
@@ -49,24 +85,34 @@ jobs:
49
85
python-version : ${{ matrix.python }}
50
86
51
87
- name : Get pip cache dir
52
- id : pip-cache
88
+ id : pip-cache-dir
53
89
run : |
54
90
echo "::set-output name=dir::$(pip cache dir)"
55
-
56
- - name : Cache pip
91
+ - name : Restore pip cache
57
92
uses : actions/cache@v2
58
93
with :
59
- path : ${{ steps.pip-cache.outputs.dir }}
60
- key : ${{ runner.os }}-${{ runner.python }}-pip -${{ hashFiles('**/requirements.txt') }}
94
+ path : ${{ steps.pip-cache-dir .outputs.dir }}
95
+ key : pip- ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}
61
96
restore-keys : |
62
- ${{ runner.os }}-${{ runner.python }}-pip -
97
+ pip- ${{ runner.os }}-${{ env.pythonLocation }}-
63
98
64
99
- name : Install dependencies
65
100
run : |
66
101
python -m pip install --upgrade pip
67
102
pip install tox tox-gh-actions codecov
68
103
69
- - name : Installed automake for leidenalg
104
+ # caching .tox is not encouraged, but since we're private and this shaves off ~1min from the step, it should be ok
105
+ # if any problems occur and/or once the package is public, this can be removed
106
+ - name : Restore tox cache
107
+ uses : actions/cache@v2
108
+ with :
109
+ path : .tox
110
+ key : tox-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/tox.ini') }}
111
+ restore-keys : |
112
+ tox-${{ runner.os }}-${{ env.pythonLocation }}-
113
+ tox-${{ runner.os }}-
114
+
115
+ - name : Installed dependencies for leidenalg
70
116
run : |
71
117
if [[ "$RUNNER_OS" == "Linux" ]]; then
72
118
sudo apt install automake
@@ -77,33 +123,24 @@ jobs:
77
123
exit 1
78
124
fi
79
125
80
- - name : Linting
81
- run : |
82
- tox -e lint
83
-
84
- # TODO: enable once we're public (fails because links are missing)
85
- # - name: Documentation check
86
- # run: |
87
- # tox -e docs-check
88
-
89
126
- name : Testing
90
127
run : |
91
128
tox
92
129
env :
93
130
PLATFORM : ${{ matrix.platform }}
94
131
95
- - name : Upload coverage to Codecov
132
+ - name : Upload coverage
96
133
if : success()
97
134
env :
98
135
CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
99
136
CODECOV_NAME : ${{ matrix.python }}-${{ matrix.os }}
100
137
run : |
101
138
codecov --no-color --required --flags unittests
102
139
103
- rebuild-examples :
140
+ rebuild-notebooks :
141
+ needs : [lint, test]
104
142
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
105
143
runs-on : ubuntu-latest
106
- needs : test
107
144
steps :
108
145
- name : Rebuild tutorials/examples
109
146
uses : peter-evans/repository-dispatch@v1
@@ -112,3 +149,31 @@ jobs:
112
149
repository : theislab/squidpy_notebooks
113
150
event-type : rebuild
114
151
client-payload : ' {"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
152
+
153
+ deploy :
154
+ needs : [lint, test]
155
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
156
+ runs-on : ubuntu-latest
157
+ steps :
158
+ - uses : actions/checkout@v2
159
+ with :
160
+ fetch-depth : 0
161
+ - name : Set up Python
162
+ uses : actions/setup-python@v2
163
+ with :
164
+ python-version : 3.8
165
+ - name : Install pypa/build
166
+ run : |
167
+ python -m pip install --upgrade pip
168
+ pip install build
169
+ - name : Build a binary wheel and a source tarball
170
+ run : |
171
+ python -m build --sdist --wheel --outdir dist/
172
+
173
+ - name : Publish package on PyPI
174
+ uses : pypa/gh-action-pypi-publish@master
175
+ with :
176
+ user : __token__
177
+ password : ${{ secrets.PYPI_PASSWORD }}
178
+ skip_existing : true
179
+ verbose : true
0 commit comments