ci: improve storybook build (#1728)
This commit is contained in:
35
.github/workflows/build-master.yml
vendored
35
.github/workflows/build-master.yml
vendored
@@ -16,8 +16,25 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
- run: yarn lint --max-warnings=0
|
- run: yarn lint --max-warnings=0
|
||||||
|
|
||||||
|
build-storybook:
|
||||||
|
name: Build Storybook
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: development
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
|
- run: yarn build:storybook
|
||||||
|
- name: Upload storybook artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: storybook
|
||||||
|
path: ./packages/component/storybook-static
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
name: Build frontend
|
name: Build @affine/web
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: production
|
environment: production
|
||||||
|
|
||||||
@@ -51,7 +68,9 @@ jobs:
|
|||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
name: next-js
|
||||||
path: ./apps/web/out
|
path: ./apps/web/out
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
publish-frontend:
|
publish-frontend:
|
||||||
name: Push frontend image
|
name: Push frontend image
|
||||||
@@ -75,8 +94,8 @@ jobs:
|
|||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: next-js
|
||||||
path: apps/web/out/
|
path: ./apps/web/out
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@@ -111,7 +130,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
shard: [1, 2, 3, 4]
|
shard: [1, 2, 3, 4]
|
||||||
environment: development
|
environment: development
|
||||||
needs: build-frontend
|
needs: [build-frontend, build-storybook]
|
||||||
services:
|
services:
|
||||||
octobase:
|
octobase:
|
||||||
image: ghcr.io/toeverything/cloud-self-hosted:nightly-latest
|
image: ghcr.io/toeverything/cloud-self-hosted:nightly-latest
|
||||||
@@ -134,9 +153,15 @@ jobs:
|
|||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: next-js
|
||||||
path: ./apps/web/.next
|
path: ./apps/web/.next
|
||||||
|
|
||||||
|
- name: Download storybook artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: storybook
|
||||||
|
path: ./packages/component/storybook-static
|
||||||
|
|
||||||
- name: Run playwright tests
|
- name: Run playwright tests
|
||||||
run: yarn test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
run: yarn test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||||||
env:
|
env:
|
||||||
|
|||||||
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@@ -17,8 +17,25 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
- run: yarn lint --max-warnings=0
|
- run: yarn lint --max-warnings=0
|
||||||
|
|
||||||
|
build-storybook:
|
||||||
|
name: Build Storybook
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: development
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: ./.github/actions/setup-node
|
||||||
|
- run: yarn build:storybook
|
||||||
|
- name: Upload storybook artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: storybook
|
||||||
|
path: ./packages/component/storybook-static
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build on Pull Request
|
name: Build @affine/web
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: development
|
environment: development
|
||||||
|
|
||||||
@@ -48,8 +65,9 @@ jobs:
|
|||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: next-js
|
||||||
path: ./apps/web/.next
|
path: ./apps/web/.next
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
e2e-test:
|
e2e-test:
|
||||||
name: E2E Test
|
name: E2E Test
|
||||||
@@ -59,7 +77,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
shard: [1, 2, 3, 4]
|
shard: [1, 2, 3, 4]
|
||||||
environment: development
|
environment: development
|
||||||
needs: [build]
|
needs: [build, build-storybook]
|
||||||
services:
|
services:
|
||||||
octobase:
|
octobase:
|
||||||
image: ghcr.io/toeverything/cloud-self-hosted:nightly-latest
|
image: ghcr.io/toeverything/cloud-self-hosted:nightly-latest
|
||||||
@@ -79,9 +97,15 @@ jobs:
|
|||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: next-js
|
||||||
path: ./apps/web/.next
|
path: ./apps/web/.next
|
||||||
|
|
||||||
|
- name: Download storybook artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: storybook
|
||||||
|
path: ./packages/component/storybook-static
|
||||||
|
|
||||||
- name: Run playwright tests
|
- name: Run playwright tests
|
||||||
run: yarn test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
run: yarn test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ const config: PlaywrightTestConfig = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'yarn run build:storybook && yarn run start:storybook',
|
// Intentionally not building the storybook, reminds you to run it by yourself.
|
||||||
|
command: 'yarn run start:storybook',
|
||||||
port: 6006,
|
port: 6006,
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
|
|||||||
Reference in New Issue
Block a user