@@ -122,13 +122,84 @@ jobs:
122122 cp -r dist/agent/web test-install/
123123 ./test-install/bin/perry --version
124124
125- test :
125+ docker :
126+ runs-on : ubuntu-latest
127+ steps :
128+ - uses : actions/checkout@v4
129+
130+ - name : Set up Docker Buildx
131+ uses : docker/setup-buildx-action@v3
132+ with :
133+ driver : docker
134+
135+ - name : Build base image
136+ uses : docker/build-push-action@v6
137+ with :
138+ context : ./perry
139+ file : ./perry/Dockerfile.base
140+ load : true
141+ tags : perry-base:latest
142+
143+ - name : Build full image
144+ uses : docker/build-push-action@v6
145+ with :
146+ context : ./perry
147+ load : true
148+ tags : perry:latest
149+ build-args : |
150+ BASE_IMAGE=perry-base:latest
151+
152+ - name : Save Docker image
153+ run : docker save perry:latest | gzip > perry-image.tar.gz
154+
155+ - name : Upload Docker image
156+ uses : actions/upload-artifact@v4
157+ with :
158+ name : docker-image
159+ path : perry-image.tar.gz
160+ retention-days : 1
161+ compression-level : 0
162+
163+ test-unit :
126164 runs-on : ubuntu-latest
127165 needs : build
166+ steps :
167+ - uses : actions/checkout@v4
168+
169+ - name : Download build artifacts
170+ uses : actions/download-artifact@v4
171+ with :
172+ name : dist
173+ path : dist/
174+
175+ - name : Set up Bun
176+ uses : oven-sh/setup-bun@v2
177+ with :
178+ bun-version : latest
179+
180+ - name : Cache bun dependencies
181+ uses : actions/cache@v4
182+ with :
183+ path : |
184+ ~/.bun/install/cache
185+ node_modules
186+ key : ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock', '**/package.json') }}
187+ restore-keys : |
188+ ${{ runner.os }}-bun-
189+
190+ - name : Install dependencies
191+ run : bun install
192+
193+ - name : Run unit tests
194+ run : bun run test:unit
195+
196+ test :
197+ runs-on : ubuntu-latest
198+ needs : [build, docker]
128199 strategy :
129200 fail-fast : false
130201 matrix :
131- shard : [1, 2, 3]
202+ shard : [1, 2, 3, 4, 5 ]
132203 steps :
133204 - uses : actions/checkout@v4
134205 with :
@@ -140,6 +211,14 @@ jobs:
140211 name : dist
141212 path : dist/
142213
214+ - name : Download Docker image
215+ uses : actions/download-artifact@v4
216+ with :
217+ name : docker-image
218+
219+ - name : Load Docker image
220+ run : gunzip -c perry-image.tar.gz | docker load
221+
143222 - name : Set up Bun
144223 uses : oven-sh/setup-bun@v2
145224 with :
@@ -161,44 +240,15 @@ jobs:
161240 bun install
162241 cd web && bun install
163242
164- - name : Set up Docker Buildx
165- uses : docker/setup-buildx-action@v3
166- with :
167- driver : docker
168-
169- - name : Log in to Container Registry
170- uses : docker/login-action@v3
171- with :
172- registry : ${{ env.REGISTRY }}
173- username : ${{ github.actor }}
174- password : ${{ secrets.GITHUB_TOKEN }}
175-
176- - name : Build base image
177- uses : docker/build-push-action@v6
178- with :
179- context : ./perry
180- file : ./perry/Dockerfile.base
181- load : true
182- tags : perry-base:latest
183-
184- - name : Build full image
185- uses : docker/build-push-action@v6
186- with :
187- context : ./perry
188- load : true
189- tags : perry:latest
190- build-args : |
191- BASE_IMAGE=perry-base:latest
192-
193- - name : Run tests (shard ${{ matrix.shard }}/3)
243+ - name : Run tests (shard ${{ matrix.shard }}/5)
194244 run : |
195- # Skip Docker build in test setup since we already have the image
196245 export SKIP_DOCKER_BUILD=true
197- bun run test --shard=${{ matrix.shard }}/3
246+ export SKIP_AGENT_UPDATES=true
247+ bun run test --shard=${{ matrix.shard }}/5
198248
199249 e2e :
200250 runs-on : ubuntu-latest
201- needs : build
251+ needs : [ build, docker]
202252 steps :
203253 - uses : actions/checkout@v4
204254 with :
@@ -210,6 +260,14 @@ jobs:
210260 name : dist
211261 path : dist/
212262
263+ - name : Download Docker image
264+ uses : actions/download-artifact@v4
265+ with :
266+ name : docker-image
267+
268+ - name : Load Docker image
269+ run : gunzip -c perry-image.tar.gz | docker load
270+
213271 - name : Set up Bun
214272 uses : oven-sh/setup-bun@v2
215273 with :
@@ -250,18 +308,6 @@ jobs:
250308 if : steps.playwright-cache.outputs.cache-hit == 'true'
251309 run : cd web && bun x playwright install-deps chromium
252310
253- - name : Set up Docker Buildx
254- uses : docker/setup-buildx-action@v3
255- with :
256- driver : docker
257-
258- - name : Log in to Container Registry
259- uses : docker/login-action@v3
260- with :
261- registry : ${{ env.REGISTRY }}
262- username : ${{ github.actor }}
263- password : ${{ secrets.GITHUB_TOKEN }}
264-
265311 - name : Check for Dockerfile changes
266312 id : docker-changes
267313 run : |
@@ -286,23 +332,6 @@ jobs:
286332 echo "is_fork=false" >> $GITHUB_OUTPUT
287333 fi
288334
289- - name : Build base image
290- uses : docker/build-push-action@v6
291- with :
292- context : ./perry
293- file : ./perry/Dockerfile.base
294- load : true
295- tags : perry-base:latest
296-
297- - name : Build full image
298- uses : docker/build-push-action@v6
299- with :
300- context : ./perry
301- load : true
302- tags : perry:latest
303- build-args : |
304- BASE_IMAGE=perry-base:latest
305-
306335 - name : Configure agent for e2e tests
307336 run : |
308337 mkdir -p ~/.config/perry
@@ -322,7 +351,7 @@ jobs:
322351
323352 - name : Start agent
324353 run : |
325- bun run src/index.ts agent run --port 7391 &
354+ SKIP_AGENT_UPDATES=true bun run src/index.ts agent run --port 7391 &
326355 sleep 5
327356 curl -s http://localhost:7391/health || (echo "Agent failed to start" && exit 1)
328357
0 commit comments