Skip to content

Commit

Permalink
👷 [#31] -- add running storybook tests to CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed May 11, 2023
1 parent 5b653b3 commit a4300f0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,47 @@ jobs:
- name: Run ESLint
run: yarn test:lint

tests:
name: Run Storybook tests
runs-on: ubuntu-latest
needs:
- storybook

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn

- name: Install dependencies
run: yarn install

# Reference: https://storybook.js.org/docs/6.5/react/writing-tests/test-runner#run-against-non-deployed-storybooks
- name: Set up test environment
run: |
npx playwright install --with-deps
- name: Download storybook artifact
uses: actions/download-artifact@v3
with:
name: github-pages
path: storybook-static

- name: Serve storybook and run tests
run: |
cd storybook-static/ && tar -xvf artifact.tar && cd ..
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --quiet" \
"npx wait-on -l http://127.0.0.1:6006 && yarn test:storybook"
deploy:
runs-on: ubuntu-latest
needs:
- storybook
- prettier
- eslint
- tests
# do not run in forks & only publish main branch
if: github.ref_name == 'main' && github.repository_owner == 'open-formulieren'

Expand Down Expand Up @@ -135,6 +170,7 @@ jobs:
- build-package
- prettier
- eslint
- tests

# do not publish in forks or non-tag pushes
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'open-formulieren'
Expand Down

0 comments on commit a4300f0

Please sign in to comment.