Update test durations to project artifacts #4
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
name: "Update test durations to project artefacts" | |
on: | |
workflow_dispatch: | |
schedule: | |
# At midnight on Sunday | |
- cron: "0 0 * * 0" | |
env: | |
PYTHON_VERSION: 3.13 | |
jobs: | |
update-test-durations: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgis/postgis:13-3.3-alpine | |
env: | |
POSTGRES_USER: tvp | |
POSTGRES_PASSWORD: tvp | |
POSTGRES_DB: tvp | |
DEBUG: true | |
SECRET_KEY: build_secret | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 5s | |
--health-timeout 5s | |
--health-retries 10 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:7-alpine | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 5s | |
--health-timeout 5s | |
--health-retries 10 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
- name: "Set up python" | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: "Install Poetry and project dependencies" | |
uses: ./.github/actions/poetry | |
with: | |
python-version: ${{ steps.setup-python.outputs.python-version }} | |
- name: "Run pytest with coverage" | |
run: poetry run pytest --disable-warnings --store-durations | |
env: | |
DJANGO_SETTINGS_ENVIRONMENT: AutomatedTests | |
- name: "Upload test durations artefact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test_durations | |
path: .test_durations | |
if-no-files-found: error | |
retention-days: 90 | |
include-hidden-files: true | |
overwrite: true |