All Tests (nightly run) #188
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: All Tests (nightly run) | |
| concurrency: # Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. | |
| group: component-e2e-testing-nightly | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "39 1 * * *" | |
| jobs: | |
| check-commit: | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=8192" | |
| outputs: | |
| should_test: ${{ steps.check.outputs.should_test }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: check | |
| name: Determine if the commit has been tested already | |
| run: | | |
| # Always run tests if triggered by workflow_dispatch | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "Workflow dispatch triggered, always run tests" | |
| echo "should_test=true" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| current_time_epoch=$(date +%s) | |
| last_commit_time_epoch=$(git log -1 --format=%ct) | |
| one_day_epoch=$((60 * 60 * 24)) | |
| threshold_time=$((last_commit_time_epoch + one_day_epoch)) | |
| if [ $current_time_epoch -gt $threshold_time ]; then | |
| echo "Last commit is older than 24 hours, skipping tests" | |
| echo "should_test=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Last commit is within the last 24 hours, will not skip tests" | |
| echo "should_test=true" >> $GITHUB_OUTPUT | |
| fi | |
| test: | |
| needs: check-commit | |
| if: needs.check-commit.outputs.should_test == 'true' | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=8192" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "npm" | |
| - name: Install node dependencies | |
| run: npm ci --prefer-offline | |
| - name: Cache for Turbo | |
| uses: rharkor/caching-for-turbo@v2.3.1 | |
| - name: Store Playwright's Version | |
| run: | | |
| PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | sort | head -n 1) | |
| echo "Playwright's Version: $PLAYWRIGHT_VERSION" | |
| echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
| - name: Cache Playwright Browsers for Playwright's Version | |
| id: cache-playwright-browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | |
| - name: Install Playwright Browsers | |
| if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
| run: npx playwright install --with-deps | |
| - name: ensure we can build xmlui and the extensions | |
| run: npm run build-xmlui | |
| - name: run all tests | |
| run: npm run test | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: xmlui/playwright-report/ | |
| retention-days: 30 |