Skip to content

Commit

Permalink
types: added Storybook tests to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrippey committed Sep 19, 2023
1 parent c878707 commit 3b31e05
Show file tree
Hide file tree
Showing 4 changed files with 1,426 additions and 74 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,36 @@ jobs:
with:
version: 7

- name: Get pnpm store directory
- name: "Get pnpm store directory"
id: pnpm-cache
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- name: Setup pnpm cache
- name: "Setup pnpm cache"
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
- name: "Install dependencies"
run: pnpm install

- name: Lint
- name: "Lint"
run: pnpm run lint

- name: TypeCheck
- name: "TypeCheck"
run: pnpm run typecheck

- name: "Storybook: Install Extra Dependencies"
working-directory: packages/nextjs
run: pnpm exec playwright install

- name: "Storybook: Build"
working-directory: packages/nextjs
run: pnpm run storybook:build

- name: "Storybook: Run Tests"
working-directory: packages/nextjs
run: pnpm run test:storybook:start

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ yarn-error.log*
dist
.idea
.vscode

storybook-static/
8 changes: 7 additions & 1 deletion packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"lint": "next lint --quiet",
"typecheck": "tsc --noEmit",
"storybook": "storybook dev -p 6006",
"storybook:build": "storybook build"
"storybook:build": "storybook build",
"storybook:start": "test -d storybook-static || pnpm run storybook:build && http-server --port 6006 --silent true storybook-static",
"test:storybook": "test-storybook --verbose --maxWorkers 2",
"test:storybook:start": "start-server-and-test 'storybook:start' 6006 'test:storybook'"
},
"dependencies": {
"@headlessui/react": "^1.7.8",
Expand Down Expand Up @@ -62,6 +65,7 @@
"@storybook/jest": "^0.2.2",
"@storybook/nextjs": "^7.4.0",
"@storybook/react": "^7.4.0",
"@storybook/test-runner": "^0.13.0",
"@storybook/testing-library": "^0.2.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
Expand All @@ -83,10 +87,12 @@
"faker": "^5.5.3",
"flatted": "^3.2.7",
"groq-js": "^1.1.0",
"http-server": "^14.1.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"msw": "^0.47.4",
"postcss": "^8.4.16",
"start-server-and-test": "^1.15.2",
"storybook": "^7.4.0",
"tailwindcss": "^3.1.8"
},
Expand Down
Loading

0 comments on commit 3b31e05

Please sign in to comment.