Skip to content

CI

CI #54

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 2
jobs:
unit-test-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: yarn
- name: Install
run: yarn install
- name: Lint
run: |
yarn run lint
- name: Test
run: |
yarn run coverage:unit
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: coverage_unit
path: coverage/clover.xml
retention-days: 4
- name: Build
run: yarn run build
- name: Check browser compatibility
run: yarn run lint:compat
cypress-run:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
browser: [firefox, chrome]
include:
- os: macos-latest
browser: edge
env:
COVERAGE: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: yarn
- name: Component test
uses: cypress-io/github-action@v6
with:
component: true
browser: ${{ matrix.browser }}
- name: E2E test
uses: cypress-io/github-action@v6
env:
BASE_URL: http://localhost:4173/
with:
install: false # already installed in previous step
build: yarn run build --mode offline
start: yarn run preview
config: baseUrl=${{ env.BASE_URL }}
wait-on: ${{ env.BASE_URL }}
browser: ${{ matrix.browser }}
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: tests/e2e/screenshots
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: 'coverage_cypress_${{ matrix.browser }}_${{ matrix.os }}'
path: coverage/lcov.info
retention-days: 4
codecov-upload:
needs: [unit-test-and-build, cypress-run]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download coverage artifacts
uses: actions/download-artifact@v3
- name: Codecov upload
uses: codecov/codecov-action@v3
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
# Token not required for public repos, but avoids upload failure due
# to rate-limiting (but not for PRs opened from forks)
token: ${{ secrets.CODECOV_TOKEN }}