Skip to content

[pre-commit.ci] pre-commit autoupdate #329

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #329

Workflow file for this run

---
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
name: Python CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.12"
jobs:
python_build:
name: Test and build Python
env:
PYTHONDEVMODE: 1
FF_SLACK_SKIP_CHECKS: true
ENABLE_JIRA: true
ENABLE_RAID: true
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
os: ["ubuntu-latest"]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:13-alpine
# Provide the password for postgres
env:
POSTGRES_DB: ff_dev
POSTGRES_USER: firefighter
POSTGRES_PASSWORD: firefighter
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
# Docker Hub image
image: redis:6-alpine
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
id: setup-pdm
with:
python-version: ${{ matrix.python-version }}
version: "2.12.4"
cache: true
allow-python-prereleases: true
# Needed for CSS and JS minification
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: pdm install -v && pdm info
- name: Run Tests
run: |
cp .env.example .env
pdm run collectstatic
pdm run tests-cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
- name: Type check with mypy
run: |
pdm run lint-mypy
- name: Lint with ruff
run: |
pdm run lint-ruff --output-format=github --exit-non-zero-on-fix
- name: Build with pdm
run: |
pdm build
- name: Publish Python artifacts on Github artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.python-version == env.PYTHON_VERSION }}
with:
name: python-artifacts
path: |
dist/*.whl
dist/*.tar.gz