1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
---
name: Reusable test
permissions: {}
on:
workflow_call:
inputs:
python-version:
type: string
required: true
os:
type: string
required: true
continue-on-error:
type: boolean
enable-cache:
type: string
required: true
no-httpx:
type: boolean
required: true
secrets:
codecov-token:
required: false
env:
FORCE_COLOR: 1
jobs:
test:
name: Test Python ${{ inputs.python-version }} on ${{ inputs.os }}${{
inputs.no-httpx && ' no-httpx' || '' }}
runs-on: ${{ inputs.os }}
continue-on-error: ${{ inputs.continue-on-error }}
env:
UV_FROZEN: 1
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
submodules: true
- name: Install uv
# yamllint disable-line rule:line-length
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
with:
python-version: ${{ inputs.python-version }}
enable-cache: ${{ inputs.enable-cache }}
- name: Run pre-commit hooks
run: |
uv run make pre-commit
- name: Run unittests
if: ${{ ! inputs.no-httpx }}
env:
COLOR: 'yes'
run: |
uv run --extra=httpx make mototest
- name: Run unittests without httpx installed
if: ${{ inputs.no-httpx }}
env:
COLOR: 'yes'
HTTP_BACKEND: 'aiohttp'
run: |
uv run make mototest
- name: Upload coverage to Codecov
# yamllint disable-line rule:line-length
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
token: ${{ secrets.codecov-token }} # not required for public repos
files: ./coverage.xml
# yamllint disable-line rule:line-length
flags: unittests,os-${{ inputs.os }},python-${{ inputs.python-version }}${{ inputs.no-httpx && ',no-httpx' || '' }} # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
|