-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action that updates test durations on a cron schedule
- Loading branch information
1 parent
708b43a
commit d157735
Showing
1 changed file
with
74 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,74 @@ | ||
name: "Create a new PR to update test durations" | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Run on the first day of every month | ||
- cron: "0 0 1 * *" | ||
|
||
env: | ||
POETRY_VERSION: 2.0.1 | ||
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: | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
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: "Create Pull Request" | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
title: "[github-actions] Update test durations" | ||
commit-message: "Update test durations" | ||
branch: update-test-durations | ||
delete-branch: true | ||
labels: github_actions |