Skip to content

build(deps): lock file maintenance (#478) #868

build(deps): lock file maintenance (#478)

build(deps): lock file maintenance (#478) #868

Workflow file for this run

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 Poetry
run: |
pipx install poetry
pipx inject poetry "poetry-dynamic-versioning[plugin]"
- name: Install Python
uses: actions/setup-python@v5
id: setup-python
with:
cache: poetry
python-version: ">=3.9"
- name: Install dependencies
run: poetry 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('.pre-commit-config.yaml') }}
- name: Lint with Mypy and Ruff
run: |
poetry run pre-commit run -a
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
with:
fetch-depth: 0
fetch-tags: true
- name: Install Poetry
run: |
pipx install poetry
pipx inject poetry "poetry-dynamic-versioning[plugin]"
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
cache: poetry
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: poetry install --only main,test
- name: Test and Generate Coverage Report
run: |
poetry 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.3.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: "./coverage.lcov"
parallel: true
flag-name: run-${{ matrix.os }}-python-${{ matrix.python-version }}
- name: Build the package into a wheel
run: poetry build
finish-coverage:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Finish Coverage Report
uses: coverallsapp/github-action@v2.3.0
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: Install Poetry
run: |
pipx install poetry
pipx inject poetry "poetry-dynamic-versioning[plugin]"
- name: Set Up Python
uses: actions/setup-python@v5
with:
cache: poetry
python-version: ">=3.8"
- name: Publish Package
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }}