Skip to content

Commit f8054ae

Browse files
authored
ci: improve GitHub Actions configuration (#86)
1 parent 36d7f4d commit f8054ae

8 files changed

Lines changed: 53 additions & 30 deletions

File tree

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "uv"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "daily"

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
steps:
3333
- name: CLA Assistant
34-
uses: contributor-assistant/github-action@v2.6.1
34+
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3737
with:

.github/workflows/pr.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212

1313
permissions: {}
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
validate-pr-title:
1721
name: Validate PR title
@@ -20,7 +24,7 @@ jobs:
2024
pull-requests: read
2125
steps:
2226
- name: Validate PR title against CONTRIBUTING.md
23-
uses: amannn/action-semantic-pull-request@v6
27+
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
2428
env:
2529
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2630
with:
@@ -44,10 +48,12 @@ jobs:
4448
contents: read
4549
steps:
4650
- name: Checkout
47-
uses: actions/checkout@v6
51+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
52+
with:
53+
persist-credentials: false
4854

4955
- name: Setup Python and uv
50-
uses: astral-sh/setup-uv@v7
56+
uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
5157

5258
- name: Run checks
5359
run: make check

.github/workflows/release.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ jobs:
2222
version: ${{ steps.verify.outputs.version }}
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v6
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626
with:
2727
fetch-depth: 0
28+
persist-credentials: false
2829

2930
- name: Setup Python and uv
30-
uses: astral-sh/setup-uv@v7
31+
uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
3132

3233
- id: verify
3334
name: Verify tag matches pyproject.toml and main
@@ -68,18 +69,18 @@ jobs:
6869
contents: read
6970
steps:
7071
- name: Checkout
71-
uses: actions/checkout@v6
72-
73-
- name: Install uv and Python 3.12
74-
uses: astral-sh/setup-uv@v7
72+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7573
with:
76-
python-version: "3.12"
74+
persist-credentials: false
75+
76+
- name: Setup Python and uv
77+
uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
7778

7879
- name: Build distributions
7980
run: make build
8081

8182
- name: Upload distributions
82-
uses: actions/upload-artifact@v7
83+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
8384
with:
8485
name: python-package-distributions
8586
path: dist/*
@@ -95,13 +96,13 @@ jobs:
9596
contents: write
9697
steps:
9798
- name: Download distributions
98-
uses: actions/download-artifact@v8
99+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
99100
with:
100101
name: python-package-distributions
101102
path: dist
102103

103104
- name: Create or update GitHub draft release
104-
uses: ncipollo/release-action@v1
105+
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
105106
with:
106107
tag: ${{ needs.verify-tag.outputs.tag }}
107108
name: ${{ needs.verify-tag.outputs.tag }}
@@ -129,13 +130,13 @@ jobs:
129130
id-token: write
130131
steps:
131132
- name: Download distributions
132-
uses: actions/download-artifact@v8
133+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
133134
with:
134135
name: python-package-distributions
135136
path: dist
136137

137138
- name: Publish package distributions to TestPyPI
138-
uses: pypa/gh-action-pypi-publish@release/v1
139+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
139140
with:
140141
repository-url: https://test.pypi.org/legacy/
141142
skip-existing: true
@@ -155,16 +156,16 @@ jobs:
155156
id-token: write
156157
steps:
157158
- name: Download distributions
158-
uses: actions/download-artifact@v8
159+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
159160
with:
160161
name: python-package-distributions
161162
path: dist
162163

163164
- name: Publish package distributions to PyPI
164-
uses: pypa/gh-action-pypi-publish@release/v1
165+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
165166

166167
- name: Publish GitHub draft release
167-
uses: ncipollo/release-action@v1.21.0
168+
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
168169
with:
169170
tag: ${{ needs.verify-tag.outputs.tag }}
170171
allowUpdates: true

.github/workflows/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ jobs:
1919
- "3.13"
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v6
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23+
with:
24+
persist-credentials: false
2325

2426
- name: Setup uv and Python
25-
uses: astral-sh/setup-uv@v7
27+
uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
2628
with:
29+
cache-dependency-glob: uv.lock
2730
python-version: ${{ matrix.python-version }}
2831

2932
- name: Run tests
30-
run: make test
33+
run: uv run pytest

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Use these commands for normal development:
7575
- `make format`: run `uv run ruff format`
7676
- `make lint`: run `make format`, then `uv run ruff check --fix`
7777
- `make tc`: run `make lint`, then `uv run ty check`
78-
- `make check`: run `uv run ruff format --check && uv run ruff check && uv run ty check`
78+
- `make check`: run `uv lock --check && uv run ruff format --check && uv run ruff check && uv run ty check`
7979
- `make test`: run `make tc`, then `uv run pytest`
8080
- `make build`: build the package distributions
8181
- `make clean`: remove build artifacts and caches
@@ -87,8 +87,8 @@ Notes:
8787
formatting and lint fixes first.
8888
- `make test` is the progressive local full-chain target. It formats, applies
8989
lint fixes, runs `ty check`, and then runs the test suite.
90-
- `make check` aggregates the same non-mutating lint and type-check commands
91-
used by CI.
90+
- `make check` aggregates the same non-mutating lockfile, lint, and type-check
91+
commands used by CI.
9292
- `pytest` is configured with `-n auto` and `testpaths = ['tests']`, so the
9393
test suite runs in parallel by default.
9494
- If you change dependencies, refresh and commit `uv.lock` before opening a
@@ -109,8 +109,8 @@ make check
109109
Pull requests targeting `main` currently run three kinds of checks:
110110

111111
1. PR title validation with `amannn/action-semantic-pull-request`
112-
2. `make check`
113-
3. `make test` on Python 3.12 and 3.13
112+
2. `make check` including `uv.lock` freshness validation
113+
3. `uv run pytest` on Python 3.12 and 3.13
114114

115115
Keep local workflow aligned with those checks. A green local `make test` plus
116116
`make check` is useful, but it is not a complete substitute for the exact CI

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test: tc
2121

2222
.PHONY: check
2323
check:
24+
uv lock --check
2425
uv run ruff format --check
2526
uv run ruff check
2627
uv run ty check

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ construction, input seeding, and streamed output handling.
142142
Contributor setup, tooling details, CLA notes, and commit/PR conventions live
143143
in [CONTRIBUTING.md](CONTRIBUTING.md).
144144

145-
CI currently validates pull request titles, runs `make check`, and runs
146-
`make test` on Python 3.12 and 3.13. Python 3.14 is currently excluded because
147-
`unstructured` does not yet support it.
145+
CI currently validates pull request titles, runs `make check` including
146+
`uv.lock` freshness validation, and runs `uv run pytest` on Python 3.12 and
147+
3.13. Python 3.14 is currently excluded because `unstructured` does not yet
148+
support it.
148149

149150
## License
150151

0 commit comments

Comments
 (0)