Skip to content

Fix dependency groups for running invoke unit tests #874

Fix dependency groups for running invoke unit tests

Fix dependency groups for running invoke unit tests #874

Workflow file for this run

name: test
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
jobs:
run:
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12"]
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Hatch
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc # install
- name: Run static analysis
run: hatch fmt --check
- name: Check types
run: hatch run types:check
- name: Run tests
run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize
- name: Create coverage report
run: hatch run hatch-test.py${{ matrix.python-version }}:coverage xml
- name: Upload coverage data
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: coverage.xml
coverage:
name: Upload coverage
needs:
- run
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Download coverage data
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
pattern: coverage-*
path: coverage_data
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
directory: coverage_data
use_oidc: true
check:
if: always()
needs:
- run
- coverage
runs-on: ubuntu-latest
steps:
- name: Verify dependent success
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}