Skip to content

Commit

Permalink
Revamp workflow to use Trusted Publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch committed Nov 12, 2024
1 parent 0b5b8f6 commit 50e03c6
Showing 1 changed file with 43 additions and 26 deletions.
69 changes: 43 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@ on:
- v*
pull_request:

env:
UV_SYSTEM_PYTHON: 1

jobs:
vmodule-just-tests:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [macOS-latest, ubuntu-latest, windows-latest]
exclude:
- python-version: "3.7"
os: macOS-latest

steps:
- name: Checkout
Expand All @@ -25,35 +31,46 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v3
- name: Install
run: |
python -m pip install --upgrade pip
pip install -U .
uv pip install -e .[test]
- name: Test
run: python -m unittest vmodule.tests

vmodule:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [macOS-latest, ubuntu-latest, windows-latest]
run: make test
- name: Lint
run: |
uv pip install -e .[test,dev]
make lint
if: ${{ matrix.python-version != '3.9' && matrix.python-version != '3.8' && matrix.python-version != '3.7' }}

build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"
- uses: astral-sh/setup-uv@v3
- name: Install
run: |
python -m pip install --upgrade pip
make setup
pip install -U .
- name: Test
run: make test
- name: Lint
run: make lint
run: uv pip install build
- name: Build
run: python -m build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist

publish:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 50e03c6

Please sign in to comment.