@@ -3,22 +3,26 @@ name: Integration Testing
33on :
44 workflow_dispatch :
55 # Integration tests are slow, so only run them if relevant files have changed.
6- # This is done at the workflow level and at the job level -
7- # make sure this stays consistent with the changed-files job.
6+ # This is done at the workflow level and at the job level.
7+ # Make sure these triggers stay consistent with the ' changed-files' job.
88 push :
99 paths :
1010 - " .github/workflows/integration-test.yml" # this file
1111 - " docker-compose.yml" # any change to Docker configuration
1212 - " package.json" # dependencies
13- - " src/services/directory-services/**" # any directory service
1413 - " utils/**" # any change to test fixtures
14+ - " src/services/directory-services/ldap-directory.service*" # LDAP directory service
15+ - " src/services/directory-services/gsuite-directory.service*" # Google Workspace directory service
16+ # Add directory services here as we add test coverage
1517 pull_request :
1618 paths :
1719 - " .github/workflows/integration-test.yml" # this file
1820 - " docker-compose.yml" # any change to Docker configuration
1921 - " package.json" # dependencies
20- - " src/services/directory-services/**" # any directory service
2122 - " utils/**" # any change to test fixtures
23+ - " src/services/directory-services/ldap-directory.service*" # LDAP directory service
24+ - " src/services/directory-services/gsuite-directory.service*" # Google Workspace directory service
25+ # Add directory services here as we add test coverage
2226permissions :
2327 contents : read
2428 checks : write # required by dorny/test-reporter to upload its results
@@ -53,22 +57,24 @@ jobs:
5357
5458 # Only run relevant tests depending on what files have changed.
5559 # This should be kept consistent with the workflow level triggers.
60+ # Note: docker-compose.yml is only used for ldap for now
5661 - name : Get changed files
5762 id : changed-files
5863 uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
5964 with :
6065 list-files : shell
6166 token : ${{ secrets.GITHUB_TOKEN }}
67+ # Add directory services here as we add test coverage
6268 filters : |
6369 common:
6470 - '.github/workflows/integration-test.yml'
6571 - 'utils/**/*'
6672 - 'package.json'
6773 ldap:
6874 - 'docker-compose.yml'
69- - 'src/services/** /ldap-directory.service*'
75+ - 'src/services/directory-services /ldap-directory.service*'
7076 google:
71- - 'src/services/** /gsuite-directory.service*'
77+ - 'src/services/directory-services /gsuite-directory.service*'
7278
7379 # LDAP
7480 - name : Setup LDAP integration tests
8086
8187 - name : Run LDAP integration tests
8288 if : steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.ldap == 'true'
83- run : npx jest ldap-directory.service.integration.spec.ts --coverage
89+ run : npx jest ldap-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-ldap
8490
8591 # Google Workspace
8692 - name : Run Google Workspace integration tests
@@ -91,23 +97,22 @@ jobs:
9197 GOOGLE_CLIENT_EMAIL : ${{ vars.GOOGLE_CLIENT_EMAIL }}
9298 GOOGLE_PRIVATE_KEY : ${{ secrets.GOOGLE_PRIVATE_KEY }}
9399 run : |
94- GOOGLE_DOMAIN="$GOOGLE_DOMAIN" \
95- GOOGLE_ADMIN_USER="$GOOGLE_ADMIN_USER" \
96- GOOGLE_CLIENT_EMAIL="$GOOGLE_CLIENT_EMAIL" \
97- GOOGLE_PRIVATE_KEY="$GOOGLE_PRIVATE_KEY" \
98- npx jest gsuite-directory.service.integration.spec.ts --coverage
100+ npx jest gsuite-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-google
99101
100102 - name : Report test results
103+ id : report
101104 uses : dorny/test-reporter@dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3 # v2.1.1
102- if : ${{ github.event.pull_request.head.repo.full_name == github.repository && !cancelled() }}
105+ if : github.event.pull_request.head.repo.full_name == github.repository && !cancelled() && steps.changed-files.outputs.changes != '[]'
103106 with :
104107 name : Test Results
105108 path : " junit.xml"
106109 reporter : jest-junit
107110 fail-on-error : true
108111
109112 - name : Upload coverage to codecov.io
113+ if : steps.report.conclusion == 'success'
110114 uses : codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5.2.0
111115
112116 - name : Upload results to codecov.io
117+ if : steps.report.conclusion == 'success'
113118 uses : codecov/test-results-action@4e79e65778be1cecd5df25e14af1eafb6df80ea9 # v1.0.2
0 commit comments