blob: 4c5597620b46124886feef7cf379c40989563559 (
plain)
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
|
name: release
on:
push:
branches: [deploy]
tags: [v*]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: |
requirements/dist.txt
requirements/test.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dist.txt -r requirements/test.txt
- name: Test with pytest
env:
PY_COLORS: 1 # forcibly enable pytest colors
run: python setup.py test
- name: Build sdist
run: |
git clean -fxd
# build sdist
python setup.py sdist
# run in-place build so wheel deps use release versions
python setup.py build_py -i
- name: Build wheels
uses: joerick/cibuildwheel@v2.8.1
with:
output-dir: dist
env:
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* pp39-*
CIBW_ARCHS_LINUX: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24
CIBW_PRERELEASE_PYTHONS: True
CIBW_BEFORE_BUILD: pip install -r {project}/requirements/dist.txt
CIBW_BEFORE_TEST: pip install -r {project}/requirements/test.txt
CIBW_ENVIRONMENT: PY_COLORS=1
CIBW_TEST_COMMAND: pytest -v {project}/tests
- name: Output dist file info
run: |
sha512sum dist/*
tar -ztf dist/*.tar.gz | sort
- uses: actions/upload-artifact@v3
with:
name: results
path: dist/*
- name: Install twine and check files
run: |
pip install twine wheel-inspect
twine check dist/*
wheel2json dist/*.whl
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# only upload files for tagged releases
if: startsWith(github.ref, 'refs/tags/')
run: |
twine upload dist/*
- name: Create GitHub release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*.tar.gz
fail_on_unmatched_files: true
|