From 5991a14f7d8ddbb9b3ea94ba72db28f7363b2890 Mon Sep 17 00:00:00 2001 From: wswebcreation Date: Tue, 9 Jun 2026 12:26:09 +0200 Subject: [PATCH] chore: separate flows --- .github/workflows/scheduled-tests.yml | 332 ++++++++++++++++++++++++++ .github/workflows/tests.yml | 94 ++------ 2 files changed, 347 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/scheduled-tests.yml diff --git a/.github/workflows/scheduled-tests.yml b/.github/workflows/scheduled-tests.yml new file mode 100644 index 00000000..680eb9cc --- /dev/null +++ b/.github/workflows/scheduled-tests.yml @@ -0,0 +1,332 @@ +name: scheduled tests + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch to run tests against' + type: string + required: true + default: 'main' + schedule: + - cron: '0 */2 * * *' # Every 2 hours; disable via GitHub UI or let SCHEDULED_TESTS_UNTIL expire + +permissions: + contents: read + +env: + PNPM_VERSION: 9.15.9+sha256.cf86a7ad764406395d4286a6d09d730711720acc6d93e9dce9ac7ac4dc4a28a7 + +jobs: + schedule-gate: + name: πŸ—“οΈ Schedule Gate + runs-on: ubuntu-latest + if: github.event_name == 'schedule' + outputs: + enabled: ${{ steps.check.outputs.enabled }} + steps: + - name: Check SCHEDULED_TESTS_UNTIL + id: check + run: | + until_date="${{ vars.SCHEDULED_TESTS_UNTIL }}" + if [[ -z "$until_date" ]]; then + echo "SCHEDULED_TESTS_UNTIL not set β€” skipping" + echo "enabled=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + now=$(date -u +%s) + until=$(date -u -d "$until_date 23:59:59" +%s) + if (( now <= until )); then + echo "Schedule active until $until_date" + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "Schedule window expired on $until_date" + echo "enabled=false" >> "$GITHUB_OUTPUT" + fi + + scheduled-desktop-web: + name: πŸ—“οΈ πŸ’» Scheduled Desktop Web Tests on LambdaTest + runs-on: ubuntu-latest + needs: [schedule-gate] + if: >- + always() && ( + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') + ) + steps: + - name: ⬇️ Checkout Repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || vars.SCHEDULED_TESTS_BRANCH || 'main' }} + + - name: πŸ“¦ Setup pnpm + uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + with: + version: ${{ env.PNPM_VERSION }} + + - name: 🟒 Setup Node.js + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version-file: ".nvmrc" + cache: pnpm + + - name: 🧩 Install Dependencies + run: pnpm pnpm.install.workaround + + - name: πŸ—οΈ Build + working-directory: ./ + run: pnpm build + + - name: πŸ§ͺ Run linting and unit tests + working-directory: ./ + run: pnpm test + + - name: πŸ–₯️ 🌐 Run Desktop Web e2e tests + working-directory: ./ + env: + LAMBDATEST_USERNAME: ${{ secrets.LAMBDATEST_USERNAME }} + LAMBDATEST_ACCESS_KEY: ${{ secrets.LAMBDATEST_ACCESS_KEY }} + BUILD_PREFIX: true + run: pnpm test.lambdatest.desktop --maxConcurrency=4 + + - name: πŸ“€ Upload artifacts + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + if: failure() + with: + name: scheduled-desktop-web-logs + path: | + logs/*.log + .tmp/ + !.tmp/checkActual/ + !.tmp/saveActual/ + !.tmp/testDiff/ + !.next/ + + scheduled-android-web: + name: πŸ—“οΈ πŸ€– 🌐 Scheduled Android Web Tests on LambdaTest + runs-on: ubuntu-latest + needs: [schedule-gate] + if: >- + always() && ( + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') + ) + steps: + - name: ⬇️ Checkout Repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || vars.SCHEDULED_TESTS_BRANCH || 'main' }} + + - name: πŸ“¦ Setup pnpm + uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + with: + version: ${{ env.PNPM_VERSION }} + + - name: 🟒 Setup Node.js + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version-file: ".nvmrc" + cache: pnpm + + - name: 🧩 Install Dependencies + run: pnpm pnpm.install.workaround + + - name: πŸ—οΈ Build + working-directory: ./ + run: pnpm build + + - name: πŸ§ͺ Run linting and unit tests + working-directory: ./ + run: pnpm test + + - name: πŸ€– 🌐 Run Android Web e2e tests + working-directory: ./ + env: + LAMBDATEST_USERNAME: ${{ secrets.LAMBDATEST_USERNAME }} + LAMBDATEST_ACCESS_KEY: ${{ secrets.LAMBDATEST_ACCESS_KEY }} + BUILD_PREFIX: true + run: pnpm test.lambdatest.emu.web --maxConcurrency=6 + + - name: πŸ“€ Upload artifacts + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + if: failure() + with: + name: scheduled-android-web-logs + path: | + logs/*.log + .tmp/ + !.tmp/checkActual/ + !.tmp/saveActual/ + !.tmp/testDiff/ + !.next/ + + scheduled-ios-web: + name: πŸ—“οΈ 🍏 🌐 Scheduled iOS Web Tests on LambdaTest + runs-on: ubuntu-latest + needs: [schedule-gate] + if: >- + always() && ( + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') + ) + steps: + - name: ⬇️ Checkout Repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || vars.SCHEDULED_TESTS_BRANCH || 'main' }} + + - name: πŸ“¦ Setup pnpm + uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + with: + version: ${{ env.PNPM_VERSION }} + + - name: 🟒 Setup Node.js + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version-file: ".nvmrc" + cache: pnpm + + - name: 🧩 Install Dependencies + run: pnpm pnpm.install.workaround + + - name: πŸ—οΈ Build + working-directory: ./ + run: pnpm build + + - name: πŸ§ͺ Run linting and unit tests + working-directory: ./ + run: pnpm test + + - name: 🍏 🌐 Run iOS Web e2e tests + working-directory: ./ + env: + LAMBDATEST_USERNAME: ${{ secrets.LAMBDATEST_USERNAME }} + LAMBDATEST_ACCESS_KEY: ${{ secrets.LAMBDATEST_ACCESS_KEY }} + BUILD_PREFIX: true + run: pnpm test.lambdatest.sims.web --maxConcurrency=6 + + - name: πŸ“€ Upload artifacts + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + if: failure() + with: + name: scheduled-ios-web-logs + path: | + logs/*.log + .tmp/ + !.tmp/checkActual/ + !.tmp/saveActual/ + !.tmp/testDiff/ + !.next/ + + scheduled-app: + name: πŸ—“οΈ πŸ“± Scheduled Mobile App Tests on Sauce + runs-on: ubuntu-latest + needs: [schedule-gate] + if: >- + always() && ( + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') + ) + steps: + - name: ⬇️ Checkout Repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || vars.SCHEDULED_TESTS_BRANCH || 'main' }} + + - name: πŸ“¦ Setup pnpm + uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + with: + version: ${{ env.PNPM_VERSION }} + + - name: 🟒 Setup Node.js + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version-file: ".nvmrc" + cache: pnpm + + - name: 🧩 Install Dependencies + run: pnpm pnpm.install.workaround + + - name: πŸ—οΈ Build + working-directory: ./ + run: pnpm build + + - name: πŸ§ͺ Run linting and unit tests + working-directory: ./ + run: pnpm test + + - name: πŸ˜Άβ€πŸŒ«οΈ πŸ“± Run App e2e tests + working-directory: ./ + env: + SAUCE_USERNAME_WDIO_ICS: ${{ secrets.SAUCE_USERNAME_WDIO_ICS }} + SAUCE_ACCESS_KEY_WDIO_ICS: ${{ secrets.SAUCE_ACCESS_KEY_WDIO_ICS }} + BUILD_PREFIX: true + run: pnpm test.saucelabs.app --maxConcurrency=20 + + - name: πŸ“€ Upload artifacts + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + if: failure() + with: + name: scheduled-mobile-app-logs + path: | + logs/*.log + .tmp/ + !.tmp/checkActual/ + !.tmp/saveActual/ + !.tmp/testDiff/ + !.next/ + + scheduled-ocr: + name: πŸ—“οΈ πŸ”Ž Scheduled OCR Tests on LambdaTest + runs-on: ubuntu-latest + needs: [schedule-gate] + if: >- + always() && ( + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') + ) + steps: + - name: ⬇️ Checkout Repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + ref: ${{ inputs.branch || vars.SCHEDULED_TESTS_BRANCH || 'main' }} + + - name: πŸ“¦ Setup pnpm + uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + with: + version: ${{ env.PNPM_VERSION }} + + - name: 🟒 Setup Node.js + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version-file: ".nvmrc" + cache: pnpm + + - name: 🧩 Install Dependencies + run: pnpm pnpm.install.workaround + + - name: πŸ—οΈ Build + working-directory: ./ + run: pnpm build + + - name: πŸ§ͺ Run linting and unit tests + working-directory: ./ + run: pnpm test + + - name: πŸ˜Άβ€πŸŒ«οΈ πŸ”Ž Run OCR e2e tests + working-directory: ./ + env: + LAMBDATEST_USERNAME: ${{ secrets.LAMBDATEST_USERNAME }} + LAMBDATEST_ACCESS_KEY: ${{ secrets.LAMBDATEST_ACCESS_KEY }} + BUILD_PREFIX: true + run: pnpm test.ocr.lambdatest.desktop --maxConcurrency=1 + + - name: πŸ“€ Upload artifacts + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + if: failure() + with: + name: scheduled-ocr-logs + path: | + logs/*.log + .tmp/ + !.next/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de52d538..ad5f4cf8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,12 +6,6 @@ on: - main pull_request: workflow_dispatch: - inputs: - branch: - description: 'Branch to run tests against (leave empty to use the selected branch above)' - type: string - schedule: - - cron: "0 */2 * * *" # Every 2 hours; stop by disabling the workflow or letting SCHEDULED_TESTS_UNTIL expire permissions: contents: read @@ -122,49 +116,15 @@ jobs: !.tmp/testDiff/ !.next/ - schedule-gate: - name: πŸ—“οΈ Schedule Gate - runs-on: ubuntu-latest - if: github.event_name == 'schedule' - outputs: - enabled: ${{ steps.check.outputs.enabled }} - branch: ${{ steps.check.outputs.branch }} - steps: - - name: Check SCHEDULED_TESTS_UNTIL - id: check - run: | - until_date="${{ vars.SCHEDULED_TESTS_UNTIL }}" - if [[ -z "$until_date" ]]; then - echo "SCHEDULED_TESTS_UNTIL not set β€” skipping" - echo "enabled=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - now=$(date -u +%s) - until=$(date -u -d "$until_date 23:59:59" +%s) - if (( now <= until )); then - echo "Schedule active until $until_date" - echo "enabled=true" >> "$GITHUB_OUTPUT" - echo "branch=main" >> "$GITHUB_OUTPUT" - else - echo "Schedule window expired on $until_date" - echo "enabled=false" >> "$GITHUB_OUTPUT" - fi - ci-pr-desktop-web: name: πŸ”„ πŸ’» CI PR Run Desktop Web Tests on LambdaTest runs-on: ubuntu-latest - needs: [schedule-gate] - if: >- - always() && ( - (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') - ) + if: | + github.event_name == 'pull_request' && + github.actor != 'dependabot[bot]' steps: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: πŸ“¦ Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -212,18 +172,12 @@ jobs: ci-pr-android-web: name: πŸ”„ πŸ€– 🌐 CI PR Run Android Web Tests on LambdaTest runs-on: ubuntu-latest - needs: [schedule-gate] - if: >- - always() && ( - (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') - ) + if: | + github.event_name == 'pull_request' && + github.actor != 'dependabot[bot]' steps: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: πŸ“¦ Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -271,18 +225,12 @@ jobs: ci-pr-ios-web: name: πŸ”„ 🍏 🌐 CI PR Run iOS Web Tests on LambdaTest runs-on: ubuntu-latest - needs: [schedule-gate] - if: >- - always() && ( - (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') - ) + if: | + github.event_name == 'pull_request' && + github.actor != 'dependabot[bot]' steps: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: πŸ“¦ Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -330,18 +278,12 @@ jobs: ci-pr-app: name: πŸ”„ πŸ“± CI PR Run Mobile App Tests on Sauce runs-on: ubuntu-latest - needs: [schedule-gate] - if: >- - always() && ( - (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') - ) + if: | + github.event_name == 'pull_request' && + github.actor != 'dependabot[bot]' steps: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: πŸ“¦ Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -389,18 +331,12 @@ jobs: ci-pr-ocr: name: πŸ”„ πŸ“± CI PR Run OCR Tests on LambdaTest runs-on: ubuntu-latest - needs: [schedule-gate] - if: >- - always() && ( - (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') - ) + if: | + github.event_name == 'pull_request' && + github.actor != 'dependabot[bot]' steps: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: πŸ“¦ Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0