-
Notifications
You must be signed in to change notification settings - Fork 22
147 lines (142 loc) · 5.72 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Nightly tests
on:
schedule:
- cron: '0 0 * * *'
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
notebooks:
description: 'The path to the notebooks to test. leave empty to test all notebooks'
required: false
ignore_blacklist:
type: 'boolean'
description: 'Ignore the blacklist and run all tests'
required: false
default: false
defaults:
run:
working-directory: .tests
shell: bash
jobs:
playwright-tests:
permissions:
contents: 'read'
id-token: 'write'
strategy:
fail-fast: false
matrix: ${{ github.event.inputs.notebooks == '' && fromJson('{"idx":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}') || fromJson('{"idx":[1]}') }}
env:
CSAE_NOTEBOOKS: ${{ github.event.inputs.notebooks }}
CSAE_ENV_PASSWORD: ${{ secrets.CSAE_ENV_PASSWORD }}
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 || 'PROD' }}
CSAE_CI_JOB_COUNT: ${{ github.event.inputs.notebooks == '' && '10' || '1' }}
IGNORE_BLACKLIST: ${{ github.event.inputs.ignore_blacklist || 'false' }}
CI_ENV: 'nightly'
name: Job ${{ matrix.idx }}
timeout-minutes: 1440
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Define env name and GCP credentials
id: define-environment
run: |
echo "env-name=ci-$(date +%s%N)" >> $GITHUB_OUTPUT
if [ "${TEST_ENV}" == "CI" ]; then
echo "workload_identity_provider=projects/561066095864/locations/global/workloadIdentityPools/github/providers/jupyter-demos" >> $GITHUB_OUTPUT
echo "[email protected]" >> $GITHUB_OUTPUT
echo "gcp_project=clearscape-ci" >> $GITHUB_OUTPUT
echo "CSAE_CLEARSCAPE_API_KEY=${{ secrets.CSAE_CI_CLEARSCAPE_API_KEY }}" >> $GITHUB_ENV
else
echo "workload_identity_provider=projects/323844706402/locations/global/workloadIdentityPools/github/providers/jupyter-demos" >> $GITHUB_OUTPUT
echo "service_account=cicd-sa@clearscape-production.iam.gserviceaccount.com" >> $GITHUB_OUTPUT
echo "gcp_project=clearscape-production" >> $GITHUB_OUTPUT
echo "CSAE_CLEARSCAPE_API_KEY=${{ secrets.CSAE_CLEARSCAPE_API_KEY }}" >> $GITHUB_ENV
fi
- name: Authenticate with Google Cloud
id: auth
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: ${{steps.define-environment.outputs.workload_identity_provider}}
service_account: ${{steps.define-environment.outputs.service_account}}
- name: Get secrets from Google Secret Manager
id: 'secrets'
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
OPENAI_API_KEY:${{steps.define-environment.outputs.gcp_project}}/JUPYTER_NOTEBOOK_CI_OPEN_AI_KEY
GOOGLE_AI_API_KEY:${{steps.define-environment.outputs.gcp_project}}/GOOGLE_AI_API_KEY
GOOGLE_API_KEY:${{steps.define-environment.outputs.gcp_project}}/GOOGLE_API_KEY
AWS_BEDROCK_ACCESS_KEY_ID:${{steps.define-environment.outputs.gcp_project}}/AWS_BEDROCK_ACCESS_KEY_ID
AWS_BEDROCK_REGION_NAME:${{steps.define-environment.outputs.gcp_project}}/AWS_BEDROCK_REGION_NAME
AWS_BEDROCK_SECRET_ACCESS_KEY:${{steps.define-environment.outputs.gcp_project}}/AWS_BEDROCK_SECRET_ACCESS_KEY
export_to_environment: true
- 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' |head -n 10| 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 --shard ${{matrix.idx}}/10
- name: Delete test environments
if: always()
run: npx ts-node post_delete_env.ts
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: blob-report-${{ matrix.idx }}
path: .tests/blob-report
retention-days: 1
merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: ${{ !cancelled() }}
needs: [playwright-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: .tests/all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report-attempt-${{ github.run_attempt }}
path: .tests/playwright-report/
retention-days: 14
- name: Setup pages
uses: actions/configure-pages@v5
- name: Upload report to GitHub Pages
uses: actions/upload-artifact@v4
with:
path: .tests/playwright-report/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4