Skip to content

Commit 77e9a06

Browse files
committed
ci: Set up release automation
Build sdists and wheels in CI, install wheels, and run the tests from the installed wheels. Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
1 parent 2a7a558 commit 77e9a06

File tree

2 files changed

+86
-25
lines changed

2 files changed

+86
-25
lines changed

.github/workflows/build.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types:
8+
- published
9+
schedule:
10+
# At 12:00 UTC on every day-of-month
11+
- cron: "0 12 */1 * *"
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build_dists:
19+
name: Source and wheel distributions
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Build distributions
25+
run: pipx run build[virtualenv] --sdist --wheel
26+
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: dist
30+
path: dist/*
31+
32+
- uses: actions/upload-artifact@v4
33+
with:
34+
name: test-deps
35+
path: |
36+
tests/
37+
Makefile
38+
requirements-dev.txt
39+
40+
test:
41+
needs: [build_dists]
42+
name: 'Test'
43+
runs-on: ubuntu-latest
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
48+
steps:
49+
- name: Set up Python
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: ${{ matrix.python_version }}-dev
53+
- uses: actions/download-artifact@v4
54+
with:
55+
name: dist
56+
path: dist
57+
- uses: actions/download-artifact@v4
58+
with:
59+
name: test-deps
60+
path: .
61+
- name: Install wheel
62+
run: |
63+
python -m pip install dist/*.whl
64+
- name: Install Python dependencies
65+
run: |
66+
python -m pip install -r requirements-dev.txt
67+
- name: Disable ptrace security restrictions
68+
run: |
69+
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
70+
- name: Test
71+
run: |
72+
make check
73+
74+
upload_pypi:
75+
needs: [test]
76+
runs-on: ubuntu-latest
77+
if: github.event_name == 'release' && github.event.action == 'published'
78+
steps:
79+
- uses: actions/download-artifact@v4
80+
with:
81+
name: dist
82+
path: dist
83+
84+
- uses: pypa/gh-action-pypi-publish@v1.8.11
85+
with:
86+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/validate.yaml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,3 @@ jobs:
2828
- name: Lint sources
2929
run: |
3030
make PYTHON=python${{matrix.python_version}} lint
31-
test:
32-
name: 'Test'
33-
runs-on: ubuntu-latest
34-
strategy:
35-
fail-fast: false
36-
matrix:
37-
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
38-
steps:
39-
- uses: actions/checkout@v3
40-
- name: Set up Python
41-
uses: actions/setup-python@v4
42-
with:
43-
python-version: ${{ matrix.python_version }}-dev
44-
- name: Install Python dependencies
45-
run: |
46-
python${{matrix.python_version}} -m pip install -r requirements-dev.txt
47-
- name: Install Package
48-
run: |
49-
python${{matrix.python_version}} -m pip install -e .
50-
- name: Disable ptrace security restrictions
51-
run: |
52-
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
53-
- name: Test
54-
run: |
55-
make PYTHON=python${{matrix.python_version}} check

0 commit comments

Comments
 (0)