Skip to content

Commit 841d5ba

Browse files
authored
Speedup conformance tests execution by moving the build step to the host machine (#180)
1 parent 8f7d835 commit 841d5ba

File tree

12 files changed

+66
-159
lines changed

12 files changed

+66
-159
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@
22
.github/
33
.idea/
44
out/
5-
target/
6-
**/target/

.github/workflows/scala.yml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,8 @@ jobs:
3131
- name: Run tests
3232
run: sbt test
3333

34-
conformance:
35-
runs-on: ubuntu-latest
36-
permissions:
37-
contents: read
38-
39-
strategy:
40-
matrix:
41-
config:
42-
- name: Netty Server
43-
profile: netty-server
44-
- name: Http4s Server
45-
profile: http4s-server
46-
- name: Http4s Server (non-stable)
47-
profile: http4s-server-nonstable
48-
- name: Http4s Client
49-
profile: http4s-client
50-
51-
steps:
52-
- name: Checkout repository
53-
uses: actions/checkout@v4
54-
55-
- name: Run conformance tests for ${{ matrix.config.name }}
56-
run: make test-conformance PROFILE=${{ matrix.config.profile }}
34+
- name: Run conformance tests
35+
run: make test-conformance-stable
5736

5837
dependency-graph:
5938
name: Update Dependency Graph

Makefile

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
1-
.PHONY: test-conformance
2-
31
# Define common variables
4-
DOCKER_BUILD_CMD = docker build -f build/conformance/Dockerfile . --progress=plain
2+
DOCKER_BUILD_CMD = docker build -f conformance-build/Dockerfile . --progress=plain --output out/
3+
4+
.PHONY: build-conformance
5+
build-conformance:
6+
sbt conformance/stage
7+
8+
.PHONY: test-conformance-http4s-server
9+
test-conformance-http4s-server: build-conformance
10+
@echo "Running conformance tests for http4s server"
11+
$(DOCKER_BUILD_CMD) --build-arg launcher=Http4sServerLauncher --build-arg config=suite-http4s.yaml --build-arg parallel_args="--parallel 1"
12+
@code=$$(cat out/exit_code | tr -d '\n'); echo "Exiting with code: $$code"; exit $$code
513

6-
test-conformance:
7-
@echo "Running conformance tests with profile: $(PROFILE)"
8-
ifeq ($(PROFILE),netty-server)
9-
$(DOCKER_BUILD_CMD) --build-arg launcher=NettyServerLauncher --build-arg config=suite-netty.yaml
10-
else ifeq ($(PROFILE),http4s-server)
11-
$(DOCKER_BUILD_CMD) --build-arg launcher=Http4sServerLauncher --build-arg config=suite-http4s.yaml
12-
else ifeq ($(PROFILE),http4s-server-nonstable)
13-
$(DOCKER_BUILD_CMD) --build-arg launcher=Http4sServerLauncher --build-arg config=suite-http4s-nonstable.yaml --build-arg stable=false
14-
else ifeq ($(PROFILE),http4s-client)
14+
.PHONY: test-conformance-http4s-server-nonstable
15+
test-conformance-http4s-server-nonstable: build-conformance
16+
@echo "Running conformance tests for http4s server (non-stable)"
17+
$(DOCKER_BUILD_CMD) --build-arg launcher=Http4sServerLauncher --build-arg config=suite-http4s-nonstable.yaml --build-arg parallel_args="--parallel 1"
18+
@code=$$(cat out/exit_code | tr -d '\n'); echo "Exiting with code: $$code"; exit $$code
19+
20+
.PHONY: test-conformance-http4s-client
21+
test-conformance-http4s-client: build-conformance
22+
@echo "Running conformance tests for http4s client"
1523
$(DOCKER_BUILD_CMD) --build-arg launcher=Http4sClientLauncher --build-arg config=suite-http4s-client.yaml --build-arg mode=client
16-
else
17-
@echo "Error: Unknown profile '$(PROFILE)'. Supported profiles: netty-server, http4s-server, http4s-server-nonstable, http4s-client."
18-
@exit 1
19-
endif
24+
@code=$$(cat out/exit_code | tr -d '\n'); echo "Exiting with code: $$code"; exit $$code
25+
26+
.PHONY: test-conformance-netty-server
27+
test-conformance-netty-server: build-conformance
28+
@echo "Running conformance tests for netty server"
29+
$(DOCKER_BUILD_CMD) --build-arg launcher=NettyServerLauncher --build-arg config=suite-netty.yaml --build-arg parallel_args="--parallel 1"
30+
@code=$$(cat out/exit_code | tr -d '\n'); echo "Exiting with code: $$code"; exit $$code
31+
32+
.PHONY: test-conformance-stable
33+
test-conformance-stable: test-conformance-http4s-server \
34+
test-conformance-http4s-client \
35+
test-conformance-netty-server

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,8 @@ How-tos that go beyond the basic usage:
259259

260260
Run the following command to run Connect-RPC conformance tests:
261261

262-
For the Netty server:
263-
264-
```shell
265-
make test-conformance PROFILE=netty-server
266-
```
267-
268-
For the Http4s server:
269-
270262
```shell
271-
make test-conformance PROFILE=http4s-server
263+
make test-conformance-stable
272264
```
273265

274266
Execution results are output to STDOUT.

build/conformance/.gitignore

Whitespace-only changes.

build/conformance/Dockerfile

Lines changed: 0 additions & 109 deletions
This file was deleted.

conformance-build/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM eclipse-temurin:24-jre AS base
2+
3+
FROM ghcr.io/igor-vovk/connect-conformance-dockerimage:1.0.4-1 AS conformance
4+
5+
FROM base AS runner
6+
7+
COPY --from=conformance /conformance /conformance
8+
ADD conformance-build/*.yaml /conformance/
9+
ADD conformance/target/universal/stage /app
10+
WORKDIR /conformance
11+
12+
RUN mkdir "/out"
13+
14+
ARG config="suite.yaml"
15+
ARG mode="server"
16+
ARG launcher
17+
ARG parallel_args=""
18+
19+
RUN LOGS_PATH="/out" \
20+
./connectconformance \
21+
--conf $config \
22+
--mode $mode \
23+
$parallel_args \
24+
-v -vv --trace \
25+
-- \
26+
/app/bin/conformance -main org.ivovk.connect_rpc_scala.conformance.$launcher -Dcats.effect.warnOnNonMainThreadDetected=false; \
27+
echo $? > /out/exit_code
28+
29+
FROM scratch AS export
30+
31+
COPY --link --from=runner /out /

0 commit comments

Comments
 (0)