-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): set up Lighthouse auditing in CI
For now, this just hits the main pages
- Loading branch information
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
SECRET_KEY='django-insecure-w!h85bp^$$e8gm%c23r!0%9i7yzd=6w$$s&ic+6!%306&kj8@k*5' | ||
DEBUG='' | ||
DB_HOST=localhost | ||
ALLOWED_HOSTS=localhost | ||
DB_PORT=5432 | ||
DB_NAME=term_db | ||
DB_USER=sadilar | ||
DB_PASSWORD=sadilar | ||
LOGGING_FILE=/home/runner/work/term_platform/term_platform/app/debug.log | ||
LOGGING_HANDLERS_LEVEL=INFO | ||
LOGGING_LOGGERS_LEVEL=INFO | ||
LOGGING_LOGGERS_DJANGO_LEVEL=INFO | ||
TESTING_DIR=/home/runner/work/term_platform/term_platform/app/general/tests/files/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,3 +65,46 @@ jobs: | |
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: term_db | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- 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: Setup LHCI env | ||
run: cp .env.lhci app/.env | ||
- name: Run Lighthouse | ||
run: cd app && lhci autorun | ||
- name: Archive Lighthouse results | ||
if: always() # Ensure results are uploaded on failure too | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: lighthouse-report | ||
path: app/.lighthouseci/ | ||
include-hidden-files: true | ||
- name: Archive Django logs | ||
if: always() # Ensure logs are uploaded on failure too | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: django-logs | ||
path: app/debug.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,6 @@ app/media/ | |
/logging/ | ||
/pdf_uploads/ | ||
/pdf_upload_completed/ | ||
|
||
# Generated Lighthouse CI artifacts | ||
.lighthouseci/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module.exports = { | ||
ci: { | ||
collect: { | ||
// We don't care about variable page performance metrics in CI - just static asserts | ||
numberOfRuns: 1, | ||
startServerCommand: "../entrypoint.sh", | ||
url: [ | ||
"http://localhost:8000", | ||
"http://localhost:8000/search/", | ||
"http://localhost:8000/institutions/", | ||
"http://localhost:8000/projects/", | ||
"http://localhost:8000/documents/", | ||
"http://localhost:8000/languages/", | ||
"http://localhost:8000/subjects/" | ||
] | ||
}, | ||
assert: { | ||
"preset": "lighthouse:recommended", | ||
"assertions": { | ||
// Gunicorn doesn't do this, but the reverse proxy in front of it does | ||
"uses-text-compression": false, | ||
|
||
// We don't think these are worth worrying about for now | ||
"unminified-javascript": false, | ||
"unused-css-rules": false, | ||
"unminified-css": false, | ||
"render-blocking-resources": false, | ||
} | ||
} | ||
} | ||
} |