Skip to content

Commit c9733e3

Browse files
committed
🎨 prepare publishing workflow (without testing, linting, formatting for now)
test only that package can be installed
1 parent f5b996a commit c9733e3

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/cdci.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
# format:
13+
# runs-on: ubuntu-latest
14+
# steps:
15+
# - uses: actions/checkout@v4
16+
# - uses: psf/black@stable
17+
# lint:
18+
# name: Lint with ruff
19+
# runs-on: ubuntu-latest
20+
# steps:
21+
# - uses: actions/checkout@v4
22+
23+
# - uses: actions/setup-python@v5
24+
# with:
25+
# python-version: "3.11"
26+
# - name: Install ruff
27+
# run: |
28+
# pip install ruff
29+
# - name: Lint with ruff
30+
# run: |
31+
# # stop the build if there are Python syntax errors or undefined names
32+
# ruff check .
33+
test:
34+
name: Test
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Set up Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
cache: 'pip' # caching pip dependencies
46+
cache-dependency-path: '**/pyproject.toml'
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install pytest
51+
pip install -e .
52+
# - name: Run tests
53+
# run: python -m pytest tests
54+
55+
56+
57+
publish:
58+
name: Publish package
59+
if: startsWith(github.ref, 'refs/tags')
60+
permissions:
61+
id-token: write
62+
needs:
63+
- test
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- uses: actions/setup-python@v5
70+
with:
71+
python-version: "3.11"
72+
- name: Install twine and build
73+
run: python -m pip install --upgrade twine build
74+
- name: Build
75+
run: python -m build
76+
- name: Publish package distributions to PyPI
77+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)