chore: added concurrency to test workflow #10
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: "Storybook Tests" | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, ready_for_review] | |
branches: [main] | |
concurrency: | |
group: ${{ github.ref }} # This ensures that only one workflow runs per branch | |
cancel-in-progress: true # This cancels any previous runs in the same group | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Cache Playwright browsers | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
- name: Install Playwright | |
run: npx playwright install --with-deps | |
- name: Cache Storybook build | |
uses: actions/cache@v4 | |
with: | |
path: storybook-static | |
key: ${{ runner.os }}-storybook-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-storybook- | |
- name: Build Storybook | |
run: pnpm build-storybook --quiet | |
- name: Serve Storybook and run tests | |
run: | | |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
"npx http-server storybook-static --port 6006 --silent" \ | |
"npx wait-on tcp:127.0.0.1:6006 && pnpm test-storybook" |