Skip to content

ci: fix workflow

ci: fix workflow #13

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up PDM with Python ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pdm sync -d -G test
- name: Test with pytest
run: |
pdm run -v test --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
if: ${{ always() }}
release:
name: Release new version
runs-on: ubuntu-latest
concurrency: release
needs: [lint, test]
if: github.repository == 'cachitas/stringx'
environment: PyPI
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: pdm-project/setup-pdm@v4
if: steps.release.outputs.released == 'true'
- name: Publish package distributions to PyPI
id: pypi-publish
if: steps.release.outputs.released == 'true'
run: pdm publish