CI #124
This file contains 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: CI | |
on: | |
workflow_dispatch: | |
inputs: | |
test_env: | |
type: choice | |
description: 'Select the wether to run the tests in the CI environment or Production environment' | |
default: 'PROD' | |
options: | |
- CI | |
- PROD | |
defaults: | |
run: | |
working-directory: .tests | |
shell: bash | |
jobs: | |
test: | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
strategy: | |
fail-fast: false | |
matrix: | |
idx: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
env: | |
CSAE_ENV_PASSWORD: '${{ secrets.CSAE_ENV_PASSWORD }}' | |
CSAE_CLEARSCAPE_API_KEY: '${{ secrets.CSAE_CLEARSCAPE_API_KEY }}' | |
CSAE_CI_CLEARSCAPE_API_KEY: '${{ secrets.CSAE_CI_CLEARSCAPE_API_KEY }}' | |
CSAE_PARALLEL_TESTS_COUNT: '${{ vars.CSAE_PARALLEL_TESTS_COUNT }}' | |
CSAE_WORKERS_COUNT: '${{ vars.CSAE_WORKERS_COUNT }}' | |
CSAE_CI_JOB_IDX: ${{ matrix.idx }} | |
TEST_ENV: ${{ github.event.inputs.test_env }} | |
CSAE_CI_JOB_COUNT: 10 | |
name: Job ${{ matrix.idx }} | |
timeout-minutes: 1440 | |
runs-on: ubuntu-latest | |
steps: | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
workload_identity_provider: 'projects/561066095864/locations/global/workloadIdentityPools/github/providers/jupyter-demos' | |
service_account: '[email protected]' | |
- id: 'secrets' | |
uses: 'google-github-actions/get-secretmanager-secrets@v2' | |
with: | |
secrets: |- | |
openai:clearscape-ci/JUPYTER_NOTEBOOK_CI_OPEN_AI_KEY | |
export_to_environment: true | |
# Example of using the output | |
- name: 'Set up the JUPYTER_NOTEBOOK_CI_OPEN_AI_KEY to OPEN_AI_KEY' | |
run: | | |
printenv | |
env: | |
OPEN_AI_KEY: '${{ steps.secrets.outputs.openai }}' | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Define env name | |
id: define-environment-name | |
run: | | |
echo "env-name=ci-$(date +%s%N)" >> $GITHUB_OUTPUT | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright browsers | |
run: | | |
npx playwright install --with-deps | |
- name: Find all Jupyter notebooks | |
run: find .. -name '*.ipynb' | sort > ./files.txt | |
- name: Start test environments | |
id: start-test-environment | |
run: npx ts-node pre_create_env.ts | |
- name: Run Playwright tests | |
run: | | |
npx playwright test | |
- name: Delete test environments | |
if: always() | |
run: npx ts-node post_delete_env.ts | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: .tests/playwright-report/ | |
retention-days: 30 |