|
| 1 | +name: e2e recordings |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + e2e_recordings: |
| 14 | + # The Sumo shared key secret is only available on the upstream repo, so skip on forks. |
| 15 | + if: github.repository == 'equinor/webviz' |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + |
| 18 | + env: |
| 19 | + COMPOSE_FILE: docker-compose.yml:docker-compose-cosmos-db.yml |
| 20 | + WEBVIZ_CLIENT_SECRET: 0 |
| 21 | + WEBVIZ_SMDA_SUBSCRIPTION_KEY: 0 |
| 22 | + WEBVIZ_ENTERPRISE_SUBSCRIPTION_KEY: 0 |
| 23 | + WEBVIZ_VDS_HOST_ADDRESS: 0 |
| 24 | + WEBVIZ_PSEUDONYM_HMAC_KEY: 0 |
| 25 | + WEBVIZ_SESSION_STORE_FERNET_KEY: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= |
| 26 | + WEBVIZ_REDIS_AUTH_STORE_PASSWORD: 0 |
| 27 | + WEBVIZ_REDIS_CACHE_PASSWORD: 0 |
| 28 | + WEBVIZ_SUMO_ENV: prod |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: 📖 Checkout commit locally |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: 24 |
| 37 | + cache: npm |
| 38 | + cache-dependency-path: frontend/package-lock.json |
| 39 | + |
| 40 | + - name: 📦 Install frontend dependencies |
| 41 | + working-directory: ./frontend |
| 42 | + run: npm ci --include=dev |
| 43 | + |
| 44 | + - name: 🎭 Install Playwright browser (chromium) |
| 45 | + working-directory: ./frontend |
| 46 | + run: npx playwright install --with-deps chromium |
| 47 | + |
| 48 | + - name: 🎙️ Ensure ffmpeg is available (for voiceover muxing) |
| 49 | + run: ffmpeg -version >/dev/null 2>&1 || (sudo apt-get update && sudo apt-get install -y ffmpeg) |
| 50 | + |
| 51 | + - name: 🧠 Cache the Kokoro TTS model |
| 52 | + uses: actions/cache@v4 |
| 53 | + with: |
| 54 | + path: ~/.cache/huggingface |
| 55 | + key: huggingface-kokoro-82m-v1.0-onnx |
| 56 | + |
| 57 | + - name: 📦 Cache synthesized narration audio |
| 58 | + uses: actions/cache@v4 |
| 59 | + with: |
| 60 | + path: frontend/.narration-cache |
| 61 | + key: narration-audio-${{ github.run_id }} |
| 62 | + restore-keys: narration-audio- |
| 63 | + |
| 64 | + - name: 🐳 Build and start the full stack |
| 65 | + run: docker compose up --build --detach |
| 66 | + |
| 67 | + - name: 🔑 Add Sumo shared key into the backend container |
| 68 | + env: |
| 69 | + SHARED_KEY_SUMO_PROD: ${{ secrets.SHARED_KEY_DROGON_READ_PROD }} |
| 70 | + run: | |
| 71 | + if [ ${#SHARED_KEY_SUMO_PROD} -eq 0 ]; then |
| 72 | + echo "Error: SHARED_KEY_SUMO_PROD is empty. Stopping the action." |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | + printf '%s' "$SHARED_KEY_SUMO_PROD" > shared.key |
| 76 | + docker compose exec -T backend-primary mkdir -p /home/appuser/.sumo |
| 77 | + docker compose cp shared.key backend-primary:/home/appuser/.sumo/9e5443dd-3431-4690-9617-31eed61cb55a.sharedkey |
| 78 | + rm -f shared.key |
| 79 | +
|
| 80 | + # `docker compose cp` writes the file as root, but the backend runs as `appuser`. Fix ownership. |
| 81 | + docker compose exec -T -u root backend-primary \ |
| 82 | + chown appuser:appuser /home/appuser/.sumo/9e5443dd-3431-4690-9617-31eed61cb55a.sharedkey |
| 83 | + docker compose exec -T -u root backend-primary \ |
| 84 | + chmod 600 /home/appuser/.sumo/9e5443dd-3431-4690-9617-31eed61cb55a.sharedkey |
| 85 | +
|
| 86 | + - name: ⏳ Wait for the stack to become responsive |
| 87 | + run: | |
| 88 | + curl --retry 90 --retry-delay 5 --retry-connrefused --retry-all-errors -f http://localhost:5000/alive |
| 89 | + curl --retry 30 --retry-delay 2 --retry-connrefused --retry-all-errors -f http://localhost:8080 |
| 90 | +
|
| 91 | + - name: 🎥 Run e2e tests with recording |
| 92 | + working-directory: ./frontend |
| 93 | + env: |
| 94 | + CI: "true" |
| 95 | + run: npm run test:e2e:record |
| 96 | + |
| 97 | + - name: 🐳 Dump docker compose logs on failure |
| 98 | + if: failure() |
| 99 | + run: docker compose logs --no-color |
| 100 | + |
| 101 | + - name: ☁️ Upload recordings to Azure Blob Storage |
| 102 | + env: |
| 103 | + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.E2E_RECORDINGS_STORAGE_CONNECTION_STRING }} |
| 104 | + run: | |
| 105 | + az storage blob upload-batch \ |
| 106 | + --destination tutorial-videos \ |
| 107 | + --source frontend/test-results \ |
| 108 | + --pattern "*.webm" \ |
| 109 | + --overwrite \ |
| 110 | + --output none |
| 111 | +
|
| 112 | + - name: 🧹 Tear down the stack |
| 113 | + if: always() |
| 114 | + run: docker compose down --volumes |
0 commit comments