Skip to content

tests

tests #1443

Workflow file for this run

name: tests
on:
push:
branches: main
paths-ignore:
- "examples/**"
- "scripts/**"
- "stats_website/**"
- "**.md"
- "**.json"
- "**.csv"
- "**.html"
pull_request:
paths-ignore:
- "examples/**"
- "scripts/**"
- "stats_website/**"
- "**.md"
- "**.json"
- "**.csv"
- "**.html"
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
env:
FORCE_COLOR: 1 # Request colored output from CLI tools supporting it
PY_COLORS: 1 # Recognized by the `py` package, dependency of `pytest`
CLICOLOR_FORCE: 1 # recognized by uv
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
pytest-tests:
name: Run tests with pytest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Run tests under coverage
shell: bash
run: |
uv python pin ${{ matrix.python-version }}
uv run --extra=dev coverage run -m pytest --doctest-modules
uv run --extra=dev coverage report --no-skip-covered
create-issue-on-failure:
name: Create an issue if daily test failed
runs-on: ubuntu-latest
needs: pytest-tests
if: >-
${{
github.repository == 'AlexWaygood/typeshed-stats'
&& always()
&& github.event_name == 'schedule'
&& needs.pytest-tests.result == 'failure'
}}
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.create({
owner: "AlexWaygood",
repo: "typeshed-stats",
title: `Daily test failed on ${new Date().toDateString()}`,
body: "Runs are listed here: https://github.com/AlexWaygood/typeshed-stats/actions/workflows/test.yml",
})