|
| 1 | +# Copyright 2021 Collate |
| 2 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +# you may not use this file except in compliance with the License. |
| 4 | +# You may obtain a copy of the License at |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# Unless required by applicable law or agreed to in writing, software |
| 7 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 8 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 9 | +# See the License for the specific language governing permissions and |
| 10 | +# limitations under the License. |
| 11 | + |
| 12 | +# This workflow runs SSO authentication tests nightly to verify SSO providers are working correctly. |
| 13 | +# Tests are excluded from regular Playwright runs to avoid requiring SSO credentials for all CI/CD. |
| 14 | + |
| 15 | +name: SSO Authentication Tests (Nightly) |
| 16 | + |
| 17 | +on: |
| 18 | + # schedule: |
| 19 | + # # Run every night at 2 AM UTC |
| 20 | + # - cron: '0 2 * * *'s |
| 21 | + workflow_dispatch: # Allow manual trigger |
| 22 | + inputs: |
| 23 | + sso_provider: |
| 24 | + description: "SSO Provider to test" |
| 25 | + required: true |
| 26 | + default: "google" |
| 27 | + type: choice |
| 28 | + options: |
| 29 | + - google |
| 30 | + - okta |
| 31 | + - azure |
| 32 | + - auth0 |
| 33 | + - saml |
| 34 | + - cognito |
| 35 | + - all |
| 36 | + |
| 37 | +permissions: |
| 38 | + contents: read |
| 39 | + |
| 40 | +concurrency: |
| 41 | + group: sso-auth-tests-${{ github.workflow }}-${{ github.event.inputs.sso_provider || 'scheduled' }} |
| 42 | + cancel-in-progress: true |
| 43 | + |
| 44 | +jobs: |
| 45 | + sso-auth-tests: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + timeout-minutes: 90 |
| 48 | + environment: test |
| 49 | + |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + provider: ${{ github.event.inputs.sso_provider == 'all' && fromJSON('["google", "okta", "azure", "auth0"]') || github.event.inputs.sso_provider && fromJSON(format('["{0}"]', github.event.inputs.sso_provider)) || fromJSON('["google"]') }} |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Free Disk Space (Ubuntu) |
| 57 | + uses: jlumbroso/free-disk-space@main |
| 58 | + with: |
| 59 | + tool-cache: false |
| 60 | + android: true |
| 61 | + dotnet: true |
| 62 | + haskell: true |
| 63 | + large-packages: false |
| 64 | + swap-storage: true |
| 65 | + docker-images: false |
| 66 | + |
| 67 | + - name: Checkout |
| 68 | + uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: Cache Maven Dependencies |
| 71 | + id: cache-output |
| 72 | + uses: actions/cache@v4 |
| 73 | + with: |
| 74 | + path: ~/.m2 |
| 75 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 76 | + restore-keys: | |
| 77 | + ${{ runner.os }}-maven- |
| 78 | +
|
| 79 | + - name: Setup OpenMetadata Test Environment |
| 80 | + uses: ./.github/actions/setup-openmetadata-test-environment |
| 81 | + with: |
| 82 | + python-version: "3.10" |
| 83 | + args: "-d mysql" |
| 84 | + ingestion_dependency: "mysql,elasticsearch" |
| 85 | + |
| 86 | + - name: Setup Node.js |
| 87 | + uses: actions/setup-node@v4 |
| 88 | + with: |
| 89 | + node-version-file: "openmetadata-ui/src/main/resources/ui/.nvmrc" |
| 90 | + |
| 91 | + - name: Install UI dependencies |
| 92 | + working-directory: openmetadata-ui/src/main/resources/ui |
| 93 | + run: yarn --ignore-scripts --frozen-lockfile |
| 94 | + |
| 95 | + - name: Install Playwright Browsers |
| 96 | + run: npx playwright@1.51.1 install --with-deps chromium |
| 97 | + |
| 98 | + - name: Run SSO Authentication Tests |
| 99 | + working-directory: openmetadata-ui/src/main/resources/ui |
| 100 | + run: npx playwright test playwright/e2e/Auth/SSOAuthentication.spec.ts --workers=1 |
| 101 | + env: |
| 102 | + SSO_PROVIDER_TYPE: ${{ matrix.provider }} |
| 103 | + SSO_USERNAME: ${{ secrets[format('{0}_SSO_USERNAME', upper(matrix.provider))] }} |
| 104 | + SSO_PASSWORD: ${{ secrets[format('{0}_SSO_PASSWORD', upper(matrix.provider))] }} |
| 105 | + PLAYWRIGHT_IS_OSS: true |
| 106 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 107 | + timeout-minutes: 60 |
| 108 | + |
| 109 | + - name: Upload test results |
| 110 | + if: always() |
| 111 | + uses: actions/upload-artifact@v4 |
| 112 | + with: |
| 113 | + name: sso-auth-test-results-${{ matrix.provider }} |
| 114 | + path: openmetadata-ui/src/main/resources/ui/playwright/output/playwright-report |
| 115 | + retention-days: 7 |
| 116 | + |
| 117 | + - name: Upload test traces |
| 118 | + if: failure() |
| 119 | + uses: actions/upload-artifact@v4 |
| 120 | + with: |
| 121 | + name: sso-auth-test-traces-${{ matrix.provider }} |
| 122 | + path: openmetadata-ui/src/main/resources/ui/playwright/output/test-results/**/trace.zip |
| 123 | + retention-days: 7 |
| 124 | + |
| 125 | + - name: Clean Up |
| 126 | + if: always() |
| 127 | + run: | |
| 128 | + cd ./docker/development |
| 129 | + docker compose down --remove-orphans |
| 130 | + sudo rm -rf ${PWD}/docker-volume |
| 131 | +
|
| 132 | + notify: |
| 133 | + needs: sso-auth-tests |
| 134 | + runs-on: ubuntu-latest |
| 135 | + if: failure() |
| 136 | + steps: |
| 137 | + - name: Send notification on failure |
| 138 | + run: | |
| 139 | + echo "SSO Authentication tests failed for one or more providers" |
| 140 | + # Add your notification logic here (Slack, email, etc.) |
0 commit comments