feat/storybook (#10) #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Set node | |
uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- name: Setup | |
run: npm i -g @antfu/ni | |
- name: Install | |
run: nci | |
- name: Lint | |
run: nr lint | |
typecheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Set node | |
uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- name: Setup | |
run: npm i -g @antfu/ni | |
- name: Install | |
run: nci | |
- name: Typecheck | |
run: nr typecheck | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node: [lts/*] | |
os: [ubuntu-latest] # adding "windows-latest" and "macos-latest" will only slows down CI/CD | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Set node version to ${{ matrix.node }} | |
uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: pnpm | |
- name: Setup | |
run: npm i -g @antfu/ni | |
- name: Install | |
run: nci | |
- name: Build | |
run: nr build | |
- name: Test | |
run: nr test | |
- name: Save test report as artifact on failure | |
uses: actions/upload-artifact@v4.3.1 | |
if: failure() | |
with: | |
name: test-report | |
path: html/ | |
retention-days: 2 | |
# running pnpm story:build --quiet leads to "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory" | |
# storybook-test: | |
# timeout-minutes: 60 | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4.1.1 | |
# - name: Install pnpm | |
# uses: pnpm/action-setup@v3 | |
# - name: Setup node | |
# uses: actions/setup-node@v4.0.2 | |
# with: | |
# node-version: lts/* | |
# cache: pnpm | |
# - name: Install dependencies | |
# run: pnpm install | |
# - name: Install Playwright | |
# run: pnpm dlx playwright install --with-deps | |
# - name: Build Storybook | |
# run: pnpm story:build --quiet | |
# - name: Serve Storybook and run tests | |
# run: | | |
# pnpm dlx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
# "pnpm dlx http-server storybook-static --port 6006 --silent" \ | |
# "pnpm dlx wait-on tcp:6006 && yarn story:test" |