Skip to content

ci test

ci test #4

Workflow file for this run

name: test
on:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
STABLE_PYTHON_VERSION: '3.11'
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
jobs:
run:
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Ensure latest pip and hatch
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Lint
run: hatch run lint:all
- name: Coverage
run: hatch run test-cov
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: coverage
coverage-combine:
name: Report coverage
runs-on: ubuntu-latest
needs:
- run
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.STABLE_PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Install Hatch
run: pip install hatch
- name: Download coverage data
uses: actions/download-artifact@v3
with:
name: coverage-data
- name: Combine coverage data
run: hatch run cov-report
# https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- coverage-combine
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}