Skip to content

Commit

Permalink
adding various ci checks
Browse files Browse the repository at this point in the history
  • Loading branch information
stephiescastle committed Jul 8, 2024
1 parent 6490903 commit 4e42cf0
Show file tree
Hide file tree
Showing 10 changed files with 2,874 additions and 396 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/nuxt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# checks if nuxt module builds successfully

name: Build Nuxt Module

on:
push:
branches:
- main
paths:
- 'packages/common/**'
- 'packages/nuxt/**'
- 'packages/vue/**'
pull_request:
paths:
- 'packages/common/**'
- 'packages/nuxt/**'
- 'packages/vue/**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Set up Node ⬢
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies 🧱
run: pnpm i

- name: Build static Storybook 🛠
run: make nuxt-build
118 changes: 118 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# https://storybook.js.org/docs/vue/writing-tests/test-runner#run-against-non-deployed-storybooks

name: 'Storybook & Testing CI'

on:
push:
branches:
- main
paths:
- 'packages/common/**'
- 'packages/vue/**'
pull_request:
paths:
- 'apps/vue-storybook/**'
- 'packages/common/**'
- 'packages/vue/**'

jobs:
build:
name: Build
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Set up Node ⬢
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies 🧱
run: pnpm i

- name: Build Storybook
run: make vue-storybook-build

- name: Upload build to artifacts
uses: actions/upload-artifact@v3
with:
name: storybook
path: apps/vue-storybook/storybook_compiled

a11y:
name: Accessibility Tests
needs: build
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Set up Node ⬢
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies 🧱
run: pnpm i

- name: Install Playwright
run: pnpm --filter @explorer-1/vue-storybook exec playwright install

- name: Download storybook build
uses: actions/download-artifact@v3
with:
name: storybook
path: apps/vue-storybook/storybook_compiled

- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"pnpm --filter @explorer-1/vue-storybook start" \
"pnpm --filter @explorer-1/vue-storybook test:storybook:ci"
chromatic:
name: Publish
needs: [build]
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Set up Node ⬢
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies 🧱
run: pnpm i

- name: Download storybook build
uses: actions/download-artifact@v3
with:
name: storybook
path: apps/vue-storybook/storybook_compiled

- uses: chromaui/action@v1
# Options required for Chromatic's GitHub Action
with:
storybookBuildDir: 'apps/vue-storybook/storybook_compiled'
#👇 Chromatic projectToken,
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
exitOnceUploaded: true
38 changes: 38 additions & 0 deletions .github/workflows/vue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# checks if vue package builds successfully

name: Build Vue Library

on:
push:
branches:
- main
paths:
- 'packages/common/**'
- 'packages/vue/**'
pull_request:
paths:
- 'packages/common/**'
- 'packages/vue/**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Set up Node ⬢
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies 🧱
run: pnpm i

- name: Build static Storybook 🛠
run: make vue-build
22 changes: 11 additions & 11 deletions apps/html-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@
"@percy/cli": "^1.28.6",
"@percy/storybook": "^6.0.0",
"@rushstack/eslint-patch": "^1.2.0",
"@storybook/addon-a11y": "^8.1.6",
"@storybook/addon-docs": "^8.1.6",
"@storybook/addon-essentials": "^8.1.6",
"@storybook/addon-links": "^8.1.6",
"@storybook/addon-viewport": "^8.1.6",
"@storybook/html": "^8.1.6",
"@storybook/html-vite": "^8.1.6",
"@storybook/manager-api": "^8.1.6",
"@storybook/preview-api": "^8.1.6",
"@storybook/theming": "^8.1.6",
"@storybook/addon-a11y": "^8.1.11",
"@storybook/addon-docs": "^8.1.11",
"@storybook/addon-essentials": "^8.1.11",
"@storybook/addon-links": "^8.1.11",
"@storybook/addon-viewport": "^8.1.11",
"@storybook/html": "^8.1.11",
"@storybook/html-vite": "^8.1.11",
"@storybook/manager-api": "^8.1.11",
"@storybook/preview-api": "^8.1.11",
"@storybook/theming": "^8.1.11",
"@whitespace/storybook-addon-html": "^6.1.1",
"autoprefixer": "^10.4.19",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.38",
"postcss-import": "^16.1.0",
"remark-gfm": "^4.0.0",
"rimraf": "^5.0.5",
"storybook": "^8.1.6",
"storybook": "^8.1.11",
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
Expand Down
3 changes: 2 additions & 1 deletion apps/vue-storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const config = {
},
'@storybook/addon-a11y',
'@whitespace/storybook-addon-html',
'storybook-addon-vue-slots'
'storybook-addon-vue-slots',
'@chromatic-com/storybook'
],
staticDirs: [
'./../public',
Expand Down
22 changes: 22 additions & 0 deletions apps/vue-storybook/.storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { TestRunnerConfig } from '@storybook/test-runner'
import { injectAxe, checkA11y } from 'axe-playwright'

/*
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api
* to learn more about the test-runner hooks API.
*/
const config: TestRunnerConfig = {
async preVisit(page) {
await injectAxe(page)
},
async postVisit(page) {
await checkA11y(page, '#storybook-root', {
detailedReport: true,
detailedReportOptions: {
html: true
}
})
}
}

export default config
6 changes: 6 additions & 0 deletions apps/vue-storybook/chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"onlyChanged": true,
"projectId": "Project:668c47cbeb95392cd79c3c0d",
"storybookBaseDir": "apps/vue-storybook",
"zip": true
}
21 changes: 14 additions & 7 deletions apps/vue-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
"lint:app:fix": "eslint './.storybook/**/*.@(js|ts)' --fix",
"lint": "eslint './../../packages/vue/src/**/*.stories.@(js|ts|mdx)' && pnpm lint:app",
"lint:fix": "eslint './../../packages/vue/src/**/*.stories.@(js|ts|mdx)' --fix && pnpm lint:app:fix",
"init-msw": "msw init public/"
"init-msw": "msw init public/",
"test": "pnpm test:storybook",
"test:storybook": "test-storybook --stories-json --maxWorkers=4",
"test:storybook:cross-browser": "test-storybook --stories-json --verbose --maxWorkers=4 --browsers chromium webkit firefox",
"test:storybook:ci": "test-storybook --stories-json --maxWorkers=2"
},
"dependencies": {
"@explorer-1/common": "workspace:*",
Expand All @@ -40,26 +44,29 @@
"vue3-compare-image": "^1.2.5"
},
"devDependencies": {
"@chromatic-com/storybook": "^1",
"@explorer-1/html": "workspace:*",
"@explorer-1/prettier-config": "workspace:*",
"@explorer-1/tsconfig": "workspace:*",
"@rushstack/eslint-patch": "^1.2.0",
"@storybook/addon-a11y": "^8.1.6",
"@storybook/addon-essentials": "^8.1.6",
"@storybook/blocks": "^8.1.6",
"@storybook/vue3": "^8.1.6",
"@storybook/vue3-vite": "^8.1.6",
"@storybook/addon-a11y": "^8.1.11",
"@storybook/addon-essentials": "^8.1.11",
"@storybook/blocks": "^8.1.11",
"@storybook/test-runner": "^0.19.0",
"@storybook/vue3": "^8.1.11",
"@storybook/vue3-vite": "^8.1.11",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^7.1.0",
"@whitespace/storybook-addon-html": "^6.1.1",
"autoprefixer": "^10.4.19",
"axe-playwright": "^2.0.1",
"msw": "^2.3.0",
"msw-storybook-addon": "^2.0.2",
"pinia": "^2.1.7",
"postcss": "^8.4.38",
"postcss-import": "^16.1.0",
"rimraf": "^5.0.5",
"storybook": "^8.1.6",
"storybook": "^8.1.11",
"storybook-addon-vue-slots": "^0.9.29",
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/common-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"@explorer-1/common": "workspace:*",
"@explorer-1/prettier-config": "workspace:*",
"@explorer-1/tsconfig": "workspace:*",
"@storybook/blocks": "^8.1.2",
"@storybook/blocks": "^8.1.11",
"rimraf": "^5.0.5",
"storybook": "^8.1.2",
"storybook": "^8.1.11",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
}
Expand Down
Loading

0 comments on commit 4e42cf0

Please sign in to comment.