From abc18795837ce689fed7964870411331848f4f03 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Fri, 29 Sep 2023 16:47:03 -0700 Subject: [PATCH 1/3] Setup docker config for e2e --- .dockerignore | 33 +++++++++++++++++++++++++++++++++ Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ compose.yaml | 20 ++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..c275992c7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,33 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/engine/reference/builder/#dockerignore-file + +**/.classpath +**/.dockerignore +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.next +**/.cache +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +**/build +**/dist +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b4d2df394 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# syntax=docker/dockerfile:1 + +FROM mcr.microsoft.com/playwright:v1.35.1-jammy + +WORKDIR /usr/src/app + +# Download dependencies as a separate step to take advantage of Docker's caching. + +COPY package.json package-lock.json ./ +COPY packages/core/package.json packages/core/package.json +COPY packages/js/package.json packages/js/package.json +COPY packages/node/package.json packages/node/package.json +COPY packages/realtime-api/package.json packages/realtime-api/package.json +COPY packages/swaig/package.json packages/swaig/package.json +COPY packages/web-api/package.json packages/web-api/package.json +COPY packages/webrtc/package.json packages/webrtc/package.json +COPY scripts/sw-build/package.json scripts/sw-build/package.json +COPY scripts/sw-build-all/package.json scripts/sw-build-all/package.json +COPY scripts/sw-common/package.json scripts/sw-common/package.json +COPY scripts/sw-release/package.json scripts/sw-release/package.json +COPY scripts/sw-test/package.json scripts/sw-test/package.json +COPY internal/e2e-js/package.json internal/e2e-js/package.json +COPY internal/e2e-realtime-api/package.json internal/e2e-realtime-api/package.json +COPY internal/playground-js/package.json internal/playground-js/package.json +COPY internal/playground-realtime-api/package.json internal/playground-realtime-api/package.json +COPY internal/playground-swaig/package.json internal/playground-swaig/package.json +COPY internal/stack-tests/package.json internal/stack-tests/package.json + +# Leverage a cache mount to /root/.npm to speed up subsequent builds. +RUN --mount=type=cache,target=/root/.npm \ + npm ci + +COPY . . + +RUN npm i && \ + npm run build + +CMD ["node"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 000000000..b2d611eb0 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,20 @@ +services: + e2e-js: + build: + context: . + ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. + working_dir: /usr/src/app/internal/e2e-js + command: npm run -w=@sw-internal/e2e-js dev -- roomSession.spec.ts + volumes: + - ./:/usr/src/app + + e2e-realtime-api: + build: + context: . + ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. + working_dir: /usr/src/app/internal/e2e-realtime-api + command: npm run -w=@sw-internal/e2e-realtime-api dev + env_file: + - internal/e2e-realtime-api/.env + volumes: + - ./:/usr/src/app From 845fe46a69016c65599692c3dee1f5248c7b1071 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Fri, 29 Sep 2023 16:51:53 -0700 Subject: [PATCH 2/3] Example of a single test file --- compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yaml b/compose.yaml index b2d611eb0..6eb41dff2 100644 --- a/compose.yaml +++ b/compose.yaml @@ -4,7 +4,7 @@ services: context: . ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. working_dir: /usr/src/app/internal/e2e-js - command: npm run -w=@sw-internal/e2e-js dev -- roomSession.spec.ts + command: npm run -w=@sw-internal/e2e-js dev # -- roomSession.spec.ts volumes: - ./:/usr/src/app @@ -13,7 +13,7 @@ services: context: . ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. working_dir: /usr/src/app/internal/e2e-realtime-api - command: npm run -w=@sw-internal/e2e-realtime-api dev + command: npm run -w=@sw-internal/e2e-realtime-api dev # -- chat.test.ts env_file: - internal/e2e-realtime-api/.env volumes: From 261d43a9dfe816d9bf1800f6cd947292dca4b79a Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Fri, 29 Sep 2023 17:14:45 -0700 Subject: [PATCH 3/3] new spec --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index 6eb41dff2..7c45eeb65 100644 --- a/compose.yaml +++ b/compose.yaml @@ -4,7 +4,7 @@ services: context: . ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. working_dir: /usr/src/app/internal/e2e-js - command: npm run -w=@sw-internal/e2e-js dev # -- roomSession.spec.ts + command: npm run -w=@sw-internal/e2e-js dev -- webrtcCalling.spec.ts volumes: - ./:/usr/src/app