Skip to content

CI

CI #6092

Workflow file for this run

name: CI
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
on:
pull_request:
branches: ["master", "main"]
paths-ignore: ["docs/**"]
push:
branches: ["master", "main"]
paths-ignore: ["docs/**"]
merge_group:
jobs:
build-scss:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up node
uses: actions/[email protected]
- name: Install node dependencies
run: npm ci
- name: Build scss
run: npm run build
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
requirements/base.txt
requirements/local.txt
- name: Run pre-commit
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch,stylelint
static-analysis:
runs-on: ubuntu-latest
needs: linter
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Copy .env.example file
uses: canastro/copy-file-action@master
with:
source: ".env.example"
target: ".env"
- name: Build the Stack
run: docker compose build django postgres
- name: Run mypy
run: docker compose run django mypy ds_caselaw_editor_ui judgments
# With no caching at all the entire ci process takes 4m 30s to complete!
pytest:
runs-on: ubuntu-latest
needs: linter
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Copy .env.example file
uses: canastro/copy-file-action@master
with:
source: ".env.example"
target: ".env"
- name: Build the Stack
run: docker compose build postgres django
- name: Run DB Migrations
run: docker compose run --rm django python manage.py migrate --settings=config.settings.test
- name: Run Django Tests with coverage
run: docker compose run django coverage run -m pytest
- name: Generate coverage XML
run: docker compose run django coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
- name: Upload coverage to CodeClimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
- name: Tear down the Stack
run: docker compose down