|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + schedule: |
| 10 | + - cron: '0 */2 * * *' # Every 2 hours; controlled by ENABLE_SCHEDULED_TESTS + SCHEDULED_TESTS_UNTIL vars |
8 | 11 |
|
9 | 12 | permissions: |
10 | 13 | contents: read |
@@ -115,15 +118,54 @@ jobs: |
115 | 118 | !.tmp/testDiff/ |
116 | 119 | !.next/ |
117 | 120 |
|
| 121 | + schedule-gate: |
| 122 | + name: 🗓️ Schedule Gate |
| 123 | + runs-on: ubuntu-latest |
| 124 | + if: github.event_name == 'schedule' |
| 125 | + outputs: |
| 126 | + enabled: ${{ steps.check.outputs.enabled }} |
| 127 | + branch: ${{ steps.check.outputs.branch }} |
| 128 | + steps: |
| 129 | + - name: Check ENABLE_SCHEDULED_TESTS and SCHEDULED_TESTS_UNTIL |
| 130 | + id: check |
| 131 | + run: | |
| 132 | + if [[ "${{ vars.ENABLE_SCHEDULED_TESTS }}" != "true" ]]; then |
| 133 | + echo "Scheduled tests disabled (ENABLE_SCHEDULED_TESTS != true)" |
| 134 | + echo "enabled=false" >> "$GITHUB_OUTPUT" |
| 135 | + exit 0 |
| 136 | + fi |
| 137 | + until_date="${{ vars.SCHEDULED_TESTS_UNTIL }}" |
| 138 | + if [[ -z "$until_date" ]]; then |
| 139 | + echo "No expiry date set (SCHEDULED_TESTS_UNTIL is empty)" |
| 140 | + echo "enabled=false" >> "$GITHUB_OUTPUT" |
| 141 | + exit 0 |
| 142 | + fi |
| 143 | + now=$(date -u +%s) |
| 144 | + until=$(date -u -d "$until_date 23:59:59" +%s) |
| 145 | + if (( now <= until )); then |
| 146 | + echo "Schedule active until $until_date" |
| 147 | + echo "enabled=true" >> "$GITHUB_OUTPUT" |
| 148 | + echo "branch=${{ vars.SCHEDULED_TESTS_BRANCH || 'main' }}" >> "$GITHUB_OUTPUT" |
| 149 | + else |
| 150 | + echo "Schedule window expired on $until_date" |
| 151 | + echo "enabled=false" >> "$GITHUB_OUTPUT" |
| 152 | + fi |
| 153 | +
|
118 | 154 | ci-pr-desktop-web: |
119 | 155 | name: 🔄 💻 CI PR Run Desktop Web Tests on LambdaTest |
120 | 156 | runs-on: ubuntu-latest |
121 | | - if: | |
122 | | - github.event_name == 'pull_request' && |
123 | | - github.actor != 'dependabot[bot]' |
| 157 | + needs: [schedule-gate] |
| 158 | + if: >- |
| 159 | + always() && ( |
| 160 | + (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || |
| 161 | + github.event_name == 'workflow_dispatch' || |
| 162 | + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') |
| 163 | + ) |
124 | 164 | steps: |
125 | 165 | - name: ⬇️ Checkout Repository |
126 | 166 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 167 | + with: |
| 168 | + ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} |
127 | 169 |
|
128 | 170 | - name: 📦 Setup pnpm |
129 | 171 | uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 |
@@ -171,12 +213,18 @@ jobs: |
171 | 213 | ci-pr-android-web: |
172 | 214 | name: 🔄 🤖 🌐 CI PR Run Android Web Tests on LambdaTest |
173 | 215 | runs-on: ubuntu-latest |
174 | | - if: | |
175 | | - github.event_name == 'pull_request' && |
176 | | - github.actor != 'dependabot[bot]' |
| 216 | + needs: [schedule-gate] |
| 217 | + if: >- |
| 218 | + always() && ( |
| 219 | + (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || |
| 220 | + github.event_name == 'workflow_dispatch' || |
| 221 | + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') |
| 222 | + ) |
177 | 223 | steps: |
178 | 224 | - name: ⬇️ Checkout Repository |
179 | 225 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 226 | + with: |
| 227 | + ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} |
180 | 228 |
|
181 | 229 | - name: 📦 Setup pnpm |
182 | 230 | uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 |
@@ -224,12 +272,18 @@ jobs: |
224 | 272 | ci-pr-ios-web: |
225 | 273 | name: 🔄 🍏 🌐 CI PR Run iOS Web Tests on LambdaTest |
226 | 274 | runs-on: ubuntu-latest |
227 | | - if: | |
228 | | - github.event_name == 'pull_request' && |
229 | | - github.actor != 'dependabot[bot]' |
| 275 | + needs: [schedule-gate] |
| 276 | + if: >- |
| 277 | + always() && ( |
| 278 | + (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || |
| 279 | + github.event_name == 'workflow_dispatch' || |
| 280 | + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') |
| 281 | + ) |
230 | 282 | steps: |
231 | 283 | - name: ⬇️ Checkout Repository |
232 | 284 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 285 | + with: |
| 286 | + ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} |
233 | 287 |
|
234 | 288 | - name: 📦 Setup pnpm |
235 | 289 | uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 |
@@ -277,12 +331,18 @@ jobs: |
277 | 331 | ci-pr-app: |
278 | 332 | name: 🔄 📱 CI PR Run Mobile App Tests on Sauce |
279 | 333 | runs-on: ubuntu-latest |
280 | | - if: | |
281 | | - github.event_name == 'pull_request' && |
282 | | - github.actor != 'dependabot[bot]' |
| 334 | + needs: [schedule-gate] |
| 335 | + if: >- |
| 336 | + always() && ( |
| 337 | + (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || |
| 338 | + github.event_name == 'workflow_dispatch' || |
| 339 | + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') |
| 340 | + ) |
283 | 341 | steps: |
284 | 342 | - name: ⬇️ Checkout Repository |
285 | 343 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 344 | + with: |
| 345 | + ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} |
286 | 346 |
|
287 | 347 | - name: 📦 Setup pnpm |
288 | 348 | uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 |
@@ -330,12 +390,18 @@ jobs: |
330 | 390 | ci-pr-ocr: |
331 | 391 | name: 🔄 📱 CI PR Run OCR Tests on LambdaTest |
332 | 392 | runs-on: ubuntu-latest |
333 | | - if: | |
334 | | - github.event_name == 'pull_request' && |
335 | | - github.actor != 'dependabot[bot]' |
| 393 | + needs: [schedule-gate] |
| 394 | + if: >- |
| 395 | + always() && ( |
| 396 | + (github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') || |
| 397 | + github.event_name == 'workflow_dispatch' || |
| 398 | + (github.event_name == 'schedule' && needs.schedule-gate.outputs.enabled == 'true') |
| 399 | + ) |
336 | 400 | steps: |
337 | 401 | - name: ⬇️ Checkout Repository |
338 | 402 | uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 403 | + with: |
| 404 | + ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} |
339 | 405 |
|
340 | 406 | - name: 📦 Setup pnpm |
341 | 407 | uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 |
|
0 commit comments