build(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.3.7 #802
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [master] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: [master] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ">=3.9" | |
- name: Setup PDM | |
uses: "pdm-project/setup-pdm@v3.3" | |
id: setup-pdm | |
with: | |
cache: true | |
- name: Install dependencies | |
run: pdm install | |
- name: Cache Pre-Commit Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles 7FAA ('.pre-commit-config.yaml') }} | |
- name: Lint with Mypy and Ruff | |
run: | | |
pdm run pre-commit run -a mypy | |
pdm run pre-commit run -a ruff | |
build: | |
needs: [lint] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.9, "3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup PDM | |
uses: "pdm-project/setup-pdm@v3.3" | |
id: setup-pdm | |
with: | |
cache: true | |
- name: Install Dependencies | |
run: pdm install -dG test | |
- name: Test and Generate Coverage Report | |
run: | | |
pdm run pytest -n auto --dist=worksteal \ | |
--cov=src/ --cov-report=lcov --cov-branch --durations=10 \ | |
--color=yes -rs | |
env: | |
HYPOTHESIS_PROFILE: ci | |
- name: Upload Coverage Report | |
uses: coverallsapp/github-action@v2.2.3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
file: "./coverage.lcov" | |
parallel: true | |
flag-name: run-${{ matrix.os }}-python-${{ matrix.python-version }} | |
finish-coverage: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finish Coverage Report | |
uses: coverallsapp/github-action@v2.2.3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true | |
publish: | |
needs: [build, finish-coverage] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref_type == 'tag' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install commitizen | |
run: pipx install commitizen | |
- name: Get 2nd-last commit tag | |
id: second-last | |
run: | | |
tags="$(git tag --sort=creatordate)" | |
output='' | |
# length > 1 means we have multiple tags and we need 2nd last one | |
if [[ "$(echo "$tags" | grep -c ^)" != "1" ]]; then | |
output="$(echo "$tags" | tail -2 | head -1)" | |
fi | |
echo "tag=$output" >> "$GITHUB_OUTPUT" | |
- name: Generate Changelog | |
run: | | |
# from 2nd-last revision upto this current tag. | |
cz ch --start-rev '${{ steps.second-last.outputs.tag }}' \ | |
--unreleased-version '${{ github.ref_name }}' \ | |
--file-name body.md | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: body.md | |
tag_name: ${{ github.ref_name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ">=3.8" | |
- name: Setup PDM | |
uses: "pdm-project/setup-pdm@v3.3" | |
id: setup-pdm | |
with: | |
cache: true | |
- name: Publish Package | |
run: pdm publish -u __token__ -p "$PYPI_PASSWORD" | |
env: | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |