Skip to content

Library Checks

Library Checks #828

Workflow file for this run

name: "Library Checks"
on:
push:
paths:
- "discord/**"
- "examples/**"
- "scripts/**"
- "tests/**"
- "*.toml"
- "*.py"
- ".*"
branches: [master]
pull_request:
paths:
- "discord/**"
- "examples/**"
- "scripts/**"
- "tests/**"
- "*.toml"
- "*.py"
- ".*"
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: write-all
jobs:
codespell:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v5
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: "Setup UV"
uses: ./.github/actions/sync-uv
with:
groups: 'dev'
- name: "Run codespell"
run:
uv run codespell --ignore-words-list="groupt,nd,ot,ro,falsy,BU" \
--exclude-file=".github/workflows/codespell.yml"
ruff:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v5
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: "Setup UV"
uses: ./.github/actions/sync-uv
with:
groups: 'dev'
- name: "Run ruff linter check"
run: uv run ruff check .
- name: "Run ruff formatter check"
run: uv run ruff format --check .
mypy:
if: ${{ github.event_name != 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v5
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: "Setup UV"
uses: ./.github/actions/sync-uv
with:
groups: 'dev'
- name: "Setup cache"
id: cache-mypy
uses: actions/cache@v4
with:
path: .mypy_cache
key: mypy
- name: "Make mypy cache directory"
id: cache-dir-mypy
run: mkdir -p -v .mypy_cache
- name: "Run mypy"
run: uv run mypy --non-interactive discord/
tests:
if: ${{ github.event_name != 'schedule' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.13', '3.12', '3.11', '3.10']
steps:
- name: "Checkout Repository"
uses: actions/checkout@v5
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: "Setup UV"
uses: ./.github/actions/sync-uv
with:
groups: 'dev'
- name: "Run tests"
run: uv run tox
tests-pass: # ref: https://github.com/orgs/community/discussions/4324#discussioncomment-3477871
runs-on: ubuntu-latest
needs: [tests]
if: always() && github.event_name != 'schedule'
steps:
- name: Tests succeeded
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1