Skip to content

Commit e3e0a66

Browse files
committed
CI: Building env only once, run sphinx for specific python only & Add publish job
1 parent 68af626 commit e3e0a66

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

.github/workflows/main.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
# manually triggered
88

99
jobs:
10-
build:
10+
test:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
@@ -26,10 +26,52 @@ jobs:
2626
- name: Install Python ${{ matrix.python-version }}
2727
run: uv python install ${{ matrix.python-version }}
2828
- name: Install dependencies
29-
run: make env
29+
run: |
30+
uv venv
31+
uv pip install ".[testing]"
3032
- name: Lint with pylint
31-
run: make pylint
33+
run: .venv/bin/pylint --rcfile .pylintrc backslash tests
3234
- name: Test with pytest
33-
run: make test
34-
- name: Documentation
35+
run: .venv/bin/pytest tests --cov=backslash --cov-report=html
36+
37+
docs:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout the repository
41+
uses: actions/checkout@main
42+
- name: Install the default version of uv
43+
id: setup-uv
44+
uses: astral-sh/setup-uv@v3
45+
- name: Building docs
3546
run: make doc
47+
48+
publish:
49+
if: startsWith(github.ref, 'refs/tags/')
50+
needs: test
51+
runs-on: ubuntu-latest
52+
environment: release
53+
permissions:
54+
id-token: write
55+
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Set up Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: "3.11"
66+
67+
- name: Install hatch
68+
run: pip install hatch
69+
70+
- name: Build package
71+
run: hatch build
72+
73+
- name: Publish to PyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
with:
76+
attestations: true
77+
skip-existing: true

0 commit comments

Comments
 (0)