Skip to content

Python CI

Python CI #25

Workflow file for this run

name: Python CI
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
env:
LATEST_SUPPORTED_PY: "3.14"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.LATEST_SUPPORTED_PY }}
- name: Run flake8 verification
run: ./scripts/lint.sh
typecheck:
name: Typecheck
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.LATEST_SUPPORTED_PY }}
- name: Run mypy verification
run: ./scripts/run_mypy.sh
unittest:
name: Unit tests
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "pypy3.10"
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U pip
pip install -r requirements.txt
pip install -r requirements/testing.txt
- name: Run tests
run: |
pytest --junitxml=reports/test.xml
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
directory: ./reports/
fail_ci_if_error: true
flags: ${{ matrix.python-version }}
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
codecov:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ env.LATEST_SUPPORTED_PY }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.LATEST_SUPPORTED_PY }}
- name: Install dependencies
run: |
pip install -U pip
pip install -r requirements.txt
pip install -r requirements/testing.txt
- name: Run all tests for codecov
run: |
pytest --cov=./slack_cli_hooks/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
fail_ci_if_error: true
report_type: coverage
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
health-score:
name: Health Score
needs: codecov
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
checks: write
steps:
- name: Setup repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Report health score
uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1
with:
codecov_token: ${{ secrets.FILS_CODECOV_API_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
extension: py
include: slack_cli_hooks