Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
anorthall committed Apr 27, 2024
1 parent 16df1cb commit 12e547a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint

on:
workflow_call:
workflow_dispatch:
push:
pull_request:

jobs:
ruff:
runs-on: ubuntu-latest
name: Ruff
steps:
- name: Check out source
uses: actions/checkout@v3

- name: Run ruff
uses: chartboost/ruff-action@v1
with:
args: check --verbose
51 changes: 51 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Tests

on:
workflow_call:
workflow_dispatch:
push:
pull_request:

jobs:
run-tests:
name: Django tests
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
PYTHONPATH: ${{ github.workspace }}
BASE_DIR: ${{ github.workspace }}/reportdb

steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: requirements.txt

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run Django tests
working-directory: ${{ env.BASE_DIR }}
run: |
python manage.py test
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repos:
- id: end-of-file-fixer
exclude: app/templates/users/_user_tag.html
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
hooks:
Expand Down

0 comments on commit 12e547a

Please sign in to comment.