Skip to content

Commit

Permalink
test: Run only tests affected by changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
novakzaballa committed Oct 22, 2023
1 parent 50f964b commit b231974
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/api-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ jobs:
opts: --no-input --dry-run --check
run: make django-make-migrations

- name: Restore cached testmon data
id: cache-testmon-restore
uses: actions/cache/restore@v3
with:
path: |
./
key: testmon-data

- name: Run Tests
env:
DOTENV_OVERRIDE_FILE: .env-ci
Expand All @@ -78,3 +86,11 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: PYTHON

- name: Save testmon data cache
id: cache-testmon-save
uses: actions/cache/save@v3
with:
path: |
./testmon*
key: testmon-data
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ src/CI_COMMIT_SHA
.DS_Store
.idea
*.iml
api/.testmondata
api/.testmondata-shm
api/.testmondata-wal
2 changes: 1 addition & 1 deletion api/.env-ci
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
ANALYTICS_DATABASE_URL=postgres://postgres:postgres@localhost:5432/analytics
PYTEST_ADDOPTS=--cov . --cov-report xml -n auto --dist worksteal
PYTEST_ADDOPTS=--cov . --cov-report xml -n auto --dist worksteal --testmon
33 changes: 19 additions & 14 deletions api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ pip-tools = "~6.13.0"
pytest-cov = "~4.1.0"
datamodel-code-generator = "~0.22"
requests-mock = "^1.11.0"
pytest-testmon = "^2.0.13"

[build-system]
requires = ["poetry-core>=1.5.0"]
Expand Down

0 comments on commit b231974

Please sign in to comment.