161 lines
4.1 KiB
YAML
161 lines
4.1 KiB
YAML
name: pr/required
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, next]
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup stage
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-hit: ${{ steps.cache-pnpm-store.outputs.cache-hit }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9.12.3
|
|
|
|
- name: Setup Node.js with pnpm cache
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
|
|
- name: Cache pnpm store
|
|
id: cache-pnpm-store
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.pnpm-store
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
lint:
|
|
name: Lint
|
|
needs: setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9.12.3
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Run ESLint (CI mode)
|
|
run: pnpm run lint --max-warnings=0
|
|
|
|
type-check:
|
|
name: Typecheck
|
|
needs: setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9.12.3
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Run TypeScript compiler
|
|
run: pnpm exec tsc --noEmit
|
|
|
|
storybook-build:
|
|
name: Build Storybook
|
|
needs: setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9.12.3
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Build Storybook
|
|
run: pnpm run build-storybook --quiet
|
|
- name: Upload Storybook build
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: storybook-static
|
|
path: storybook-static/
|
|
retention-days: 1
|
|
|
|
test:
|
|
name: Test
|
|
needs: [setup, storybook-build]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9.12.3
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Install Playwright browsers
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
- name: Run unit tests with coverage
|
|
run: pnpm run test:coverage
|
|
- name: Download Storybook build
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: storybook-static
|
|
path: storybook-static/
|
|
- name: Serve Storybook and run tests with coverage
|
|
run: pnpm run test:storybook:ci
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
files: ./coverage/lcov.info,./coverage/storybook/coverage-storybook.json
|
|
flags: unittests,storybook
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
build:
|
|
name: Build
|
|
needs: setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9.12.3
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'pnpm'
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Run Astro build
|
|
run: pnpm exec astro build
|