Skip to content

ci: build before publish #35

ci: build before publish

ci: build before publish #35

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags: [ '*' ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ['3.13', '3.14']
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --dev
- name: Run tests with coverage
run: uv run pytest --cov-report term --cov-report xml --cov pystructs tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
publish:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build package
run: uv build
- name: Publish to PyPI
run: uv publish --trusted-publishing always