-
-
Notifications
You must be signed in to change notification settings - Fork 14
173 lines (170 loc) · 5.59 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
name: ci
on:
pull_request:
branches:
- master
release:
types: ["published"]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: 3.10.4
- name: Restore cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: .venv
key: py3.10-ubuntu-latest-venv-cache-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry
run: |
pip install poetry>=1.8.4
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
poetry install -E http -E sql
poetry run task compile
- name: Lint
run: |
poetry show mypy
poetry run task lint
build_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: 3.10.4
- name: Restore cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: .venv
key: py3.10-ubuntu-latest-venv-cache-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry
run: |
pip install poetry>=1.8.4
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
poetry install -E http -E sql
poetry run task compile
poetry run task pytkdocs
- name: Build docs
run: poetry run mkdocs build
test_sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: 3.10.4
- name: Restore cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: .venv
key: py3.10-ubuntu-latest-venv-cache-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry
run: |
pip install poetry>=1.8.4
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
poetry install -E http -E sql --no-root
poetry run task compile
poetry build -f sdist
poetry run pip install --ignore-installed dist/*
- name: Run tests
run: poetry run pytest -n 4 --mypy-ini-file=tests/mypy.ini
- name: Upload sdist
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: sdist
path: dist/*.tar.gz
test_wheel:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: .venv
key: py${{ matrix.python-version }}-${{ matrix.os }}-venv-cache-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry
run: |
pip install poetry>=1.8.4
poetry config virtualenvs.in-project true
- name: Install dependencies
run: |
poetry install -E http -E sql --no-root
poetry run task compile
poetry build -f wheel
poetry run pip install --ignore-installed dist/*
- name: Run tests
run: poetry run pytest -n 4 --mypy-ini-file=tests/mypy.ini
- name: Upload wheel
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: wheel-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*.whl
release:
needs: [lint, build_docs, test_wheel, test_sdist]
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: 3.10.4
- name: Restore cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: .venv
key: py3.10-ubuntu-latest-venv-cache-${{ hashFiles('**/poetry.lock') }}
- name: Install poetry
run: |
pip install poetry>=1.8.4
poetry config virtualenvs.in-project true
- name: Download wheels and sdist
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
- name: Gather artifacts
run: |
mkdir dist
mv sdist/*.tar.gz dist
mv wheel-*/*.whl dist
- name: Install dependencies
run: |
poetry install -E http -E sql --no-root
poetry run task compile
poetry install
- name: Check version
run: |
tag=$(echo ${{ github.ref_name }} | cut -d / -f 3)
poetry run python scripts/check_version.py pyproject.toml $tag
- name: Release pfun
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
- name: Release docs
run: |
git fetch origin gh-pages
poetry run mkdocs gh-deploy