-
Notifications
You must be signed in to change notification settings - Fork 35
171 lines (154 loc) · 4.27 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
name: CI
on:
push:
branches: [refactor, main]
tags: ["*"]
schedule:
- cron: '0 8 * * MON'
pull_request:
branches: [refactor, main]
workflow_dispatch:
env:
PYTHON_LATEST: "3.11"
jobs:
pre_commit:
name: "🅿️ pre-commit"
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: ${{env.PYTHON_LATEST}}
cache: pip
- uses: "pre-commit/[email protected]"
tests:
name: "Test Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
needs: "pre_commit"
timeout-minutes: 5
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
cache: pip
- name: "Run tests"
run: |
set -xe
python -VV
python -m site
python -m pip install -U pip setuptools wheel
python -m pip install -e ".[tests]"
coverage run --omit "src/readfish/read_until/*.py,src/readfish/entry_points/targets.py" -pm pytest
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.python-version }}
path: .coverage*
if-no-files-found: ignore
merge:
name: merge
runs-on: ubuntu-latest
needs: tests
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: coverage-data
pattern: my-artifact-*
coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: [tests, merge]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- name: Download coverage data
uses: actions/download-artifact@v4
with:
name: coverage-data
- name: Combine coverage
run: |
python -m pip install coverage[toml]
python -m coverage combine
python -m coverage report --skip-empty --fail-under=72 --format=markdown >> $GITHUB_STEP_SUMMARY
build-package:
name: Build python package
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- name: Build package
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: built-package
path: dist/
if-no-files-found: error
build-docs:
name: Build HTML docs
runs-on: ubuntu-latest
needs: "pre_commit"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- name: Build docs
run: |
python -m pip install .[docs]
cd docs
make html
- name: Upload built HTML
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html
if-no-files-found: error
deploy:
name: Deploy docs and package
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
needs:
- build-docs
- build-package
environment:
name: PyPI
url: https://pypi.org/p/readfish
permissions:
id-token: write
contents: write
steps:
- name: Download HTML docs
uses: actions/download-artifact@v4
with:
name: html-docs
path: _build/html
- name: Download python package
uses: actions/download-artifact@v4
with:
name: built-package
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Deploy docs to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html/