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 f29ee4b commit 0c92d41
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,46 @@ 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: |
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 +169,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 0c92d41

Please sign in to comment.