| 1 | name: (Compiler) Playground |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | pull_request: |
| 7 | paths: |
| 8 | - compiler/** |
| 9 | - .github/workflows/compiler_playground.yml |
| 10 | |
| 11 | permissions: {} |
| 12 | |
| 13 | concurrency: |
| 14 | group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.run_id }} |
| 15 | cancel-in-progress: true |
| 16 | |
| 17 | env: |
| 18 | TZ: /usr/share/zoneinfo/America/Los_Angeles |
| 19 | # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout |
| 20 | SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 |
| 21 | |
| 22 | defaults: |
| 23 | run: |
| 24 | working-directory: compiler/apps/playground |
| 25 | |
| 26 | jobs: |
| 27 | playground: |
| 28 | name: Test playground |
| 29 | runs-on: ubuntu-latest |
| 30 | steps: |
| 31 | - uses: actions/checkout@v4 |
| 32 | - uses: actions/setup-node@v4 |
| 33 | with: |
| 34 | node-version-file: '.nvmrc' |
| 35 | - name: Cache node_modules |
| 36 | uses: actions/cache@v4 |
| 37 | id: node_modules |
| 38 | with: |
| 39 | path: | |
| 40 | **/node_modules |
| 41 | key: compiler-and-playground-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('compiler/**/yarn.lock') }} |
| 42 | - run: yarn install --frozen-lockfile |
| 43 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 44 | working-directory: compiler |
| 45 | - run: yarn install --frozen-lockfile |
| 46 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 47 | - name: Check Playwright version |
| 48 | id: playwright_version |
| 49 | run: echo "playwright_version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | head -1)" >> "$GITHUB_OUTPUT" |
| 50 | - name: Cache Playwright Browsers for version ${{ steps.playwright_version.outputs.playwright_version }} |
| 51 | id: cache_playwright_browsers |
| 52 | uses: actions/cache@v4 |
| 53 | with: |
| 54 | path: ~/.cache/ms-playwright |
| 55 | key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ steps.playwright_version.outputs.playwright_version }} |
| 56 | - run: npx playwright install --with-deps chromium |
| 57 | if: steps.cache_playwright_browsers.outputs.cache-hit != 'true' |
| 58 | - run: CI=true yarn test |
| 59 | - run: ls -R test-results |
| 60 | if: '!cancelled()' |
| 61 | - name: Archive test results |
| 62 | if: '!cancelled()' |
| 63 | uses: actions/upload-artifact@v4 |
| 64 | with: |
| 65 | name: test-results |
| 66 | path: compiler/apps/playground/test-results |
| 67 | if-no-files-found: ignore |