π ci: switch to coveralls (#9) #40
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: Python package | |
on: | |
push: | |
branches: | |
- "**" | |
jobs: | |
python-lint: | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
platform: [ubuntu-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root | |
- name: Install pdm | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pdm>=2.11.1 | |
- name: Install Dependencies | |
run: python -m pdm install -G lint -G dev | |
- name: Lint | |
run: python -m pdm run lint | |
python-test: | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
platform: [ubuntu-latest, windows-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-root | |
- name: Install pdm | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pdm>=2.11.1 | |
- name: Install Dependencies | |
run: python -m pdm install -dG test | |
- name: Test | |
run: python -m pdm run test | |
- name: Coveralls Parallel | |
uses: coverallsapp/github-action@v2 | |
with: | |
flag-name: run-${{ join(matrix.*, '-') }} | |
parallel: true | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{ matrix.platform }}-${{ matrix.python-version }} | |
path: reports/.coverage | |
coveralls-finish: | |
needs: [python-test] | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/[email protected] | |
with: | |
parallel-finished: true | |
carryforward: "run-ubuntu-latest-3.10,run-ubuntu-latest-3.11,run-ubuntu-latest-3.12,run-windows-latest-3.10,run-windows-latest-3.11,run-windows-latest-3.12" | |
bump-version: | |
runs-on: ubuntu-latest | |
needs: [python-lint, python-test] | |
if: | | |
github.event_name == 'push' && | |
github.ref_name == 'main' && | |
github.ref_type == 'branch' && | |
!startsWith(github.event.head_commit.message, 'π bump(release):') && | |
!startsWith(github.event.head_commit.message, 'bump(release):') && | |
!startsWith(github.event.head_commit.message, 'π bump:') && | |
!startsWith(github.event.head_commit.message, 'bump:') | |
name: "Bump version and create changelog with commitizen" | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | |
- name: Create bump and changelog | |
uses: commitizen-tools/commitizen-action@master | |
with: | |
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
extra_requirements: "cz-conventional-gitmoji" |