[pre-commit.ci] pre-commit autoupdate #952
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Django CI | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/github_actions | |
DJANGO_SETTINGS_MODULE: website.settings.test | |
strategy: | |
matrix: | |
python-version: [3.11] | |
services: | |
postgres: | |
image: postgres:13-alpine | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DB: github_actions | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout code # checking our the code at current commit that triggers the workflow | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4.7.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache dependency # caching dependency will make our build faster. | |
uses: actions/cache@v3 # for more info checkout pip section documentation at https://github.com/actions/cache | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Check Code Style | |
uses: pre-commit/action@v3.0.0 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip wheel pip-tools | |
python -m pip install -r requirements-dev.txt | |
- name: Run Django Check | |
env: | |
SECRET_KEY: 3573c6f0e4f77934f1f41f19cbd9704eb841c96ff96f6974bab92dac01c61741448ed427c680e5b26c23fcc2a79df2e2e514 | |
run: DJANGO_SETTINGS_MODULE=website.settings.prod python manage.py check --deploy | |
- name: Run Mypy Check | |
run: mypy . | |
- name: Run Tests | |
run: | | |
python manage.py collectstatic --noinput | |
coverage run -m pytest -n auto |