Skip to content

Commit 85479d5

Browse files
committed
Set up GitHub CI to lint and type-check code and publish new releases.
1 parent 32d3ab0 commit 85479d5

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

workflows/check_commit.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Lint and type-check commit.
2+
name: Check commit
3+
4+
on: [push, pull_request, workflow_dispatch]
5+
6+
jobs:
7+
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code.
12+
uses: actions/checkout
13+
14+
- name: Install Python.
15+
uses: actions/setup-python
16+
with:
17+
python-version: "3.14"
18+
19+
- name: Install UV.
20+
uses: astral-sh/setup-uv
21+
22+
- name: Install package.
23+
run: uv sync
24+
25+
- name: Lint code.
26+
run: uv run ruff check
27+
28+
- name: Check types.
29+
run: uv run basedpyright

workflows/publish_release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Publish new GitHub release on PyPI.
2+
name: Publish release
3+
4+
on: [workflow_dispatch]
5+
6+
jobs:
7+
8+
build:
9+
name: Build wheel
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code.
13+
uses: actions/checkout@v5
14+
15+
- name: Install Python.
16+
uses: actions/setup-python@v6
17+
with:
18+
python-version-file: "pyproject.toml"
19+
20+
- name: Install UV.
21+
uses: astral-sh/setup-uv@v7
22+
23+
- name: Build wheel.
24+
run: uv build --wheel --out-dir build/wheel
25+
26+
- name: Store wheel.
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-wheel
30+
path: build/wheel
31+
32+
33+
publish:
34+
name: Publish to PyPI
35+
if: startsWith(github.ref, 'refs/tags/') # Commit must be tagged.
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/MPh
42+
permissions:
43+
id-token: write
44+
steps:
45+
- name: Download wheel.
46+
uses: actions/download-artifact@v5
47+
with:
48+
name: python-wheel
49+
path: build/wheel
50+
- name: Publish to PyPI.
51+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)