Skip to content

Commit e5ee160

Browse files
committed
CI: Building env only once, run sphinx for specific python only & Add publish job
1 parent 7c4af29 commit e5ee160

1 file changed

Lines changed: 51 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 51 additions & 6 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,55 @@ 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: make doc
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
46+
run: |
47+
uv venv --python 3.11
48+
uv pip install ".[doc]"
49+
.venv/bin/sphinx-build -a -W -E doc build/sphinx/html
50+
51+
publish:
52+
if: startsWith(github.ref, 'refs/tags/')
53+
needs: test
54+
runs-on: ubuntu-latest
55+
environment: release
56+
permissions:
57+
id-token: write
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Set up Python
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: "3.11"
69+
70+
- name: Install hatch
71+
run: pip install hatch
72+
73+
- name: Build package
74+
run: hatch build
75+
76+
- name: Publish to PyPI
77+
uses: pypa/gh-action-pypi-publish@release/v1
78+
with:
79+
attestations: true
80+
skip-existing: true

0 commit comments

Comments
 (0)