Skip to content

Commit 94e468d

Browse files
authored
chore: cache e2e deps (#1023)
1 parent c16937b commit 94e468d

6 files changed

Lines changed: 53 additions & 5 deletions

File tree

e2e/.dockerignore

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
node_modules
1+
# Ignore node_modules - dependencies are installed in container
22
tests/node_modules
3-
*.log
3+
4+
# Ignore IDE and editor files
5+
.idea
6+
.vscode
7+
*.swp
8+
*.swo
9+
*~
10+
11+
# Ignore OS files
12+
.DS_Store
13+
Thumbs.db
14+
15+
# Ignore git
416
.git
5-
platforms/
6-
*.sh
17+
.gitignore
18+
19+
# Ignore build artifacts
20+
tests/dist
21+
tests/coverage
22+
23+
# Ignore platform-specific files (not needed for test container build)
24+
platforms

e2e/Dockerfile.tests

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1+
# syntax=docker/dockerfile:1
12
FROM node:22-alpine
23

34
WORKDIR /tests
45

56
# Install dependencies first for better caching
7+
# Use BuildKit cache mount to persist npm cache between builds
68
COPY tests/package*.json ./
7-
RUN npm ci
9+
RUN --mount=type=cache,target=/root/.npm \
10+
npm ci
811

912
# Copy test source files
1013
COPY tests/ ./
1114

15+
# Create cache directory for Jest/ts-jest transformations
16+
# This will be mounted as a cache volume at runtime
17+
RUN mkdir -p /tmp/jest_cache
18+
19+
# Set Jest cache directory via environment variable
20+
ENV JEST_CACHE_DIRECTORY=/tmp/jest_cache
21+
1222
# Run tests
1323
CMD ["npm", "test"]

e2e/platforms/bukkit/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ services:
2323
TYPE: "PAPER"
2424
VERSION: "1.21.1"
2525
ONLINE_MODE: "false"
26+
# Skip re-downloading server JAR just to verify hash (speeds up cached runs)
27+
SKIP_SERVER_JAR_HASH_CHECK: "true"
2628
ENABLE_RCON: "true"
2729
RCON_PASSWORD: "testing"
2830
RCON_PORT: 25575
@@ -77,6 +79,9 @@ services:
7779
RCON_HOST: paper
7880
RCON_PORT: 25575
7981
RCON_PASSWORD: testing
82+
volumes:
83+
# Cache Jest/ts-jest transformations between runs
84+
- jest-cache:/tmp/jest_cache
8085
networks:
8186
- banmanager
8287

@@ -86,3 +91,4 @@ networks:
8691

8792
volumes:
8893
paper-data:
94+
jest-cache:

e2e/platforms/fabric/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ services:
3030
VERSION: "${MC_VERSION:-1.21.4}"
3131
FABRIC_LOADER_VERSION: "${FABRIC_LOADER:-0.16.9}"
3232
ONLINE_MODE: "false"
33+
# Skip re-downloading server JAR just to verify hash (speeds up cached runs)
34+
SKIP_SERVER_JAR_HASH_CHECK: "true"
3335
ENABLE_RCON: "true"
3436
RCON_PASSWORD: "testing"
3537
RCON_PORT: 25575
@@ -84,6 +86,9 @@ services:
8486
RCON_PORT: 25575
8587
RCON_PASSWORD: testing
8688
MC_VERSION: "${MC_VERSION:-1.21.4}"
89+
volumes:
90+
# Cache Jest/ts-jest transformations between runs
91+
- jest-cache:/tmp/jest_cache
8792
networks:
8893
- banmanager
8994

@@ -95,3 +100,4 @@ volumes:
95100
fabric-data-1.20.1:
96101
fabric-data-1.21.1:
97102
fabric-data-1.21.4:
103+
jest-cache:

e2e/platforms/sponge/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ services:
2929
TYPE: "CUSTOM"
3030
CUSTOM_SERVER: "https://repo.spongepowered.org/repository/maven-releases/org/spongepowered/spongevanilla/${SPONGEVERSION:-1.20.6-11.0.0}/spongevanilla-${SPONGEVERSION:-1.20.6-11.0.0}-universal.jar"
3131
ONLINE_MODE: "false"
32+
# Skip re-downloading server JAR just to verify hash (speeds up cached runs)
33+
SKIP_SERVER_JAR_HASH_CHECK: "true"
3234
ENABLE_RCON: "true"
3335
RCON_PASSWORD: "testing"
3436
RCON_PORT: 25575
@@ -75,6 +77,9 @@ services:
7577
RCON_PORT: 25575
7678
RCON_PASSWORD: testing
7779
MC_VERSION: "${MC_VERSION:-1.20.6}"
80+
volumes:
81+
# Cache Jest/ts-jest transformations between runs
82+
- jest-cache:/tmp/jest_cache
7883
networks:
7984
- banmanager
8085

@@ -86,3 +91,4 @@ volumes:
8691
sponge-data-1.20.6:
8792
sponge-data-1.21.1:
8893
sponge-data-1.21.3:
94+
jest-cache:

e2e/tests/jest.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ module.exports = {
77
verbose: true,
88
forceExit: true,
99
detectOpenHandles: true,
10+
// Use custom cache directory if set (for Docker volume caching)
11+
cacheDirectory: process.env.JEST_CACHE_DIRECTORY || '/tmp/jest_cache',
1012
};

0 commit comments

Comments
 (0)