feat: support GPG signature check #438
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- "**.py" | |
- pyproject.toml | |
- ".github/workflows/main.yml" | |
- ".pre-commit-config.yaml" | |
- "!docs/**" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install nox | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install nox | |
- name: Run pre-commit | |
run: | | |
nox -s lint | |
nox -s test-hook | |
- name: Build wheel | |
run: nox -s build | |
- name: Upload wheel as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: commit-check_wheel | |
path: ${{ github.workspace }}/dist/*.whl | |
- name: Run commit-check | |
run: nox -s commit-check | |
- name: Collect Coverage | |
run: nox -s coverage | |
- uses: codecov/codecov-action@v5.0.2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
install: | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
py: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
os: ['windows-latest', 'ubuntu-24.04', 'macos-latest'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
- run: | | |
pip install --upgrade pip | |
pip install .[dev] | |
- name: Download wheel artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: commit-check_wheel | |
path: dist | |
- name: Install test | |
# using a wildcard as filename on Windows requires a bash shell | |
shell: bash | |
run: nox -s install-wheel | |
docs: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} # get current branch name | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install nox | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install nox | |
- name: Build docs | |
run: nox -s docs | |
- name: Save built docs as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "commit-check_docs" | |
path: ${{ github.workspace }}/_build/html | |
- name: Upload docs to github pages | |
# only publish doc changes from main branch | |
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_build/html |