Skip to content

Commit 73f48e9

Browse files
committed
Add Github actions workflow
1 parent 0ec79a0 commit 73f48e9

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/test.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ '*' ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
jobs:
11+
tests:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.11", "3.12", "3.13"]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- uses: actions/cache@v4
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}
31+
32+
- name: Install dependencies
33+
run: |
34+
python3 -m pip install --upgrade pip
35+
python3 -m pip install pytest
36+
37+
- name: Test with pytest
38+
run: |
39+
python3 -m pytest -v
40+
41+
publish:
42+
runs-on: ubuntu-latest
43+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
44+
needs: tests
45+
permissions:
46+
id-token: write # OIDC for uploading to PyPI
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Python 3.10
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.11"
56+
57+
- name: Build packages
58+
run: |
59+
python3 -m pip install build
60+
python3 -m build
61+
62+
- name: Publish package distributions to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)