Skip to content

Commit

Permalink
chore: split package
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Nov 13, 2024
1 parent c64ce7b commit 4ebab64
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/actions/copilot-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'Run Copilot E2E Test'
inputs:
script:
description: 'Script to run'
default: 'yarn workspace @affine-test/affine-cloud-copilot test:e2e --forbid-only'
default: 'yarn workspace @affine-test/affine-cloud-copilot-e2e test --forbid-only'
required: false
openai-key:
description: 'OpenAI secret key'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ jobs:
if: ${{ steps.check-blocksuite-update.outputs.skip != 'true' || steps.filter.outputs.backend == 'true' }}
uses: ./.github/actions/copilot-test
with:
script: yarn workspace @affine-test/affine-cloud-copilot test:e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
script: yarn workspace @affine-test/affine-cloud-copilot-e2e test --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
openai-key: ${{ secrets.COPILOT_OPENAI_API_KEY }}
fal-key: ${{ secrets.COPILOT_FAL_API_KEY }}

Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/copilot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ jobs:
fail-fast: false
matrix:
spec:
- {
name: e2e,
package: '@affine-test/affine-cloud-copilot',
type: e2e,
}
- { name: spec, package: '@affine/server', type: copilot:spec }
- { name: e2e, package: '@affine-test/affine-cloud-copilot-e2e' }
- { name: spec, package: '@affine/server', type: ':copilot:spec' }
services:
postgres:
image: postgres
Expand Down Expand Up @@ -89,7 +85,7 @@ jobs:
uses: ./.github/actions/server-test-env

- name: Run copilot api ${{ matrix.spec.name }} tests
run: yarn workspace ${{ matrix.spec.package }} test:${{ matrix.spec.type }}:coverage --forbid-only
run: yarn workspace ${{ matrix.spec.package }} test${{ matrix.spec.type }}:coverage --forbid-only
env:
CARGO_TARGET_DIR: '${{ github.workspace }}/target'
COPILOT_OPENAI_API_KEY: ${{ secrets.COPILOT_OPENAI_API_KEY }}
Expand Down Expand Up @@ -150,7 +146,7 @@ jobs:
- name: Run Copilot E2E Test ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
uses: ./.github/actions/copilot-test
with:
script: yarn workspace @affine-test/affine-cloud-copilot test:e2e --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
script: yarn workspace @affine-test/affine-cloud-copilot-e2e test --forbid-only --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
openai-key: ${{ secrets.COPILOT_OPENAI_API_KEY }}
fal-key: ${{ secrets.COPILOT_FAL_API_KEY }}

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"outDir": "lib"
},
"include": ["e2e"],
"references": [
{
"path": "../../tests/kit"
"path": "../../../tests/kit"
},
{
"path": "../../tests/fixtures"
"path": "../../../tests/fixtures"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "@affine-test/affine-cloud-copilot",
"private": true,
"name": "@affine-test/affine-cloud-copilot-api",
"type": "module",
"private": true,
"scripts": {
"test:e2e": "yarn playwright test",
"test:api": "ava \"e2e/copilot.e2e.ts\"",
"test:api:coverage": "c8 ava --timeout=5m \"e2e/copilot.e2e.ts\""
"test": "ava \"e2e/copilot.e2e.ts\"",
"test:coverage": "c8 ava --timeout=5m \"e2e/copilot.e2e.ts\""
},
"devDependencies": {
"@affine-test/kit": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ export const runPrisma = async <T>(
cb: (
prisma: InstanceType<
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
typeof import('../../../packages/backend/server/node_modules/@prisma/client').PrismaClient
typeof import('../../../../packages/backend/server/node_modules/@prisma/client').PrismaClient
>
) => Promise<T>
): Promise<T> => {
const {
PrismaClient,
// eslint-disable-next-line @typescript-eslint/no-var-requires
} = await import(
'../../../packages/backend/server/node_modules/@prisma/client'
'../../../../packages/backend/server/node_modules/@prisma/client'
);
const client = new PrismaClient();
await client.$connect();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"target": "ES2022",
Expand All @@ -10,12 +10,14 @@
"verbatimModuleSyntax": false,
"tsBuildInfoFile": "lib/.tsbuildinfo"
},

"include": ["tests"],
"references": [
{
"path": "../../tests/kit"
"path": "../../../tests/kit"
},
{
"path": "../../tests/fixtures"
"path": "../../../tests/fixtures"
}
]
}
14 changes: 14 additions & 0 deletions tests/affine-cloud/copilot-e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@affine-test/affine-cloud-copilot-e2e",
"private": true,
"scripts": {
"test": "yarn playwright test"
},
"devDependencies": {
"@affine-test/kit": "workspace:*",
"@affine/server": "workspace:*",
"@playwright/test": "=1.48.2",
"ava": "^6.1.2"
},
"version": "0.17.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {

const config: PlaywrightTestConfig = {
testDir: './e2e',
testMatch: '**/*.spec.ts',
fullyParallel: !process.env.CI,
timeout: 120_000,
outputDir: testResultDir,
Expand Down
16 changes: 16 additions & 0 deletions tests/affine-cloud/copilot-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"outDir": "lib"
},
"include": ["e2e"],
"references": [
{
"path": "../../../tests/kit"
},
{
"path": "../../../tests/fixtures"
}
]
}
22 changes: 1 addition & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,6 @@ __metadata:
languageName: unknown
linkType: soft

"@affine-test/affine-cloud-copilot@workspace:tests/affine-cloud-copilot":
version: 0.0.0-use.local
resolution: "@affine-test/affine-cloud-copilot@workspace:tests/affine-cloud-copilot"
dependencies:
"@affine-test/kit": "workspace:*"
"@affine/server": "workspace:*"
"@playwright/test": "npm:=1.48.2"
ava: "npm:^6.1.2"
languageName: unknown
linkType: soft

"@affine-test/affine-cloud@workspace:tests/affine-cloud":
version: 0.0.0-use.local
resolution: "@affine-test/affine-cloud@workspace:tests/affine-cloud"
dependencies:
"@affine-test/kit": "workspace:*"
"@playwright/test": "npm:=1.48.2"
languageName: unknown
linkType: soft

"@affine-test/affine-desktop-cloud@workspace:tests/affine-desktop-cloud":
version: 0.0.0-use.local
resolution: "@affine-test/affine-desktop-cloud@workspace:tests/affine-desktop-cloud"
Expand Down Expand Up @@ -750,7 +730,7 @@ __metadata:
languageName: unknown
linkType: soft

"@affine/server@workspace:*, @affine/server@workspace:packages/backend/server":
"@affine/server@workspace:packages/backend/server":
version: 0.0.0-use.local
resolution: "@affine/server@workspace:packages/backend/server"
dependencies:
Expand Down

0 comments on commit 4ebab64

Please sign in to comment.