Skip to content

Commit ab896c8

Browse files
committed
Workflow for docker test (same as bootjar test)
1 parent 71d383f commit ab896c8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Test Dockerized App
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [ main, development ]
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
java: [17, 21]
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK ${{ matrix.java }}
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: 'temurin'
24+
java-version: ${{ matrix.java }}
25+
26+
- name: Grant execute permission for Gradle wrapper (Unix)
27+
if: runner.os != 'Windows'
28+
run: chmod +x gradlew
29+
30+
# Build Docker image instead of bootable JAR
31+
- name: Build Docker image
32+
run: |
33+
docker build -f docker/Dockerfile -t wap-server:${{ matrix.os }}-${{ matrix.java }} .
34+
35+
# Run Docker container (detached, expose port 8080)
36+
- name: Run Docker container
37+
run: |
38+
docker run -d -p 8080:8080 --name wap-server \
39+
wap-server:${{ matrix.os }}-${{ matrix.java }}
40+
sleep 100 # Give the server time to start
41+
42+
- name: hurl install
43+
uses: gacts/[email protected]
44+
with: {disable-cache: true}
45+
46+
- name: hurl CRUD tests (windows)
47+
if: runner.os == 'Windows'
48+
shell: bash
49+
run: |
50+
for file in ./integration_tests/CRUD/*.hurl; do
51+
hurl --variable host=http://localhost:8080 --test "$file" --verbose --error-format=long --continue-on-error --report-html hurlreports
52+
done
53+
54+
- name: hurl tests (other)
55+
if: runner.os != 'Windows'
56+
run: hurl --variable host=http://localhost:8080 --test ./integration_tests/CRUD/*.hurl --verbose --error-format=long --continue-on-error --report-html hurlreports
57+
58+
# Stop and clean up container
59+
- name: Stop Docker container
60+
if: always()
61+
run: |
62+
docker logs wap-server
63+
docker stop wap-server
64+
docker rm wap-server
65+
66+
# Upload artifacts (optional: you may want to upload Docker logs instead of JARs)
67+
- name: Upload Docker logs
68+
if: always()
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: docker_logs_jdk${{ matrix.java }}_${{ matrix.os }}
72+
path: ./hurlreports

0 commit comments

Comments
 (0)