Skip to content

Commit

Permalink
fix: ci service config (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlewind authored May 21, 2024
1 parent e212520 commit 1a76758
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,25 @@ jobs:
- name: Install playwright browsers
run: npx playwright install chromium

- name: Build common package
run: pnpm --filter @notesuite/common build

- name: Start server
run: |
pnpm dev:server > server.log 2>&1 &
SERVER_PID=$!
pnpm dev:web > web.log 2>&1 &
WEB_PID=$!
- name: Wait for services
run: sleep 2

- name: Run E2E test
run: pnpm test

- name: Display server log
if: failure()
run: cat server.log

- name: Display web log
if: failure()
run: cat web.log
2 changes: 1 addition & 1 deletion packages/server/register.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { register } from 'node:module';
import { pathToFileURL } from 'node:url';

register('ts-node/esm', pathToFileURL('./'));
register('ts-node/esm', pathToFileURL('./'));
1 change: 0 additions & 1 deletion packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { initWebDAVServer } from './drive/drive.js';
import { initAppContext, initWSServer } from './utils.js';

const context = await initAppContext();

registerAPI(context);
initWSServer(context);
initWebDAVServer(context);
3 changes: 3 additions & 0 deletions tests/common/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export class TestAgent {

async start(options: StartOptions) {
this.options = options;
if (process.env.CI) return;

await this.runner.clean();
await Promise.all([
this.runner.startServer(options.backendPort, options.name),
Expand All @@ -89,6 +91,7 @@ export class TestAgent {
}

async stop() {
if (process.env.CI) return;
await this.runner.stop();
}

Expand Down
2 changes: 0 additions & 2 deletions tests/common/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ export class AppRunner {
}

async stop() {
if (process.env.CI) return;

await Promise.all([
this._terminateProcess(this.serverProcess, 'server'),
this._terminateProcess(this.webProcess, 'web'),
Expand Down
5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "NodeNext"
},
"ts-node": {
"experimentalSpecifierResolution": "node",
"transpileOnly": true,
"esm": true
}
}

0 comments on commit 1a76758

Please sign in to comment.