Skip to content

Commit 0949676

Browse files
committed
Git Workflows: combine test and publish
1 parent e5cf91c commit 0949676

File tree

3 files changed

+64
-62
lines changed

3 files changed

+64
-62
lines changed

.github/workflows/publish-to.pypi.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Test and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '**/README.md'
9+
workflow_dispatch: {}
10+
pull_request: {}
11+
12+
jobs:
13+
test:
14+
name: Test
15+
strategy:
16+
fail-fast: true
17+
max-parallel: 3
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
21+
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Set up PDM
28+
uses: pdm-project/setup-pdm@v4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
cache: true
32+
33+
- name: Install dependencies
34+
run: pdm install -d
35+
36+
- name: Lint with ruff
37+
run: pdm run ruff check src
38+
39+
- name: Test with pytest
40+
run: pdm run pytest -v
41+
42+
publish:
43+
name: Build and Publish to PyPI
44+
runs-on: ubuntu-latest
45+
needs: test
46+
if: >-
47+
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
48+
startsWith(github.ref, 'refs/tags/v')
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
- name: Set up PDM
53+
uses: pdm-project/setup-pdm@v4
54+
with:
55+
python-version: "3.x"
56+
cache: true
57+
58+
- name: Build a binary wheel and a source tarball
59+
run: pdm build
60+
61+
- name: Publish to PyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
with:
64+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)