Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(core): separate runtimeConfig for e2e tests and deployment (#5976)

JimmFlyffda9a05677d
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index b3c6d21463..dc66c88f61 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -118,6 +118,7 @@ jobs:
runs-on: ubuntu-latest
env:
DISTRIBUTION: browser
+ IN_CI_TEST: true
strategy:
fail-fast: false
matrix:
@@ -370,6 +371,7 @@ jobs:
env:
DISTRIBUTION: browser
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
+ IN_CI_TEST: true
strategy:
fail-fast: false
matrix:
diff --git a/packages/frontend/core/.webpack/runtime-config.ts b/packages/frontend/core/.webpack/runtime-config.ts
index a712f409d2..5e43f8f11b 100644
--- a/packages/frontend/core/.webpack/runtime-config.ts
+++ b/packages/frontend/core/.webpack/runtime-config.ts
@@ -147,6 +147,10 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
: currentBuildPreset.allowLocalWorkspace,
};
+ const testEnvironmentPreset = {
+ allowLocalWorkspace: true,
+ };
+
if (buildFlags.mode === 'development') {
currentBuildPreset.serverUrlPrefix = 'http://localhost:8080';
}
@@ -156,6 +160,10 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
// environment preset will overwrite current build preset
// this environment variable is for debug proposes only
// do not put them into CI
- ...(process.env.CI ? { allowLocalWorkspace: true } : environmentPreset),
+ ...(process.env.CI ? {} : environmentPreset),
+
+ // test environment preset will overwrite current build preset
+ // this environment variable is for github workflow e2e-test only
+ ...(process.env.IN_CI_TEST ? testEnvironmentPreset : {}),
};
}