Skip to content

Commit e154b43

Browse files
authored
Remove no commit to branch precommit, fix cron (scverse#199)
* Remove no commit to branch precommit, fix cron * Fix autoflake * Update CI, add deployment * Fix lint key * Fix pip cache * Try caching tox * Test tox cache * Fix caching * Update codecov.yml
1 parent be20c14 commit e154b43

File tree

3 files changed

+91
-26
lines changed

3 files changed

+91
-26
lines changed

.github/codecov.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ parsers:
4040

4141
comment:
4242
layout: "reach, diff, files"
43-
behavior: new
44-
require_changes: yes
43+
behavior: default
44+
require_changes: true
4545
branches:
4646
- master

.github/workflows/ci.yml

+85-20
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
push:
77
branches:
88
- master
9+
tags:
10+
- "v[0-9]+.[0-9]+.[0-9]+"
911
pull_request:
1012
branches:
1113
- master
@@ -25,12 +27,46 @@ jobs:
2527
commit-filter: '[ci skip];[ci-skip];[skip ci];[skip-ci]'
2628
commit-filter-separator: ';'
2729

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+
2863
test:
2964
needs: init
30-
if: ${{ needs.init.outputs.skip == 'false' }}
65+
if: ${{ github.event_name == 'schedule' || needs.init.outputs.skip == 'false' }}
3166
timeout-minutes: 10
3267
runs-on: ${{ matrix.os }}
3368
strategy:
69+
fail-fast: false
3470
max-parallel: 4
3571
matrix:
3672
python: [3.8] # , 3.7, 3.9]
@@ -49,24 +85,34 @@ jobs:
4985
python-version: ${{ matrix.python }}
5086

5187
- name: Get pip cache dir
52-
id: pip-cache
88+
id: pip-cache-dir
5389
run: |
5490
echo "::set-output name=dir::$(pip cache dir)"
55-
56-
- name: Cache pip
91+
- name: Restore pip cache
5792
uses: actions/cache@v2
5893
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') }}
6196
restore-keys: |
62-
${{ runner.os }}-${{ runner.python }}-pip-
97+
pip-${{ runner.os }}-${{ env.pythonLocation }}-
6398
6499
- name: Install dependencies
65100
run: |
66101
python -m pip install --upgrade pip
67102
pip install tox tox-gh-actions codecov
68103
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
70116
run: |
71117
if [[ "$RUNNER_OS" == "Linux" ]]; then
72118
sudo apt install automake
@@ -77,33 +123,24 @@ jobs:
77123
exit 1
78124
fi
79125
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-
89126
- name: Testing
90127
run: |
91128
tox
92129
env:
93130
PLATFORM: ${{ matrix.platform }}
94131

95-
- name: Upload coverage to Codecov
132+
- name: Upload coverage
96133
if: success()
97134
env:
98135
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
99136
CODECOV_NAME: ${{ matrix.python }}-${{ matrix.os }}
100137
run: |
101138
codecov --no-color --required --flags unittests
102139
103-
rebuild-examples:
140+
rebuild-notebooks:
141+
needs: [lint, test]
104142
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
105143
runs-on: ubuntu-latest
106-
needs: test
107144
steps:
108145
- name: Rebuild tutorials/examples
109146
uses: peter-evans/repository-dispatch@v1
@@ -112,3 +149,31 @@ jobs:
112149
repository: theislab/squidpy_notebooks
113150
event-type: rebuild
114151
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

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ repos:
2121
rev: v3.4.0
2222
hooks:
2323
- id: detect-private-key
24-
- id: no-commit-to-branch
2524
- id: check-merge-conflict
2625
- id: check-ast
2726
- id: check-symlinks
2827
- id: check-added-large-files
2928
- id: check-executables-have-shebangs
3029
- id: fix-encoding-pragma
31-
args: ['--remove'] # for Python3 codebase, it"s not necessary
30+
args: ["--remove"] # for Python3 codebase, it"s not necessary
3231
- id: end-of-file-fixer
3332
- id: mixed-line-ending
34-
args: ['--fix=lf']
33+
args: ["--fix=lf"]
3534
- id: trailing-whitespace
3635
- id: check-case-conflict
3736
- id: check-docstring-first
@@ -50,7 +49,8 @@ repos:
5049
rev: v1.4
5150
hooks:
5251
- id: autoflake
53-
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable', "--ignore-init-module-imports"]
52+
args: ["--recursive", "--in-place", "--remove-all-unused-imports", "--remove-unused-variables",
53+
"--ignore-init-module-imports"]
5454
- repo: https://github.com/myint/rstcheck
5555
rev: master
5656
hooks:

0 commit comments

Comments
 (0)