mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 01:11:55 +02:00
Github actions for running pa11y scans
This commit is contained in:
parent
d2da8d1d8f
commit
049bbac27e
3 changed files with 91 additions and 10 deletions
28
.github/actions/run-server/action.yml
vendored
Normal file
28
.github/actions/run-server/action.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: "Run Django server"
|
||||
description: "Run django server in the background for scans to access"
|
||||
inputs:
|
||||
django_settings_module:
|
||||
description: DJANGO_SETTINGS_MODULE to use. Defaults to registrar.config.settings
|
||||
required: false
|
||||
default: registrar.config.settings
|
||||
database_url:
|
||||
description: DATABASE_URL to set
|
||||
required: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Start server in background"
|
||||
shell: bash
|
||||
env:
|
||||
DJANGO_SETTINGS_MODULE: ${{ inputs.django_settings_module }}
|
||||
DATABASE_URL: ${{ inputs.database_url }}
|
||||
run: pipenv run python manage.py runserver 0.0.0.0:8080 &
|
||||
working-directory: ./src
|
||||
|
||||
- name: "Wait for startup"
|
||||
shell: bash
|
||||
run: sleep 5
|
||||
|
||||
- name: "Verify response working"
|
||||
shell: bash
|
||||
run: curl http://localhost:8080/health -I
|
38
.github/actions/setup-project/action.yaml
vendored
Normal file
38
.github/actions/setup-project/action.yaml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: Set up languages and dependencies
|
||||
description: Setup python and dependencies and establish database schema
|
||||
nputs:
|
||||
django_settings_module:
|
||||
description: DJANGO_SETTINGS_MODULE to use. Defaults to registrar.config.settings
|
||||
required: false
|
||||
default: Cregistrar.config.settings
|
||||
database_url:
|
||||
description: DATABASE_URL to set
|
||||
required: false
|
||||
default: postgres://user:feedabee@localhost:5432/app
|
||||
outputs:
|
||||
database_url:
|
||||
value: ${{ inputs.database_url }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install Python 3.10
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10' # matches the version from runtime.txt
|
||||
|
||||
- name: Install Django and dependencies
|
||||
working-directory: ./src
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pipenv
|
||||
pipenv install --system --dev
|
||||
|
||||
- name: Set up database schema
|
||||
env:
|
||||
DJANGO_SETTINGS_MODULE: ${{ inputs.django_settings_module }}
|
||||
DATABASE_URL: ${{ inputs.database_url }}
|
||||
working-directory: ./src
|
||||
shell: bash
|
||||
run: pipenv run python manage.py migrate
|
35
.github/workflows/test.yaml
vendored
35
.github/workflows/test.yaml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
|||
|
||||
python-test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
services: &service-dependencies # store this block to use it again
|
||||
postgres:
|
||||
image: postgres
|
||||
env:
|
||||
|
@ -53,15 +53,11 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v3
|
||||
- name: Install Django
|
||||
working-directory: ./src
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pipenv
|
||||
pipenv install --system --dev
|
||||
- name: Test
|
||||
|
||||
- name: Set up python and dependencies
|
||||
uses: ./.github/actions/setup-project
|
||||
|
||||
- name: Unit tests
|
||||
working-directory: ./src
|
||||
env:
|
||||
PYTHONUNBUFFERED: yup
|
||||
|
@ -70,3 +66,22 @@ jobs:
|
|||
DJANGO_SECRET_KEY: feedabee
|
||||
DJANGO_DEBUG: True
|
||||
run: ./manage.py test
|
||||
|
||||
pa11y-scan:
|
||||
runs-on: ubuntu-latest
|
||||
services: *service-dependencies # repeat service description from above
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up python and dependencies
|
||||
id: setup
|
||||
uses: ./.github/actions/setup-project
|
||||
|
||||
- uses: ./.github/actions/run-server
|
||||
with:
|
||||
database_url: ${{ steps.setup.outputs.database_url }}
|
||||
|
||||
- name: Accessibility Scan
|
||||
working-directory: ./src
|
||||
run: npm run pa11y-ci
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue