[deps]: Update actions/checkout action to v7 #1025
Workflow file for this run
This file contains hidden or 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: Integration Testing | |
| on: | |
| workflow_dispatch: | |
| # Integration tests are slow, so only run them if relevant files have changed. | |
| # This is done at the workflow level and at the job level. | |
| # Make sure these triggers stay consistent with the 'changed-files' job. | |
| push: | |
| branches: | |
| - 'main' | |
| - 'rc' | |
| paths: | |
| - ".github/workflows/integration-test.yml" # this file | |
| - "docker-compose.yml" # any change to Docker configuration | |
| - "package.json" # dependencies | |
| - "utils/**" # any change to test fixtures | |
| - "libs/services/sync.service.ts" # core sync service used by all directory services | |
| - "libs/services/directory-services/ldap-directory.service*" # LDAP directory service | |
| - "libs/services/directory-services/gsuite-directory.service*" # Google Workspace directory service | |
| - "libs/services/directory-services/entra-id-directory.service*" # Microsoft Entra ID directory service | |
| - "libs/services/directory-services/okta-directory.service*" # Okta directory service | |
| - "libs/services/directory-services/onelogin-directory.service*" # OneLogin directory service | |
| # Add directory services here as we add test coverage | |
| pull_request: | |
| paths: | |
| - ".github/workflows/integration-test.yml" # this file | |
| - "docker-compose.yml" # any change to Docker configuration | |
| - "package.json" # dependencies | |
| - "utils/**" # any change to test fixtures | |
| - "libs/services/sync.service.ts" # core sync service used by all directory services | |
| - "libs/services/directory-services/ldap-directory.service*" # LDAP directory service | |
| - "libs/services/directory-services/gsuite-directory.service*" # Google Workspace directory service | |
| - "libs/services/directory-services/entra-id-directory.service*" # Microsoft Entra ID directory service | |
| - "libs/services/directory-services/okta-directory.service*" # Okta directory service | |
| - "libs/services/directory-services/onelogin-directory.service*" # OneLogin directory service | |
| # Add directory services here as we add test coverage | |
| permissions: | |
| contents: read | |
| checks: write # required by dorny/test-reporter to upload its results | |
| id-token: write # required to use OIDC to login to Azure Key Vault | |
| jobs: | |
| testing: | |
| name: Run integration tests | |
| if: ${{ startsWith(github.head_ref, 'version_bump_') == false }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Get Node version | |
| id: retrieve-node-version | |
| run: | | |
| NODE_NVMRC=$(cat .nvmrc) | |
| NODE_VERSION=${NODE_NVMRC/v/''} | |
| echo "node_version=$NODE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Set up Node | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| node-version: ${{ steps.retrieve-node-version.outputs.node_version }} | |
| - name: Install Node dependencies | |
| run: npm ci | |
| # Get secrets from Azure Key Vault | |
| - name: Azure Login | |
| uses: bitwarden/gh-actions/azure-login@main | |
| with: | |
| subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| tenant_id: ${{ secrets.AZURE_TENANT_ID }} | |
| client_id: ${{ secrets.AZURE_CLIENT_ID }} | |
| - name: Get KV Secrets | |
| id: get-kv-secrets | |
| uses: bitwarden/gh-actions/get-keyvault-secrets@main | |
| with: | |
| keyvault: gh-directory-connector | |
| secrets: "GOOGLE-ADMIN-USER,GOOGLE-CLIENT-EMAIL,GOOGLE-DOMAIN,GOOGLE-PRIVATE-KEY,ENTRA-TENANT-ID,ENTRA-APPLICATION-ID,ENTRA-KEY,OKTA-ORG-URL,OKTA-TOKEN,ONELOGIN-CLIENT-ID,ONELOGIN-CLIENT-SECRET" | |
| - name: Azure Logout | |
| uses: bitwarden/gh-actions/azure-logout@main | |
| # Only run relevant tests depending on what files have changed. | |
| # This should be kept consistent with the workflow level triggers. | |
| # Note: docker-compose.yml is only used for ldap for now | |
| - name: Get changed files | |
| id: changed-files | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| with: | |
| list-files: shell | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Add directory services here as we add test coverage | |
| filters: | | |
| common: | |
| - '.github/workflows/integration-test.yml' | |
| - 'utils/**' | |
| - 'package.json' | |
| - 'libs/services/sync.service.ts' | |
| ldap: | |
| - 'docker-compose.yml' | |
| - 'libs/services/directory-services/ldap-directory.service*' | |
| google: | |
| - 'libs/services/directory-services/gsuite-directory.service*' | |
| entra: | |
| - 'libs/services/directory-services/entra-id-directory.service*' | |
| okta: | |
| - 'libs/services/directory-services/okta-directory.service*' | |
| onelogin: | |
| - 'libs/services/directory-services/onelogin-directory.service*' | |
| # LDAP | |
| - name: Setup LDAP integration tests | |
| if: steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.ldap == 'true' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install mkcert | |
| npm run test:integration:setup | |
| echo "LDAP container is ready!" | |
| - name: Run LDAP integration tests | |
| if: steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.ldap == 'true' | |
| env: | |
| JEST_JUNIT_UNIQUE_OUTPUT_NAME: "true" # avoids junit outputs from clashing | |
| run: node --experimental-vm-modules node_modules/.bin/jest ldap-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-ldap | |
| # Google Workspace | |
| - name: Run Google Workspace integration tests | |
| if: steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.google == 'true' | |
| env: | |
| GOOGLE_DOMAIN: ${{ steps.get-kv-secrets.outputs.GOOGLE-DOMAIN }} | |
| GOOGLE_ADMIN_USER: ${{ steps.get-kv-secrets.outputs.GOOGLE-ADMIN-USER }} | |
| GOOGLE_CLIENT_EMAIL: ${{ steps.get-kv-secrets.outputs.GOOGLE-CLIENT-EMAIL }} | |
| GOOGLE_PRIVATE_KEY: ${{ steps.get-kv-secrets.outputs.GOOGLE-PRIVATE-KEY }} | |
| JEST_JUNIT_UNIQUE_OUTPUT_NAME: "true" # avoids junit outputs from clashing | |
| run: | | |
| node --experimental-vm-modules node_modules/.bin/jest gsuite-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-google | |
| # Microsoft Entra ID | |
| - name: Run Entra ID integration tests | |
| if: steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.entra == 'true' | |
| env: | |
| ENTRA_TENANT_ID: ${{ steps.get-kv-secrets.outputs.ENTRA-TENANT-ID }} | |
| ENTRA_APPLICATION_ID: ${{ steps.get-kv-secrets.outputs.ENTRA-APPLICATION-ID }} | |
| ENTRA_KEY: ${{ steps.get-kv-secrets.outputs.ENTRA-KEY }} | |
| JEST_JUNIT_UNIQUE_OUTPUT_NAME: "true" # avoids junit outputs from clashing | |
| run: | | |
| node --experimental-vm-modules node_modules/.bin/jest entra-id-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-entra | |
| # Okta | |
| - name: Run Okta integration tests | |
| if: steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.okta == 'true' | |
| env: | |
| OKTA_ORG_URL: ${{ steps.get-kv-secrets.outputs.OKTA-ORG-URL }} | |
| OKTA_TOKEN: ${{ steps.get-kv-secrets.outputs.OKTA-TOKEN }} | |
| JEST_JUNIT_UNIQUE_OUTPUT_NAME: "true" # avoids junit outputs from clashing | |
| run: | | |
| node --experimental-vm-modules node_modules/.bin/jest okta-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-okta | |
| # OneLogin | |
| - name: Run OneLogin integration tests | |
| if: steps.changed-files.outputs.common == 'true' || steps.changed-files.outputs.onelogin == 'true' | |
| env: | |
| ONELOGIN_CLIENT_ID: ${{ steps.get-kv-secrets.outputs.ONELOGIN-CLIENT-ID }} | |
| ONELOGIN_CLIENT_SECRET: ${{ steps.get-kv-secrets.outputs.ONELOGIN-CLIENT-SECRET }} | |
| ONELOGIN_REGION: "us" | |
| JEST_JUNIT_UNIQUE_OUTPUT_NAME: "true" # avoids junit outputs from clashing | |
| run: | | |
| node --experimental-vm-modules node_modules/.bin/jest onelogin-directory.service.integration.spec.ts --coverage --coverageDirectory=coverage-onelogin | |
| - name: Report test results | |
| id: report | |
| uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0 | |
| # This will skip the job if it's a pull request from a fork, because that won't have permission to upload test results. | |
| # PRs from the repository and all other events are OK. | |
| if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && !cancelled() | |
| with: | |
| name: Test Results | |
| path: "junit.xml*" | |
| reporter: jest-junit | |
| fail-on-error: true | |
| - name: Upload coverage to codecov.io | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| - name: Upload results to codecov.io | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| with: | |
| report_type: test_results |