this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add workflow steps to upload dummy db artifact for tests (#2616)

Add workflow steps to upload dummy db artifact for tests (#2616)

authored by

Aakash Singh and committed by
GitHub
d3d402db 7454ab93

+33 -4
+15 -1
.github/workflows/reusable-test.yml
··· 38 38 *.cache-to=type=local,dest=/tmp/.buildx-cache-new 39 39 files: docker-compose.yaml,docker-compose.local.yaml 40 40 env: 41 - DOCKER_BUILD_NO_SUMMARY: true 41 + DOCKER_BUILD_SUMMARY: false 42 42 43 43 - name: Start services 44 44 run: | ··· 57 57 - name: Validate integrity of fixtures 58 58 run: make load-dummy-data 59 59 60 + - name: Dump db 61 + if: ${{ inputs.event_name == 'push' || github.event_name == 'push' }} 62 + run: make dump-db 63 + 60 64 - name: Run tests 61 65 run: make test-coverage 62 66 ··· 76 80 with: 77 81 path: /tmp/.buildx-cache 78 82 key: ${{ runner.os }}-buildx-${{ hashFiles('Pipfile.lock', 'docker/dev.Dockerfile') }} 83 + 84 + - name: Upload db artifact 85 + if: ${{ inputs.event_name == 'push' || github.event_name == 'push' }} 86 + uses: actions/upload-artifact@v4 87 + with: 88 + name: care-db-dump 89 + path: care_db.dump 90 + retention-days: 30 91 + compression-level: 0 # file is already compressed 92 + overwrite: true # keep only the last artifact
+2
.gitignore
··· 354 354 *.rdb 355 355 356 356 jwks.b64.txt 357 + 358 + care_db.dump
+16 -3
Makefile
··· 1 - .PHONY: build, re-build, up, down, list, logs, test, makemigrations, reset_db 1 + .PHONY: logs 2 2 3 3 4 4 DOCKER_VERSION := $(shell docker --version 2>/dev/null) ··· 18 18 19 19 build: 20 20 docker compose -f docker-compose.yaml -f $(docker_config_file) build 21 + 22 + pull: 23 + docker compose -f docker-compose.yaml -f $(docker_config_file) pull 21 24 22 25 up: 23 26 docker compose -f docker-compose.yaml -f $(docker_config_file) up -d --wait ··· 40 43 makemigrations: 41 44 docker compose exec backend bash -c "python manage.py makemigrations" 42 45 46 + migrate: 47 + docker compose exec backend bash -c "python manage.py migrate" 48 + 43 49 test: 44 50 docker compose exec backend bash -c "python manage.py test --keepdb --parallel --shuffle" 45 51 ··· 48 54 docker compose exec backend bash -c "coverage combine || true; coverage xml" 49 55 docker compose cp backend:/app/coverage.xml coverage.xml 50 56 51 - reset_db: 57 + dump-db: 58 + docker compose exec db sh -c "pg_dump -U postgres -Fc care > /tmp/care_db.dump" 59 + docker compose cp db:/tmp/care_db.dump care_db.dump 60 + 61 + load-db: 62 + docker compose cp care_db.dump db:/tmp/care_db.dump 63 + docker compose exec db sh -c "pg_restore -U postgres --clean --if-exists -d care /tmp/care_db.dump" 64 + 65 + reset-db: 52 66 docker compose exec backend bash -c "python manage.py reset_db --noinput" 53 - docker compose exec backend bash -c "python manage.py migrate" 54 67 55 68 ruff-all: 56 69 ruff check .