|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +name: Local LV Kanban - Build & E2E |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: ["**"] |
| 11 | + paths: |
| 12 | + - "examples/local-lv-kanban/**" |
| 13 | + - "local-live-view/**" |
| 14 | + - ".github/workflows/local_lv_kanban_e2e_test.yml" |
| 15 | + - "pnpm-workspace.yaml" |
| 16 | + - "pnpm-lock.yaml" |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + cancel-in-progress: true |
| 21 | + |
| 22 | +permissions: |
| 23 | + contents: read |
| 24 | + |
| 25 | +env: |
| 26 | + CI: true |
| 27 | + # Use the runner's preinstalled Google Chrome instead of downloading Playwright's |
| 28 | + # bundled chromium (that download hangs on the runner). Read by playwright.config.js. |
| 29 | + PW_CHANNEL: chrome |
| 30 | + |
| 31 | +jobs: |
| 32 | + test: |
| 33 | + name: Build & test (unit + e2e) |
| 34 | + runs-on: ubuntu-22.04 |
| 35 | + timeout-minutes: 30 |
| 36 | + |
| 37 | + defaults: |
| 38 | + run: |
| 39 | + working-directory: examples/local-lv-kanban |
| 40 | + |
| 41 | + services: |
| 42 | + postgres: |
| 43 | + image: postgres:16 |
| 44 | + env: |
| 45 | + POSTGRES_USER: postgres |
| 46 | + POSTGRES_PASSWORD: postgres |
| 47 | + ports: |
| 48 | + - 5432:5432 |
| 49 | + options: >- |
| 50 | + --health-cmd pg_isready |
| 51 | + --health-interval 10s |
| 52 | + --health-timeout 5s |
| 53 | + --health-retries 5 |
| 54 | +
|
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Setup toolchain |
| 59 | + uses: ./.github/actions/setup-toolchain |
| 60 | + |
| 61 | + - name: Setup pnpm |
| 62 | + uses: pnpm/action-setup@v4 |
| 63 | + |
| 64 | + - name: Setup Node.js |
| 65 | + uses: actions/setup-node@v4 |
| 66 | + with: |
| 67 | + node-version: "24" |
| 68 | + cache: "pnpm" |
| 69 | + cache-dependency-path: pnpm-lock.yaml |
| 70 | + |
| 71 | + - name: Install JS dependencies |
| 72 | + run: pnpm install |
| 73 | + working-directory: . |
| 74 | + |
| 75 | + - name: Restore dependencies cache |
| 76 | + uses: actions/cache@v4 |
| 77 | + with: |
| 78 | + path: | |
| 79 | + examples/local-lv-kanban/deps |
| 80 | + examples/local-lv-kanban/_build |
| 81 | + key: ${{ runner.os }}-mix-local_lv_kanban-${{ hashFiles('examples/local-lv-kanban/mix.lock') }} |
| 82 | + restore-keys: ${{ runner.os }}-mix-local_lv_kanban- |
| 83 | + |
| 84 | + - name: Install Hex dependencies |
| 85 | + run: mix deps.get |
| 86 | + |
| 87 | + # The e2e test starts the Phoenix endpoint in-process (MIX_ENV=test) and serves |
| 88 | + # prebuilt assets, but esbuild/tailwind are dev-only deps — so build app.js/app.css |
| 89 | + # up front in :dev. The WASM bundle + AtomVM.* come from `mix llv.build` (run by the |
| 90 | + # `mix test` alias), and the test DB is created/migrated by that same alias. |
| 91 | + - name: Build browser assets |
| 92 | + run: | |
| 93 | + MIX_ENV=dev mix assets.setup |
| 94 | + MIX_ENV=dev mix assets.build |
| 95 | +
|
| 96 | + # No Playwright browser-install step: the e2e uses the runner's preinstalled |
| 97 | + # Google Chrome via PW_CHANNEL=chrome (set above). Downloading Playwright's |
| 98 | + # bundled chromium hangs on the runner, regardless of version/method. |
| 99 | + - name: Run tests (unit + e2e) |
| 100 | + run: mix test |
| 101 | + |
| 102 | + # On failure, the Playwright HTML report (with traces, screenshots, and |
| 103 | + # video of each failing test) is the only way to see *why* a test timed |
| 104 | + # out — the console list output never says which locator it was waiting on. |
| 105 | + - name: Upload Playwright report |
| 106 | + if: ${{ !cancelled() }} |
| 107 | + uses: actions/upload-artifact@v4 |
| 108 | + with: |
| 109 | + name: playwright-report |
| 110 | + path: | |
| 111 | + examples/local-lv-kanban/test/playwright/playwright-report |
| 112 | + examples/local-lv-kanban/test/playwright/test-results |
| 113 | + retention-days: 7 |
| 114 | + if-no-files-found: ignore |
0 commit comments