Skip to content

Commit 6a92f0c

Browse files
committed
Add gh workflows
1 parent 17c681c commit 6a92f0c

3 files changed

Lines changed: 89 additions & 0 deletions

File tree

.github/workflows/pypi.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution 📦
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v6
17+
18+
- name: Set up Python
19+
run: uv python install 3.12
20+
21+
- name: Build a binary wheel and a source tarball
22+
run: uv build
23+
- name: Store the distribution packages
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: python-package-distributions
27+
path: dist/
28+
29+
30+
publish-to-pypi:
31+
name: Publish Python 🐍 distribution 📦 to PyPI
32+
if: startsWith(github.ref, 'refs/tags/')
33+
needs:
34+
- build
35+
runs-on: ubuntu-latest
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/mapcat # Replace <package-name> with your PyPI project name
39+
permissions:
40+
id-token: write # IMPORTANT: mandatory for trusted publishing
41+
42+
steps:
43+
- name: Download all the dists
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: python-package-distributions
47+
path: dist/
48+
- name: Publish distribution 📦 to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/pytest.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Run tests
2+
3+
on: [push]
4+
5+
jobs:
6+
runtest:
7+
env:
8+
UV_SYSTEM_PYTHON: 1
9+
FC: gfortran
10+
CXX: g++
11+
CC: gcc
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.12"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v6
26+
27+
- name: Sync uv
28+
run: uv pip install ".[dev]"
29+
30+
- name: Run tests
31+
run: pytest --cov
32+

.github/workflows/ruff.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Ruff Formatting
2+
on: [ push, pull_request ]
3+
jobs:
4+
ruff:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: astral-sh/ruff-action@v3

0 commit comments

Comments
 (0)