-
Notifications
You must be signed in to change notification settings - Fork 3
179 lines (171 loc) · 5.61 KB
/
ci.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: CI
on:
schedule:
- cron: 00 00 * * 1 # run every Monday at 00:00
push:
branches:
- master
- develop
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- master
- develop
workflow_dispatch:
jobs:
init:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.ci-skip-step.outputs.ci-skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: ci-skip-step
uses: mstachniuk/ci-skip@master
with:
commit-filter: '[ci skip];[ci-skip];[skip ci];[skip-ci]'
commit-filter-separator: ;
lint:
needs: init
if: ${{ github.event_name == 'schedule' || needs.init.outputs.skip == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run static analysis
run: |
pre-commit run --all-files --show-diff-on-failure
test:
needs: lint
name: test on ${{ matrix.os }} with python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 20
matrix:
python: [3.7, 3.8, 3.9, '3.10']
os: [ubuntu-latest, macos-latest]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Get pip cache dir
id: pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Restore pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
pip-${{ runner.os }}-${{ env.pythonLocation }}-
- name: Install dependencies
run: |
./.scripts/ci/install.sh
- name: Unit tests
run: |
python -m pytest --cov=trisicell ./tests
# - name: Upload coverage
# if: success()
# env:
# CODECOV_NAME: ${{ matrix.python }}-${{ matrix.os }}
# run: |
# codecov --no-color --required --flags unittests
codeql:
needs: lint
name: code quality
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ python ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
build_wheels:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: test
name: build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 20
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Build wheels
uses: pypa/cibuildwheel@v2.0.0a4
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: build_wheels
name: build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
deploy:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [test, build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Artifact
uses: actions/download-artifact@v2
with:
path: dist
- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: dist/artifact/
skip_existing: true
verbose: true