Skip to content

Commit

Permalink
Fix CI not running tests for pull-requests (#268)
Browse files Browse the repository at this point in the history
* Fix CI not running tests for pull-requests

---------

Co-authored-by: Sonny Bakker <[email protected]>
  • Loading branch information
SonnyBA and Sonny Bakker authored Oct 18, 2024
1 parent 2963f4c commit cd377ad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,33 @@ env:
jobs:
# determine changed files to decide if certain jobs can be skipped or not
changed-files:
runs-on: ubuntu-latest # windows-latest | macos-latest
runs-on: ubuntu-latest
name: Determine changed files
steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Get changed PY files
id: changed-py-files
uses: tj-actions/changed-files@v41
with:
files: |
^src/.+\.py
- name: Get changed JS files
id: changed-js-files
uses: tj-actions/changed-files@v41
- name: Changed files
id: app-files
uses: tj-actions/changed-files@v45
with:
files: |
^src/.+\.js
- name: Get changed requirements files
id: changed-requirements
uses: tj-actions/changed-files@v41
with:
files: ^requirements/.+\.txt$
src/**/*.py
requirements/*.txt
- name: Display changed files
if: steps.app-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.app-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
outputs:
changed-py-files: ${{ steps.changed-py-files.outputs.any_changed }}
changed-js-files: ${{ steps.changed-js-files.outputs.any_changed }}
changed-requirements: ${{ steps.changed-requirements.outputs.any_changed }}
changed-files: ${{ steps.app-files.outputs.any_changed }}

tests:
name: Tests (PG ${{ matrix.postgres }})
Expand All @@ -58,7 +55,7 @@ jobs:
- changed-files

# only run tests if source files have changed (e.g. skip for PRs that only update docs)
if: ${{ needs.changed-files.outputs.changed-py-files == 'true'|| needs.changed-files.outputs.changed-requirements == 'true'|| github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
if: needs.changed-files.outputs.changed-files == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'

strategy:
matrix:
Expand Down
5 changes: 5 additions & 0 deletions src/openklant/components/klantinteracties/tests/test_admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from uuid import uuid4

from django.conf import settings
from django.test import override_settings
from django.urls import reverse

from django_webtest import WebTest
Expand All @@ -25,6 +27,9 @@ def _login_user(self, username: str, password: str) -> None:

self.assertRedirects(redirect, reverse("admin:index"))

@override_settings(
MAYKIN_2FA_ALLOW_MFA_BYPASS_BACKENDS=settings.AUTHENTICATION_BACKENDS
)
def test_search(self):
nummer_persoon = PersoonFactory(
partij__nummer="123456789",
Expand Down
1 change: 0 additions & 1 deletion src/openklant/conf/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

os.environ.setdefault("RELEASE", "dev")
os.environ.setdefault("LOG_REQUESTS", "no")
os.environ.setdefault("DISABLE_2FA", "yes")

from .base import * # noqa isort:skip

Expand Down

0 comments on commit cd377ad

Please sign in to comment.