Skip to content

Commit ba33a41

Browse files
committed
fix #75 fix #76 fix #77
1 parent b878e44 commit ba33a41

File tree

15 files changed

+696
-212
lines changed

15 files changed

+696
-212
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
# GitHub Actions
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
1011
schedule:
1112
interval: "daily"
13+
commit-message:
14+
prefix:
15+
# Python
16+
- package-ecosystem: "pip"
17+
directory: "/"
18+
schedule:
19+
interval: "daily"
20+
commit-message:
21+
prefix:

.github/workflows/lint.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
name: lint
1+
name: Lint
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
pull_request:
9+
workflow_call:
610
workflow_dispatch:
711
inputs:
812
debug:
9-
description: 'Set to on, to open ssh debug session.'
13+
description: 'Open ssh debug session.'
1014
required: true
11-
default: 'off'
15+
default: false
16+
type: boolean
1217

1318
jobs:
1419

@@ -17,37 +22,38 @@ jobs:
1722
strategy:
1823
matrix:
1924
# run static analysis on bleeding and trailing edges
20-
python-version: [ '3.8', '3.10', '3.12', '3.13.0-rc.1' ]
25+
python-version: [ '3.8', '3.10', '3.13' ]
2126

2227
steps:
2328
- uses: actions/checkout@v4
2429
- name: Set up Python ${{ matrix.python-version }}
2530
uses: actions/setup-python@v5
2631
with:
2732
python-version: ${{ matrix.python-version }}
28-
- name: Install Poetry
29-
uses: snok/install-poetry@v1
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v5
3035
with:
31-
virtualenvs-create: true
32-
virtualenvs-in-project: true
36+
enable-cache: true
37+
- name: Install Just
38+
uses: extractions/setup-just@v2
3339
- name: Install Dependencies
3440
run: |
35-
poetry config virtualenvs.in-project true
36-
poetry run pip install --upgrade pip
37-
poetry install
41+
just setup ${{ steps.sp.outputs.python-path }}
42+
just install-docs
3843
- name: Install Emacs
39-
if: ${{ github.event.inputs.debug == 'on' }}
44+
if: ${{ github.event.inputs.debug == 'true' }}
4045
run: |
4146
sudo apt install emacs
4247
- name: Setup tmate session
43-
if: ${{ github.event.inputs.debug == 'on' }}
44-
uses: mxschmitt/action-tmate@v3
48+
if: ${{ github.event.inputs.debug == 'true' }}
49+
uses: mxschmitt/action-tmate@v3.19
4550
with:
4651
detached: true
4752
timeout-minutes: 60
4853
- name: Run Static Analysis
4954
run: |
50-
source .venv/bin/activate
51-
./check.sh --no-fix
52-
python -m readme_renderer ./README.md -o /tmp/README.html
53-
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
55+
just check-lint
56+
just check-format
57+
just check-types
58+
just check-package
59+
just check-readme

.github/workflows/release.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
2+
name: Publish Release
3+
4+
permissions: read-all
5+
6+
concurrency:
7+
# stop previous release runs if tag is recreated
8+
group: release-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
on:
12+
push:
13+
tags:
14+
- 'v*' # only publish on version tags (e.g. v1.0.0)
15+
16+
jobs:
17+
18+
lint:
19+
permissions:
20+
contents: read
21+
actions: write
22+
uses: ./.github/workflows/lint.yml
23+
secrets: inherit
24+
25+
test:
26+
permissions:
27+
contents: read
28+
actions: write
29+
uses: ./.github/workflows/test.yml
30+
secrets: inherit
31+
32+
build:
33+
name: Build Package
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
actions: write
38+
outputs:
39+
PACKAGE_NAME: ${{ steps.set-package.outputs.package_name }}
40+
RELEASE_VERSION: ${{ steps.set-package.outputs.release_version }}
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Set up Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: ">=3.11" # for tomlib
47+
- name: Install uv
48+
uses: astral-sh/setup-uv@v5
49+
with:
50+
enable-cache: true
51+
- name: Setup Just
52+
uses: extractions/setup-just@v2
53+
- name: Verify Tag
54+
run: |
55+
TAG_NAME=${GITHUB_REF#refs/tags/}
56+
echo "Verifying tag $TAG_NAME..."
57+
# if a tag was deleted and recreated we may have the old one cached
58+
# be sure that we're publishing the current tag!
59+
git fetch --force origin refs/tags/$TAG_NAME:refs/tags/$TAG_NAME
60+
61+
# verify signature
62+
curl -sL https://github.com/${{ github.actor }}.gpg | gpg --import
63+
git tag -v "$TAG_NAME"
64+
65+
# verify version
66+
RELEASE_VERSION=$(just validate_version $TAG_NAME)
67+
68+
# export the release version
69+
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
70+
- name: Build the binary wheel and a source tarball
71+
run: just build
72+
- name: Store the distribution packages
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: python-package-distributions
76+
path: dist/
77+
- name: Set Package Name
78+
id: set-package
79+
run:
80+
PACKAGE_NAME=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['name'])")
81+
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
82+
83+
publish-to-pypi:
84+
name: Publish to PyPI
85+
needs:
86+
- lint
87+
- test
88+
- build
89+
runs-on: ubuntu-latest
90+
environment:
91+
name: pypi
92+
url: https://pypi.org/p/${{ needs.build.outputs.PACKAGE_NAME }}
93+
permissions:
94+
id-token: write # IMPORTANT: mandatory for trusted publishing
95+
steps:
96+
- name: Download all the dists
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: python-package-distributions
100+
path: dist/
101+
- name: Publish distribution 📦 to PyPI
102+
uses: pypa/gh-action-pypi-publish@release/v1.12
103+
104+
github-release:
105+
name: Publish GitHub Release
106+
runs-on: ubuntu-latest
107+
needs:
108+
- lint
109+
- test
110+
- build
111+
permissions:
112+
contents: write # IMPORTANT: mandatory for making GitHub Releases
113+
id-token: write # IMPORTANT: mandatory for sigstore
114+
115+
steps:
116+
- name: Download all the dists
117+
uses: actions/download-artifact@v4
118+
with:
119+
name: python-package-distributions
120+
path: dist/
121+
- name: Sign the dists with Sigstore
122+
uses: sigstore/gh-action-sigstore-python@v3.0.0
123+
with:
124+
inputs: >-
125+
./dist/*.tar.gz
126+
./dist/*.whl
127+
- name: Create GitHub Release
128+
env:
129+
GITHUB_TOKEN: ${{ github.token }}
130+
run: >-
131+
gh release create
132+
'${{ github.ref_name }}'
133+
--repo '${{ github.repository }}'
134+
--generate-notes
135+
- name: Upload artifact signatures to GitHub Release
136+
env:
137+
GITHUB_TOKEN: ${{ github.token }}
138+
# Upload to GitHub Release using the `gh` CLI.
139+
# `dist/` contains the built packages, and the
140+
# sigstore-produced signatures and certificates.
141+
run: >-
142+
gh release upload
143+
'${{ github.ref_name }}' dist/**
144+
--repo '${{ github.repository }}'

.github/workflows/scorecard.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: OpenSSF Scorecard
2+
on:
3+
# For Branch-Protection check. Only the default branch is supported. See
4+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
5+
branch_protection_rule:
6+
# To guarantee Maintained check is occasionally updated. See
7+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
8+
push:
9+
branches: [ main ]
10+
11+
permissions: read-all
12+
13+
jobs:
14+
analysis:
15+
name: Scorecard analysis
16+
runs-on: ubuntu-latest
17+
permissions:
18+
security-events: write
19+
id-token: write
20+
21+
steps:
22+
- name: "Checkout code"
23+
uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
26+
27+
- name: "Run analysis"
28+
uses: ossf/scorecard-action@v2.4.1
29+
with:
30+
results_file: results.sarif
31+
results_format: sarif
32+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
33+
# - you want to enable the Branch-Protection check on a *public* repository, or
34+
# - you are installing Scorecard on a *private* repository
35+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional.
36+
repo_token: ${{ secrets.SCORECARD_TOKEN }}
37+
38+
# Public repositories:
39+
# - Publish results to OpenSSF REST API for easy access by consumers
40+
# - Allows the repository to include the Scorecard badge.
41+
# - See https://github.com/ossf/scorecard-action#publishing-results.
42+
# For private repositories:
43+
# - `publish_results` will always be set to `false`, regardless
44+
# of the value entered here.
45+
publish_results: true
46+
47+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
48+
# format to the repository Actions tab.
49+
- name: "Upload artifact"
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: SARIF file
53+
path: results.sarif
54+
retention-days: 5
55+
56+
# Upload the results to GitHub's code scanning dashboard (optional).
57+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
58+
- name: "Upload to code-scanning"
59+
uses: github/codeql-action/upload-sarif@v3
60+
with:
61+
sarif_file: results.sarif

0 commit comments

Comments
 (0)