Skip to content

Commit e469d45

Browse files
sasikumar-bitgoat31416
authored andcommitted
feat: added express docker test stage in CI
TICKET: WP-6299
1 parent 443eb34 commit e469d45

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,52 @@ jobs:
288288
context: .
289289
file: ./Dockerfile
290290
push: false
291+
load: true
291292
tags: |
292293
bitgo/express:${{ github.sha }}
293294
build-args: |
294295
VERSION=${{ steps.build-info.outputs.version }}
295296
BUILD_DATE=${{ steps.build-info.outputs.date }}
296297
GIT_HASH=${{ github.sha }}
297298
299+
- name: Test Express Docker image
300+
id: docker-test
301+
run: |
302+
echo "Testing Docker image bitgo/express:${{ github.sha }}"
303+
304+
CONTAINER_ID=$(docker run -d -p 3080:3080 bitgo/express:${{ github.sha }})
305+
echo "Started container: $CONTAINER_ID"
306+
307+
# Wait for the service to be ready with timeout
308+
echo "Waiting for service to be ready..."
309+
310+
for i in {1..30}; do
311+
if curl -f -s --max-time 5 http://localhost:3080/api/v2/ping > /dev/null 2>&1; then
312+
echo "✅ API health check passed"
313+
break
314+
fi
315+
316+
if [ $i -eq 30 ]; then
317+
echo "::error::API health check failed after 30 attempts"
318+
docker logs "$CONTAINER_ID"
319+
docker stop "$CONTAINER_ID"
320+
docker rm "$CONTAINER_ID"
321+
exit 1
322+
fi
323+
324+
echo "Waiting for API... (attempt $i/30)"
325+
sleep 2
326+
done
327+
328+
# Check container logs for errors
329+
docker logs "$CONTAINER_ID"
330+
331+
# Stop the container
332+
docker stop "$CONTAINER_ID"
333+
docker rm "$CONTAINER_ID"
334+
335+
echo "✅ Docker image tests passed"
336+
298337
dockerfile-check:
299338
runs-on: ubuntu-latest
300339

0 commit comments

Comments
 (0)