mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-21 08:17:10 +08:00
chore: improve ci build speed (#2953)
This commit is contained in:
19
.github/workflows/build.yml
vendored
19
.github/workflows/build.yml
vendored
@@ -203,18 +203,9 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
shard: [1, 2, 3, 4]
|
shard: [1, 2, 3, 4, 5]
|
||||||
environment: development
|
environment: development
|
||||||
needs: [build-web, build-storybook]
|
needs: build-web
|
||||||
services:
|
|
||||||
octobase:
|
|
||||||
image: ghcr.io/toeverything/cloud-self-hosted:nightly-latest
|
|
||||||
ports:
|
|
||||||
- 3000:3000
|
|
||||||
env:
|
|
||||||
SIGN_KEY: 'test123'
|
|
||||||
RUST_LOG: 'debug'
|
|
||||||
JWST_DEV: '1'
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -228,12 +219,6 @@ jobs:
|
|||||||
name: next-js-static
|
name: next-js-static
|
||||||
path: ./apps/web/out
|
path: ./apps/web/out
|
||||||
|
|
||||||
- name: Download storybook artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: storybook
|
|
||||||
path: ./apps/storybook/storybook-static
|
|
||||||
|
|
||||||
- name: Run playwright tests
|
- name: Run playwright tests
|
||||||
run: yarn e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
run: yarn e2e --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||||||
env:
|
env:
|
||||||
|
|||||||
3
.github/workflows/cancel.yml
vendored
3
.github/workflows/cancel.yml
vendored
@@ -13,5 +13,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: styfle/cancel-workflow-action@0.11.0
|
- uses: styfle/cancel-workflow-action@0.11.0
|
||||||
with:
|
with:
|
||||||
workflow_id: 44038251
|
# See https://api.github.com/repos/toeverything/AFFiNE/actions/workflows
|
||||||
|
workflow_id: 44038251, 61883931
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|||||||
46
.github/workflows/nx.yml
vendored
Normal file
46
.github/workflows/nx.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: NX
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- v[0-9]+.[0-9]+.x-staging
|
||||||
|
- v[0-9]+.[0-9]+.x
|
||||||
|
paths-ignore:
|
||||||
|
- README.md
|
||||||
|
- .github/**
|
||||||
|
- '!.github/workflows/nx.yml'
|
||||||
|
- '!.github/actions/build-rust/action.yml'
|
||||||
|
- '!.github/actions/setup-node/action.yml'
|
||||||
|
pull_request:
|
||||||
|
merge_group:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- v[0-9]+.[0-9]+.x-staging
|
||||||
|
- v[0-9]+.[0-9]+.x
|
||||||
|
paths-ignore:
|
||||||
|
- README.md
|
||||||
|
- .github/**
|
||||||
|
- '!.github/workflows/nx.yml'
|
||||||
|
- '!.github/actions/build-rust/action.yml'
|
||||||
|
- '!.github/actions/setup-node/action.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
name: Nx Cloud - Main Job
|
||||||
|
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0
|
||||||
|
with:
|
||||||
|
main-branch-name: master
|
||||||
|
number-of-agents: 5
|
||||||
|
init-commands: |
|
||||||
|
yarn exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
|
||||||
|
parallel-commands: |
|
||||||
|
yarn exec nx-cloud record -- yarn exec nx format:check
|
||||||
|
parallel-commands-on-agents: |
|
||||||
|
yarn exec nx affected --target=build --parallel=5
|
||||||
|
|
||||||
|
agents:
|
||||||
|
name: Nx Cloud - Agents
|
||||||
|
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.0
|
||||||
|
with:
|
||||||
|
number-of-agents: 5
|
||||||
@@ -135,7 +135,7 @@ We would also like to give thanks to open-source projects that make AFFiNE possi
|
|||||||
|
|
||||||
- [BlockSuite](https://github.com/toeverything/BlockSuite) - 💠 BlockSuite is the open-source collaborative editor project behind AFFiNE.
|
- [BlockSuite](https://github.com/toeverything/BlockSuite) - 💠 BlockSuite is the open-source collaborative editor project behind AFFiNE.
|
||||||
- [OctoBase](https://github.com/toeverything/OctoBase) - 🐙 OctoBase is the open-source database behind AFFiNE, local-first, yet collaborative. A light-weight, scalable, data engine written in Rust.
|
- [OctoBase](https://github.com/toeverything/OctoBase) - 🐙 OctoBase is the open-source database behind AFFiNE, local-first, yet collaborative. A light-weight, scalable, data engine written in Rust.
|
||||||
- [Yjs](https://github.com/yjs/yjs) & [Yrs](https://github.com/y-crdt/y-crdt) - Fundamental support of CRDTs for our implementation on state management and data sync.
|
- [Yjs](https://github.com/yjs/yjs) - Fundamental support of CRDTs for our implementation on state management and data sync.
|
||||||
- [Electron](https://github.com/electron/electron) - Build cross-platform desktop apps with JavaScript, HTML, and CSS.
|
- [Electron](https://github.com/electron/electron) - Build cross-platform desktop apps with JavaScript, HTML, and CSS.
|
||||||
- [React](https://github.com/facebook/react) - View layer support and web GUI framework.
|
- [React](https://github.com/facebook/react) - View layer support and web GUI framework.
|
||||||
- [Rust](https://github.com/rust-lang/rust) - High performance language that extends the ability and availability of our real-time backend, OctoBase.
|
- [Rust](https://github.com/rust-lang/rust) - High performance language that extends the ability and availability of our real-time backend, OctoBase.
|
||||||
|
|||||||
5
nx.json
5
nx.json
@@ -35,10 +35,7 @@
|
|||||||
"{projectRoot}/node_modules/.cache",
|
"{projectRoot}/node_modules/.cache",
|
||||||
"{projectRoot}/target",
|
"{projectRoot}/target",
|
||||||
"{workspaceRoot}/apps/storybook/storybook-static",
|
"{workspaceRoot}/apps/storybook/storybook-static",
|
||||||
"{workspaceRoot}/packages/i18n/src/i18n-generated.ts",
|
"{workspaceRoot}/packages/i18n/src/i18n-generated.ts"
|
||||||
"{workspaceRoot}/packages/native/*.node",
|
|
||||||
"{workspaceRoot}/packages/storage/*.node",
|
|
||||||
"{workspaceRoot}/affine.db"
|
|
||||||
],
|
],
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
|
|||||||
25
packages/native/project.json
Normal file
25
packages/native/project.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "@affine/native",
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "packages/native",
|
||||||
|
"sourceRoot": "packages/native/src",
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "nx:run-script",
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"options": {
|
||||||
|
"script": "build"
|
||||||
|
},
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"runtime": "rustc --version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"runtime": "node -v"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": ["{projectRoot}/*.node", "{workspaceRoot}/affine.db"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
packages/storage/project.json
Normal file
25
packages/storage/project.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "@affine/storage",
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "packages/storage",
|
||||||
|
"sourceRoot": "packages/storage/src",
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "nx:run-script",
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"options": {
|
||||||
|
"script": "build"
|
||||||
|
},
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"runtime": "rustc --version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"runtime": "node -v"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": ["{projectRoot}/*.node", "{workspaceRoot}/*.node"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,17 +52,6 @@ const config: PlaywrightTestConfig = {
|
|||||||
ENABLE_DEBUG_PAGE: '1',
|
ENABLE_DEBUG_PAGE: '1',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
// Intentionally not building the storybook, reminds you to run it by yourself.
|
|
||||||
command: 'yarn run start:storybook',
|
|
||||||
port: 6006,
|
|
||||||
timeout: 120 * 1000,
|
|
||||||
reuseExistingServer: !process.env.CI,
|
|
||||||
env: {
|
|
||||||
COVERAGE: process.env.COVERAGE || 'false',
|
|
||||||
ENABLE_DEBUG_PAGE: '1',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// Intentionally not building the web, reminds you to run it by yourself.
|
// Intentionally not building the web, reminds you to run it by yourself.
|
||||||
{
|
{
|
||||||
command: 'yarn run start:web-static',
|
command: 'yarn run start:web-static',
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import { test } from '@affine-test/kit/playwright';
|
|
||||||
import type { Page } from '@playwright/test';
|
|
||||||
import { expect } from '@playwright/test';
|
|
||||||
|
|
||||||
async function openStorybook(page: Page) {
|
|
||||||
return page.goto(`http://localhost:6006`);
|
|
||||||
}
|
|
||||||
|
|
||||||
test('Basic', async ({ page }) => {
|
|
||||||
await openStorybook(page);
|
|
||||||
await page.click('#storybook-explorer-tree >> #affine-button');
|
|
||||||
await page.click('#affine-button--test');
|
|
||||||
|
|
||||||
const iframe = page.frameLocator('iframe');
|
|
||||||
await iframe.locator('input[data-testid="test-input"]').type('Hello World!');
|
|
||||||
|
|
||||||
expect(
|
|
||||||
await iframe.locator('input[data-testid="test-input"]').inputValue()
|
|
||||||
).toBe('Hello World!');
|
|
||||||
await iframe.locator('[data-testid="clear-button"]').click();
|
|
||||||
expect(
|
|
||||||
await iframe.locator('input[data-testid="test-input"]').textContent()
|
|
||||||
).toBe('');
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user