--- name: 'CI' on: push: branches: - main - dev pull_request: schedule: - cron: '17 6 * * *' workflow_dispatch: jobs: check-code: name: Check / Code runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node and Yarn uses: volta-cli/action@v5 - name: Install dependencies run: yarn install --immutable - name: Lint run: yarn run lint - name: Type-check run: yarn run typecheck - name: Check for dead exports run: yarn run prune - name: Check formatting run: yarn run format-check # Validates the repository's own metadata, which needs neither the card built # nor Node installed. check-hacs: name: Check / HACS runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 - name: HACS validation uses: 'hacs/action@22.5.0' with: category: 'plugin' # Always validate this repository, rather than a contributor's fork: # HACS resolves the entry file (`advanced-camera-card.js`) from a # release and a fork has none. repository: ${{ github.repository }} # Don't attempt to load into HACS (as it loads the release, not the # build). ignore: 'hacs' test-unit: name: Test / Unit runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node and Yarn uses: volta-cli/action@v5 - name: Install dependencies run: yarn install --immutable - name: Test & Coverage run: yarn run coverage test-browser: name: Test / Browser / ${{ matrix.name }} runs-on: ubuntu-latest # Use Playwright's own image to avoid having to (slowly) install browsers # and dependencies. The tag has to name the `playwright` version in # package.json . container: image: mcr.microsoft.com/playwright:v1.62.0-noble # As the image's own user rather than root, which Firefox refuses to run # as when the home directory belongs to somebody else. # # See https://playwright.dev/docs/ci#via-containers . options: --user 1001 strategy: # One browser failing does not invalidate the others. fail-fast: false matrix: # `name` is only how the browser is written for a human: it titles the # job, while `browser` is the name Playwright knows it by. include: - browser: chromium name: Chromium - browser: firefox name: Firefox - browser: webkit name: WebKit steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node and Yarn uses: volta-cli/action@v5 - name: Install dependencies run: yarn install --immutable - name: Browser test run: yarn run test:browser env: VITEST_BROWSER: ${{ matrix.browser }} - name: Upload browser test failures if: failure() uses: actions/upload-artifact@v7 with: name: browser-test-failures-${{ matrix.browser }} path: .vitest/ if-no-files-found: ignore test-dist: name: Test / Dist / ${{ matrix.name }} runs-on: ubuntu-latest # Use Playwright's own image to avoid having to (slowly) install browsers # and dependencies. The tag has to name the `playwright` version in # package.json . container: image: mcr.microsoft.com/playwright:v1.62.0-noble # As the image's own user rather than root, which Firefox refuses to run # as when the home directory belongs to somebody else. # # See https://playwright.dev/docs/ci#via-containers . options: --user 1001 strategy: # One browser failing does not invalidate the others. fail-fast: false matrix: # `name` is only how the browser is written for a human: it titles the # job, while `browser` is the name Playwright knows it by. include: - browser: chromium name: Chromium - browser: firefox name: Firefox - browser: webkit name: WebKit steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node and Yarn uses: volta-cli/action@v5 - name: Install dependencies run: yarn install --immutable # These tests read a build rather than making one. - name: Build run: yarn run build - name: Test the built card run: yarn run test:dist env: VITEST_BROWSER: ${{ matrix.browser }} - name: Upload failures if: failure() uses: actions/upload-artifact@v7 with: name: dist-test-failures-${{ matrix.browser }} path: .vitest/ if-no-files-found: ignore build: name: Build runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node and Yarn uses: volta-cli/action@v5 - name: Install dependencies run: yarn install --immutable - name: Build run: yarn run build - name: Upload javascript uses: actions/upload-artifact@v7 with: name: advanced-camera-card path: dist/*.js # Uploaded unarchived so the self-contained treemap can be viewed directly # in the browser rather than downloaded and unzipped. The artifact is # named after the file, as `name` is ignored when `archive` is false. - name: Upload bundle visualization uses: actions/upload-artifact@v7 with: path: visualizations/treemap.html archive: false