clear cache if update_active_users hits IntegrityErrors #1131
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: pre-submit | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
- uses: pre-commit/action@v2.0.0 | |
- uses: isort/isort-action@v1.1.0 | |
test: | |
runs-on: ubuntu-latest | |
services: | |
# See https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: cardboard_user | |
POSTGRES_PASSWORD: cardboard_password | |
POSTGRES_DB: cardboard | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10.x" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
- name: Install python deps | |
run: poetry install --no-interaction | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install nodejs deps | |
run: yarn install | |
- name: Configure test environment | |
run: cp .env.test .env | |
- name: Build the app | |
run: | | |
poetry run python manage.py migrate # Tests require initial database migration. | |
yarn build # Build static React files before running Django collecstatic. | |
poetry run python manage.py collectstatic # Tests require static files. | |
env: | |
DATABASE_URL: postgres://cardboard_user:cardboard_password@localhost:5432/cardboard | |
- name: Run all tests with coverage | |
run: poetry run coverage run --source='.' manage.py test | |
env: | |
DATABASE_URL: postgres://cardboard_user:cardboard_password@localhost:5432/cardboard | |
- name: Upload coverage data | |
uses: codecov/codecov-action@v1 |