Skip to content

Commit 775ae01

Browse files
committed
Add github actions
1 parent c0d8aeb commit 775ae01

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

.github/workflows/cd.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
# Many color libraries just need this to be set to any value, but at least
19+
# one distinguishes color depth, where "3" -> "256-bit color".
20+
FORCE_COLOR: 3
21+
22+
jobs:
23+
dist:
24+
name: Distribution build
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- uses: hynek/build-and-inspect-python-package@v2
33+
34+
publish:
35+
needs: [dist]
36+
name: Publish to PyPI
37+
environment: pypi
38+
permissions:
39+
id-token: write
40+
attestations: write
41+
contents: read
42+
runs-on: ubuntu-latest
43+
if: github.event_name == 'release' && github.event.action == 'published'
44+
45+
steps:
46+
- uses: actions/download-artifact@v4
47+
with:
48+
name: Packages
49+
path: dist
50+
51+
- name: Generate artifact attestation for sdist and wheel
52+
uses: actions/[email protected]
53+
with:
54+
subject-path: "dist/*"
55+
56+
- uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
repository_url: https://upload.pypi.org/legacy/
59+
verbose: true

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
# Many color libraries just need this to be set to any value, but at least
16+
# one distinguishes color depth, where "3" -> "256-bit color".
17+
FORCE_COLOR: 3
18+
19+
jobs:
20+
pre-commit:
21+
name: Format
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
- uses: pre-commit/[email protected]
31+
with:
32+
extra_args: --hook-stage manual --all-files
33+
34+
checks:
35+
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
36+
runs-on: ${{ matrix.runs-on }}
37+
needs: [pre-commit]
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
python-version: ["3.9", "3.12"]
42+
runs-on: [ubuntu-latest, macos-14]
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
49+
- uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
allow-prereleases: true
53+
54+
- name: Install package
55+
run: python -m pip install .[test]

0 commit comments

Comments
 (0)