# This file was automatically generated by github-actions-wac. # DO NOT MODIFY IT BY HAND. Instead, modify the source *.wac.ts file(s) # and run "github-actions-wac build" (or "ghawac build") to regenerate this file. # For more information, run "github-actions-wac --help". name: Record E2E replay steps 'on': schedule: - cron: 0 2 * * 1-5 workflow_dispatch: {} concurrency: group: record-replay-cache cancel-in-progress: false jobs: constants: name: Create constants outputs: global-cache-key: ${{ steps.global-cache-key.outputs.global-cache-key }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Create global cache key id: global-cache-key run: >- echo "global-cache-key=next-${{ runner.os }}-$(/bin/date -u "+%m%d")-${{ vars.RANDOM_CACHE_KEY_SUFFIX }}" >> $GITHUB_OUTPUT runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write record-sqlite: needs: constants name: Record - Standalone (SQLite, WCP) steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: webiny-js ref: next - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: webiny-js run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: webiny-js/.webiny/cached-packages key: ${{ needs.constants.outputs.global-cache-key }} - name: Install dependencies run: yarn --immutable working-directory: webiny-js - name: Build packages run: yarn build working-directory: webiny-js - name: Start Verdaccio local server working-directory: webiny-js run: yarn add pm2 && npx pm2 start verdaccio -- -c .verdaccio.yaml - name: Configure NPM to use local registry run: npm config set registry http://localhost:4873 - name: Set git email run: git config --global user.email "webiny-bot@webiny.com" - name: Set git username run: git config --global user.name "webiny-bot" - name: Create a Verdaccio user and write its token into .npmrc working-directory: webiny-js run: >- for i in $(seq 1 30); do curl -sf http://localhost:4873/-/ping > /dev/null && break sleep 1 done RESPONSE=$(curl -sf -X PUT -H "Content-Type: application/json" \ -d '{"name":"webiny-bot","password":"webiny-bot"}' \ http://localhost:4873/-/user/org.couchdb.user:webiny-bot) TOKEN=$(printf '%s' "$RESPONSE" | node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>{try{process.stdout.write(JSON.parse(d).token||"")}catch{}})') if [ -z "$TOKEN" ]; then echo "::error::Could not create the Verdaccio user (is Verdaccio running, or was a user already registered?)." exit 1 fi echo "::add-mask::$TOKEN" echo "//localhost:4873/:_authToken=\"$TOKEN\"" > .npmrc - name: Version and publish to Verdaccio working-directory: webiny-js run: yarn release --type=verdaccio - name: Disable Webiny telemetry run: > mkdir ~/.webiny && echo '{ "id": "ci", "telemetry": false }' > ~/.webiny/config - name: Create a new standalone Webiny project run: >- npx create-webiny-project@local-npm new-webiny-project-standalone --tag local-npm --no-interactive --hosting-type standalone --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' --template-options '{"storageOps":"sqlite"}' - name: Configure the bug reporter in webiny.config.tsx working-directory: webiny-js run: >- node .github/workflows/wac/utils/runNodeScripts/configureBugReporter.js '${{ github.workspace }}/new-webiny-project-standalone' - name: Add the E2E API route to webiny.config.tsx working-directory: webiny-js run: >- node .github/workflows/wac/utils/runNodeScripts/configureApiRoute.js '${{ github.workspace }}/new-webiny-project-standalone' - name: Print CLI version working-directory: new-webiny-project-standalone run: yarn webiny --version - name: Build API and Admin working-directory: new-webiny-project-standalone env: WEBINY_HOSTING_TYPE: standalone WEBINY_API_URL: http://localhost:3002 BUG_REPORT_GITHUB_TOKEN: ${{ secrets.BUG_REPORT_GITHUB_TOKEN }} BUG_REPORT_REPOSITORY: ${{ vars.BUG_REPORT_REPOSITORY }} WEBINY_PROJECT_ID: ${{ secrets.E2E_WEBINY_PROJECT_ID }} WEBINY_PROJECT_API_KEY: ${{ secrets.E2E_WEBINY_PROJECT_API_KEY }} run: yarn webiny build api && yarn webiny build admin - name: Start API env: PORT: '3002' WEBINY_SQL_FILENAME: >- ${{ github.workspace }}/new-webiny-project-standalone/.webiny/server.sqlite WEBINY_API_URL: http://localhost:3002 WEBINY_ADMIN_URL: http://localhost:3001 WEBINY_LOCAL_STORAGE_PATH: >- ${{ github.workspace }}/new-webiny-project-standalone/.webiny/storage WEBINY_UPLOAD_SECRET: e2e-upload-secret WEBINY_SELF_HOSTED_AUTH_SECRET: e2e-signing-secret WEBINY_ENCRYPTION_PASSPHRASE: e2e-encryption-passphrase WEBINY_HASHING_PEPPER: e2e-hashing-pepper WEBINY_PROJECT_ID: ${{ secrets.E2E_WEBINY_PROJECT_ID }} WEBINY_PROJECT_API_KEY: ${{ secrets.E2E_WEBINY_PROJECT_API_KEY }} run: >- mkdir -p "$(dirname "${WEBINY_SQL_FILENAME:-/tmp/unused}")" mkdir -p "${WEBINY_LOCAL_STORAGE_PATH:-/tmp/unused}" cd new-webiny-project-standalone/.webiny/workspace/apps/api/graphql/build nohup node start.mjs > /tmp/webiny-api.log 2>&1 & echo "API starting on port 3002" - name: Serve Admin run: >- nohup npx --yes serve -s new-webiny-project-standalone/.webiny/workspace/apps/admin/build -l 3001 > /tmp/webiny-admin.log 2>&1 & echo "Admin starting on port 3001" - name: Wait for API and Admin run: >- set -euo pipefail wait_for_port() { for _ in $(seq 1 90); do if (echo > /dev/tcp/127.0.0.1/"$1") >/dev/null 2>&1; then echo "port $1 is accepting connections" return 0 fi sleep 2 done echo "::error::Timed out waiting for port $1." return 1 } wait_for_port 3002 wait_for_port 3001 # A listening socket is not the same as a working GraphQL endpoint. curl -fsS -X POST http://localhost:3002/graphql -H 'content-type: application/json' \ -d '{"query":"{__typename}"}' > /dev/null echo "GraphQL API responded." - name: Resolve Playwright version id: playwright-version working-directory: webiny-js run: >- echo "version=$(yarn workspace e2e-tests playwright --version | cut -d' ' -f2)" >> $GITHUB_OUTPUT - name: Cache Playwright browsers uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ~/.cache/ms-playwright key: >- playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} - name: Install Playwright browser working-directory: webiny-js/e2e run: >- yarn playwright install chromium if yarn node --input-type=module -e "import { chromium } from 'playwright'; const browser = await chromium.launch(); await browser.close();"; then echo "Chromium starts without installing system packages." else echo "::warning::Chromium did not start. Installing its system packages." yarn playwright install-deps chromium fi - name: E2E - run installation wizard test id: e2e-installation working-directory: webiny-js env: E2E_ADMIN_URL: http://localhost:3001 E2E_INSTALLATION: '1' E2E_TELEMETRY_DISABLED: '1' run: |- rm -f e2e/.e2e/summary.md yarn e2e --tag installation --reporter list,junit,markdown - name: E2E - installation - write job summary if: always() && steps.e2e-installation.outcome != 'skipped' working-directory: webiny-js run: |- if [ -f e2e/.e2e/summary.md ]; then echo "## E2E - installation" >> "$GITHUB_STEP_SUMMARY" cat e2e/.e2e/summary.md >> "$GITHUB_STEP_SUMMARY" fi - name: E2E - upload installation test results if: failure() uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f with: name: e2e-results-standalone-sqlite-wcp retention-days: 7 if-no-files-found: ignore include-hidden-files: true path: webiny-js/e2e/.e2e - name: AI E2E - run tests id: ai-e2e-tests working-directory: webiny-js env: ANTHROPIC_API_KEY: ${{ secrets.E2E_ANTHROPIC_API_KEY }} E2E_ADMIN_URL: http://localhost:3001 E2E_API_URL: http://localhost:3002 E2E_TELEMETRY_DISABLED: '1' E2E_CACHE_MODE: read-write run: >- rm -f e2e/.e2e/summary.md if [ ! -f e2e/e2e.config.ts ]; then echo "::notice::This branch has no e2e/ folder. Skipping the AI E2E tests." exit 0 fi yarn e2e --exclude-tag installation --shard 1/1 --pass-with-no-tests --reporter list,junit,markdown - name: AI E2E - tests - write job summary if: always() && steps.ai-e2e-tests.outcome != 'skipped' working-directory: webiny-js run: |- if [ -f e2e/.e2e/summary.md ]; then echo "## AI E2E - tests" >> "$GITHUB_STEP_SUMMARY" cat e2e/.e2e/summary.md >> "$GITHUB_STEP_SUMMARY" fi - name: AI E2E - upload results if: always() uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f with: name: ai-e2e-results-standalone-sqlite-wcp retention-days: 7 if-no-files-found: ignore include-hidden-files: true path: webiny-js/e2e/.e2e - name: AI E2E - collect new replay recordings id: e2e-cache if: always() working-directory: webiny-js run: >- mkdir -p "$RUNNER_TEMP/e2e-cache" git status --porcelain --untracked-files=all -- e2e/cache | awk '{ print $2 }' | while read -r file; do cp "$file" "$RUNNER_TEMP/e2e-cache/"; done count=$(find "$RUNNER_TEMP/e2e-cache" -type f | wc -l | tr -d " ") echo "count=$count" >> "$GITHUB_OUTPUT" if [ "$count" -gt 0 ]; then echo "## Replay cache" >> "$GITHUB_STEP_SUMMARY" echo "Recorded $count new or changed replay entries." >> "$GITHUB_STEP_SUMMARY" fi - name: AI E2E - upload new replay recordings if: always() && steps.e2e-cache.outputs.count != '0' uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: e2e-cache-sqlite-wcp retention-days: 30 if-no-files-found: ignore path: ${{ runner.temp }}/e2e-cache - name: Print server logs if: failure() run: >- for log in /tmp/webiny-api*.log /tmp/webiny-nginx-error.log; do [ -f "$log" ] || continue echo "::group::$log"; cat "$log"; echo "::endgroup::" done echo "::group::Admin log"; cat /tmp/webiny-admin.log || true; echo "::endgroup::" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write record-postgres: needs: constants name: Record - Standalone (Postgres, WCP) steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: path: webiny-js ref: next - name: Resolve Yarn cache folder id: yarn-cache-folder working-directory: webiny-js run: echo "path=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 with: path: ${{ steps.yarn-cache-folder.outputs.path }} key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} restore-keys: yarn-${{ runner.os }}- - uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: webiny-js/.webiny/cached-packages key: ${{ needs.constants.outputs.global-cache-key }} - name: Install dependencies run: yarn --immutable working-directory: webiny-js - name: Build packages run: yarn build working-directory: webiny-js - name: Start Verdaccio local server working-directory: webiny-js run: yarn add pm2 && npx pm2 start verdaccio -- -c .verdaccio.yaml - name: Configure NPM to use local registry run: npm config set registry http://localhost:4873 - name: Set git email run: git config --global user.email "webiny-bot@webiny.com" - name: Set git username run: git config --global user.name "webiny-bot" - name: Create a Verdaccio user and write its token into .npmrc working-directory: webiny-js run: >- for i in $(seq 1 30); do curl -sf http://localhost:4873/-/ping > /dev/null && break sleep 1 done RESPONSE=$(curl -sf -X PUT -H "Content-Type: application/json" \ -d '{"name":"webiny-bot","password":"webiny-bot"}' \ http://localhost:4873/-/user/org.couchdb.user:webiny-bot) TOKEN=$(printf '%s' "$RESPONSE" | node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>{try{process.stdout.write(JSON.parse(d).token||"")}catch{}})') if [ -z "$TOKEN" ]; then echo "::error::Could not create the Verdaccio user (is Verdaccio running, or was a user already registered?)." exit 1 fi echo "::add-mask::$TOKEN" echo "//localhost:4873/:_authToken=\"$TOKEN\"" > .npmrc - name: Version and publish to Verdaccio working-directory: webiny-js run: yarn release --type=verdaccio - name: Disable Webiny telemetry run: > mkdir ~/.webiny && echo '{ "id": "ci", "telemetry": false }' > ~/.webiny/config - name: Create a new standalone Webiny project run: >- npx create-webiny-project@local-npm new-webiny-project-standalone --tag local-npm --no-interactive --hosting-type standalone --assign-to-yarnrc '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' --template-options '{"storageOps":"postgres"}' - name: Configure the bug reporter in webiny.config.tsx working-directory: webiny-js run: >- node .github/workflows/wac/utils/runNodeScripts/configureBugReporter.js '${{ github.workspace }}/new-webiny-project-standalone' - name: Add the E2E API route to webiny.config.tsx working-directory: webiny-js run: >- node .github/workflows/wac/utils/runNodeScripts/configureApiRoute.js '${{ github.workspace }}/new-webiny-project-standalone' - name: Print CLI version working-directory: new-webiny-project-standalone run: yarn webiny --version - name: Build API and Admin working-directory: new-webiny-project-standalone env: WEBINY_HOSTING_TYPE: standalone WEBINY_API_URL: http://localhost:3002 BUG_REPORT_GITHUB_TOKEN: ${{ secrets.BUG_REPORT_GITHUB_TOKEN }} BUG_REPORT_REPOSITORY: ${{ vars.BUG_REPORT_REPOSITORY }} WEBINY_PROJECT_ID: ${{ secrets.E2E_WEBINY_PROJECT_ID }} WEBINY_PROJECT_API_KEY: ${{ secrets.E2E_WEBINY_PROJECT_API_KEY }} run: yarn webiny build api && yarn webiny build admin - name: Start API env: PORT: '3002' WEBINY_PG_HOST: localhost WEBINY_PG_PORT: '5432' WEBINY_PG_USER: postgres WEBINY_PG_PASSWORD: postgres WEBINY_PG_DATABASE: webiny WEBINY_API_URL: http://localhost:3002 WEBINY_ADMIN_URL: http://localhost:3001 WEBINY_LOCAL_STORAGE_PATH: >- ${{ github.workspace }}/new-webiny-project-standalone/.webiny/storage WEBINY_UPLOAD_SECRET: e2e-upload-secret WEBINY_SELF_HOSTED_AUTH_SECRET: e2e-signing-secret WEBINY_ENCRYPTION_PASSPHRASE: e2e-encryption-passphrase WEBINY_HASHING_PEPPER: e2e-hashing-pepper WEBINY_PROJECT_ID: ${{ secrets.E2E_WEBINY_PROJECT_ID }} WEBINY_PROJECT_API_KEY: ${{ secrets.E2E_WEBINY_PROJECT_API_KEY }} run: >- mkdir -p "$(dirname "${WEBINY_SQL_FILENAME:-/tmp/unused}")" mkdir -p "${WEBINY_LOCAL_STORAGE_PATH:-/tmp/unused}" cd new-webiny-project-standalone/.webiny/workspace/apps/api/graphql/build nohup node start.mjs > /tmp/webiny-api.log 2>&1 & echo "API starting on port 3002" - name: Serve Admin run: >- nohup npx --yes serve -s new-webiny-project-standalone/.webiny/workspace/apps/admin/build -l 3001 > /tmp/webiny-admin.log 2>&1 & echo "Admin starting on port 3001" - name: Wait for API and Admin run: >- set -euo pipefail wait_for_port() { for _ in $(seq 1 90); do if (echo > /dev/tcp/127.0.0.1/"$1") >/dev/null 2>&1; then echo "port $1 is accepting connections" return 0 fi sleep 2 done echo "::error::Timed out waiting for port $1." return 1 } wait_for_port 3002 wait_for_port 3001 # A listening socket is not the same as a working GraphQL endpoint. curl -fsS -X POST http://localhost:3002/graphql -H 'content-type: application/json' \ -d '{"query":"{__typename}"}' > /dev/null echo "GraphQL API responded." - name: Resolve Playwright version id: playwright-version working-directory: webiny-js run: >- echo "version=$(yarn workspace e2e-tests playwright --version | cut -d' ' -f2)" >> $GITHUB_OUTPUT - name: Cache Playwright browsers uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 with: path: ~/.cache/ms-playwright key: >- playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} - name: Install Playwright browser working-directory: webiny-js/e2e run: >- yarn playwright install chromium if yarn node --input-type=module -e "import { chromium } from 'playwright'; const browser = await chromium.launch(); await browser.close();"; then echo "Chromium starts without installing system packages." else echo "::warning::Chromium did not start. Installing its system packages." yarn playwright install-deps chromium fi - name: E2E - run installation wizard test id: e2e-installation working-directory: webiny-js env: E2E_ADMIN_URL: http://localhost:3001 E2E_INSTALLATION: '1' E2E_TELEMETRY_DISABLED: '1' run: |- rm -f e2e/.e2e/summary.md yarn e2e --tag installation --reporter list,junit,markdown - name: E2E - installation - write job summary if: always() && steps.e2e-installation.outcome != 'skipped' working-directory: webiny-js run: |- if [ -f e2e/.e2e/summary.md ]; then echo "## E2E - installation" >> "$GITHUB_STEP_SUMMARY" cat e2e/.e2e/summary.md >> "$GITHUB_STEP_SUMMARY" fi - name: E2E - upload installation test results if: failure() uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f with: name: e2e-results-standalone-postgres-wcp retention-days: 7 if-no-files-found: ignore include-hidden-files: true path: webiny-js/e2e/.e2e - name: AI E2E - run tests id: ai-e2e-tests working-directory: webiny-js env: ANTHROPIC_API_KEY: ${{ secrets.E2E_ANTHROPIC_API_KEY }} E2E_ADMIN_URL: http://localhost:3001 E2E_API_URL: http://localhost:3002 E2E_TELEMETRY_DISABLED: '1' E2E_CACHE_MODE: read-write run: >- rm -f e2e/.e2e/summary.md if [ ! -f e2e/e2e.config.ts ]; then echo "::notice::This branch has no e2e/ folder. Skipping the AI E2E tests." exit 0 fi yarn e2e --exclude-tag installation --shard 1/1 --pass-with-no-tests --reporter list,junit,markdown - name: AI E2E - tests - write job summary if: always() && steps.ai-e2e-tests.outcome != 'skipped' working-directory: webiny-js run: |- if [ -f e2e/.e2e/summary.md ]; then echo "## AI E2E - tests" >> "$GITHUB_STEP_SUMMARY" cat e2e/.e2e/summary.md >> "$GITHUB_STEP_SUMMARY" fi - name: AI E2E - upload results if: always() uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f with: name: ai-e2e-results-standalone-postgres-wcp retention-days: 7 if-no-files-found: ignore include-hidden-files: true path: webiny-js/e2e/.e2e - name: AI E2E - collect new replay recordings id: e2e-cache if: always() working-directory: webiny-js run: >- mkdir -p "$RUNNER_TEMP/e2e-cache" git status --porcelain --untracked-files=all -- e2e/cache | awk '{ print $2 }' | while read -r file; do cp "$file" "$RUNNER_TEMP/e2e-cache/"; done count=$(find "$RUNNER_TEMP/e2e-cache" -type f | wc -l | tr -d " ") echo "count=$count" >> "$GITHUB_OUTPUT" if [ "$count" -gt 0 ]; then echo "## Replay cache" >> "$GITHUB_STEP_SUMMARY" echo "Recorded $count new or changed replay entries." >> "$GITHUB_STEP_SUMMARY" fi - name: AI E2E - upload new replay recordings if: always() && steps.e2e-cache.outputs.count != '0' uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: e2e-cache-postgres-wcp retention-days: 30 if-no-files-found: ignore path: ${{ runner.temp }}/e2e-cache - name: Print server logs if: failure() run: >- for log in /tmp/webiny-api*.log /tmp/webiny-nginx-error.log; do [ -f "$log" ] || continue echo "::group::$log"; cat "$log"; echo "::endgroup::" done echo "::group::Admin log"; cat /tmp/webiny-admin.log || true; echo "::endgroup::" services: postgres: image: postgres:17 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: webiny ports: - '5432:5432' options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write openPullRequest: needs: - record-sqlite - record-postgres name: Open the replay recordings PR if: ${{ !cancelled() }} steps: - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 24 - name: Count recorded entries id: recordings env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: >- set -euo pipefail count=$(gh api --paginate "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" \ --jq '.artifacts[].name' | grep -c '^e2e-cache-' || true) echo "count=$count" >> "$GITHUB_OUTPUT" if [ "$count" -eq 0 ]; then echo "::notice::Nothing was recorded. Every agent step already has a recording that replays." fi - name: Download recordings if: steps.recordings.outputs.count != '0' uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with: pattern: e2e-cache-* path: ${{ runner.temp }}/e2e-cache merge-multiple: true - name: Check out next if: steps.recordings.outputs.count != '0' uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 with: ref: next token: ${{ secrets.GH_TOKEN }} path: recordings-branch - name: Commit recordings and open the PR if: steps.recordings.outputs.count != '0' working-directory: recordings-branch env: GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: e2e/replay-recordings RECORDINGS: ${{ runner.temp }}/e2e-cache RUN_URL: >- ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} run: >- set -euo pipefail shopt -s nullglob mkdir -p e2e/cache for file in "$RECORDINGS"/*; do name=$(basename "$file") # Entry files are named by a SHA-256 key digest. Anything else did not come from the # replay cache, so it is not copied. if [[ ! "$name" =~ ^[0-9a-f]{64}\.json$ ]]; then echo "::warning::Skipping $name: not a replay cache entry." continue fi cp "$file" "e2e/cache/$name" done git add e2e/cache if git diff --cached --quiet; then echo "::notice::next already has these recordings." exit 0 fi # One line per entry, naming the test it belongs to, for the PR body. entries="" while read -r status path; do # testId is URI-encoded, with `::` between file, describe and test title. test_id=$(node -e 'const { payload } = JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")); console.log(decodeURIComponent(payload.recordedFor.testId).replaceAll("::", " > "))' "$path" 2>/dev/null || echo "(unreadable entry)") case "$status" in A) what="added" ;; *) what="changed" ;; esac entries+="- $what: $test_id"$'\n' done < <(git diff --cached --name-status) count=$(git diff --cached --name-only | wc -l | tr -d ' ') git config user.name "webiny-bot" git config user.email "webiny-bot@webiny.com" git checkout -q -B "$BRANCH" git commit -q -m "test(e2e): add $count replay recording(s)" -m "Recorded by $RUN_URL" git push -q --force origin "HEAD:$BRANCH" body_file=$(mktemp) { echo "Replay recordings made by $RUN_URL, on a freshly installed licensed standalone project (SQLite and Postgres)." echo "" echo "Each entry stores the actions one \`agent.act\` step took, so later runs replay them instead of calling the model. Merging this PR is what makes \`/e2e\` and later recording runs use them." echo "" echo "$entries" echo "This branch is rebuilt from \`next\` on every recording run, so don't push to it." } > "$body_file" title="test(e2e): add replay recordings" pr=$(gh pr list --head "$BRANCH" --base next --state open --json number --jq ".[0].number // empty") if [ -n "$pr" ]; then gh pr edit "$pr" --title "$title" --body-file "$body_file" > /dev/null url=$(gh pr view "$pr" --json url --jq .url) else url=$(gh pr create --head "$BRANCH" --base next --title "$title" --body-file "$body_file") fi echo "## Replay recordings" >> "$GITHUB_STEP_SUMMARY" echo "$count new or changed recording(s): $url" >> "$GITHUB_STEP_SUMMARY" runs-on: ubuntu-latest env: NODE_OPTIONS: '--max_old_space_size=4096' YARN_ENABLE_IMMUTABLE_INSTALLS: false permissions: contents: read actions: write