Skip to content

fixup! chore(ci): set up Lighthouse auditing in CI #858

fixup! chore(ci): set up Lighthouse auditing in CI

fixup! chore(ci): set up Lighthouse auditing in CI #858

Workflow file for this run

name: Testing Django
on: [ pull_request, push ] # activates the workflow when there is a push or pull request in the repo
jobs:
test_project:
runs-on: ubuntu-latest # operating system your code will run on
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: sadilar
POSTGRES_PASSWORD: sadilar
POSTGRES_DB: test_db_1
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
sudo apt-get install -y gettext
- name: Run linting tools
run: |
cd app/
ruff format .
- name: Create logging folder
run: |
sudo mkdir -p /logging
sudo chown runner:runner /logging
- name: Compile Translation Messages
run: |
cp .env.testing app/.env
cd app/
python manage.py makemessages --all
python manage.py compilemessages
- name: Run validate_templates
run: |
export DJANGO_TEST_PROCESSES=1
cp .env.testing app/.env
cd app/
mkdir -p static_files
python manage.py validate_templates --ignore-app django_filters
- name: Run Tests
run: |
cp .env.testing app/.env
cd app/
mkdir -p static_files
python manage.py test
env:
DJANGO_SETTINGS_MODULE: app.settings
DATABASE_URL: postgres://sadilar:sadilar@localhost:5432/test_db
- name: Manager Check
run: |
cd app/
python manage.py check
lighthouse:
runs-on: ubuntu-latest # operating system your code will run on
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: sadilar
POSTGRES_PASSWORD: sadilar
POSTGRES_DB: test_db_1
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
sudo apt-get install -y gettext
npm install -g @lhci/[email protected]
- name: Migrate database
run: cd app && DB_NAME=test_db_1 DB_USER=sadilar DB_PASSWORD=sadilar python manage.py migrate
- name: Run Lighthouse
run: cd app && lhci autorun