Skip to content

Chore: Make observe changes logic easier to read #1894

Chore: Make observe changes logic easier to read

Chore: Make observe changes logic easier to read #1894

Workflow file for this run

name: "CI"
on:
push:
branches:
- main
- next/*
- feat/*
- fix/*
- perf/*
- v1
- v1.*
pull_request:
branches:
- main
- next/*
- feat/*
- fix/*
- perf/*
- v1
- v1.*
permissions:
contents: read
actions: read
checks: write
pull-requests: write
jobs:
changes:
name: Check Changed Files
if: github.event_name == 'pull_request'
timeout-minutes: 5
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
ui: ${{ steps.filter.outputs.ui }}
packages: ${{ steps.filter.outputs.packages }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
ui:
- 'src/**'
packages:
- 'packages/**'
unit-test:
name: Run Unit Tests
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v1
- name: Install NPM Dependencies
run: npm ci
- name: Run Unit Tests
run: npm run ci:test:unit
- name: Generate Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit Test Results
path: tests/results/test-results-unit-junit.xml
token: ${{ secrets.GITHUB_TOKEN }}
reporter: java-junit
- name: "Upload JSON for badge"
uses: actions/upload-artifact@v4
with:
name: test-results-unit
path: tests/results/test-results-unit.json
browser:
name: Run Browser E2E Tests
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v1
- name: Install NPM Dependencies
run: npm ci
- name: Get Playwright Version
run: |
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
PLAYWRIGHT_VERSION="$(npm ls playwright | grep playwright | awk -F@ '{print $NF}' | awk '!/deduped/')"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright
if: steps.changed-files.outputs.only_changed != 'true'
uses: actions/cache@v4
with:
key: ${{ runner.os }}-playwright-bin-${{ env.PLAYWRIGHT_VERSION }}
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
restore-keys: |
${{ runner.os }}-playwright-bin-
- name: Install Playwright
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install chromium
- name: Run Browser Tests
run: npm run ci:test:browser
- name: Generate Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Browser Test Results
path: tests/results/test-results-browser-junit.xml
reporter: java-junit
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Upload JSON for badge"
uses: actions/upload-artifact@v4
with:
name: test-results-browser
path: tests/results/test-results-browser.json
coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v1
- name: Install NPM Dependencies
run: npm ci
- name: Get Playwright Version
run: |
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
PLAYWRIGHT_VERSION=$(npm ls playwright | grep playwright | awk -F@ '{print $NF}' | awk '!/deduped/')
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright
if: steps.changed-files.outputs.only_changed != 'true'
uses: actions/cache@v4
with:
key: ${{ runner.os }}-playwright-bin-${{ env.PLAYWRIGHT_VERSION }}
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
restore-keys: |
${{ runner.os }}-playwright-bin-
- name: Install Playwright
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install chromium
- name: Check Code Coverage
run: npm run ci:coverage
- name: Generate Coverage Report
if: always() # still generate if tests failing
uses: davelosert/vitest-coverage-report-action@v2
with:
name: "Package"
vite-config-path: "./tests/configs/vitest/ci-coverage.config.js"
json-summary-path: "./tests/coverage/coverage-summary.json"
json-final-path: "./tests/coverage/coverage-final.json"
file-coverage-mode: "changes"
- name: "Upload JSON for badge"
uses: actions/upload-artifact@v4
with:
name: coverage-summary
path: tests/coverage/coverage-summary.json