chore: switch to bun #26
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: 'UI Tests' | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
# Install and cache npm dependencies | |
install-cache: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-npm | |
- name: Install dependencies if cache invalid | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: bun install | |
# Run interaction and accessibility tests | |
interaction-and-accessibility: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
needs: install-cache | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: Restore npm dependencies | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-npm | |
- name: Install Playwright | |
run: bunx playwright install --with-deps | |
- name: Build Storybook | |
run: bun run build-storybook | |
- name: Serve Storybook and run tests | |
run: | | |
bunx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
"bunx http-server storybook-static --port 6006 --silent" \ | |
"bunx wait-on --timeout 5000 tcp:127.0.0.1:6006 && bun run test-storybook" | |
# Run visual and composition tests with Chromatic | |
visual-and-composition: | |
runs-on: ubuntu-latest | |
needs: install-cache | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required to retrieve git history | |
- name: Restore npm dependencies | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-npm | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
with: | |
# Grab this from the Chromatic manage page | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |