Files
advanced-camera-card/.github/workflows/ci.yml
T

149 lines
3.6 KiB
YAML

---
name: 'CI'
on:
push:
branches:
- main
- dev
pull_request:
schedule:
- cron: '17 6 * * *'
workflow_dispatch:
jobs:
check:
name: Check
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
test:
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
browser-test:
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@v6
with:
name: browser-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: HACS build validation
uses: 'hacs/action@22.5.0'
with:
category: 'plugin'
# Don't attempt to load into HACS (as it loads the release, not the
# build).
ignore: 'hacs'
- 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