Lint test #4
This file contains 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: CI Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
lint: | |
name: Lint | |
permissions: | |
# To write linting fixes | |
contents: write | |
# To write Super-linter status checks | |
statuses: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Super-Linter | |
uses: super-linter/[email protected] # x-release-please-version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FIX_PYTHON_RUFF: true | |
FIX_YAML_PRETTIER: true | |
- name: Commit and push linting fixes | |
# Run only on: | |
# - Pull requests | |
# - Not on the default branch | |
if: > | |
github.event_name == 'pull_request' && | |
github.ref_name != github.event.repository.default_branch | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} | |
commit_message: "chore: fix linting issues" | |
commit_user_name: super-linter | |
commit_user_email: [email protected] | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
needs: lint | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv with Caching | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
uv sync --dev | |
- name: Run Tests with Coverage | |
run: | | |
uv run pytest | |
- name: Minimize uv Cache | |
run: uv cache prune --ci | |
publish: | |
name: Build and Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv with Caching | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Bump Version, Build, Publish | |
run: uvx --from rust-just just publish-package | |
- name: Minimize uv Cache | |
run: uv cache prune --ci |