Skip to content

Commit e44093f

Browse files
committed
Add docker test suite, include debian 12 to start
1 parent 704082f commit e44093f

File tree

8 files changed

+84
-4
lines changed

8 files changed

+84
-4
lines changed

.github/workflows/checks.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,24 @@ jobs:
8585
Write-Output $env:Path
8686
Get-ChildItem .\vips_w64\vips-dev-8.15
8787
.\gradlew.bat sample:clean sample:shadowJar
88-
java -jar sample/build/libs/sample-all.jar
88+
java -jar sample/build/libs/sample-all.jar
89+
90+
docker-checks:
91+
runs-on: ubuntu-24.04
92+
steps:
93+
- name: Checkout
94+
uses: actions/checkout@v4
95+
96+
- name: Setup Java
97+
uses: actions/setup-java@v4
98+
with:
99+
distribution: "temurin"
100+
java-version: 22
101+
102+
- name: Setup Gradle
103+
uses: gradle/actions/setup-gradle@v3
104+
with:
105+
gradle-version: 8.10.1
106+
107+
- name: Run checks
108+
run: ./run_docker_tests.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ hs_err*
1616
sample_run
1717
.kotlin
1818
sample_output*
19+
sample*.jar

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and [faster](https://github.com/lopcode/vips-ffm/issues/59#issuecomment-23676349
77

88
Supports a vast range of image formats, including HEIC, JXL, WebP, PNG, JPEG, and more. Pronounced "vips (like zips)
99
eff-eff-emm". The project is relatively new, but aims to be production ready. Tested on macOS 14, Windows 11, and Linux
10-
(Ubuntu 24.04). Should work on any architecture you can use libvips and Java on (arm64/amd64/etc).
10+
(Ubuntu 24.04, Debian 12.1). Should work on any architecture you can use libvips and Java on (arm64/amd64/etc).
1111

1212
Used the library? I'd love to hear from more users - let me know in [Discussions](https://github.com/lopcode/vips-ffm/discussions).
1313

docker_tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/sample/*

docker_tests/debian-12/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM debian:12.1-slim
2+
ENV JAVA_HOME=/opt/java/openjdk
3+
COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME
4+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
5+
6+
COPY sample /opt/sample
7+
COPY run_samples.sh /opt/run_samples.sh
8+
9+
RUN apt update && apt install libvips-dev -y
10+
11+
WORKDIR /opt
12+
CMD ./run_samples.sh
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -eou pipefail
3+
4+
if [ -f "gradlew" ]; then
5+
echo "building samples..."
6+
./gradlew sample:clean sample:shadowJar
7+
else
8+
echo "skipping sample build as no gradle present..."
9+
fi
10+
11+
export JAVA_PATH_OPTS=""
12+
if [[ "$OSTYPE" == "darwin"* ]]; then
13+
export DYLD_LIBRARY_PATH=/opt/homebrew/lib
14+
# this tests the library path override feature
15+
export JAVA_PATH_OPTS="-Dvipsffm.libpath.vips.override=/opt/homebrew/lib/libvips.dylib"
16+
fi
17+
18+
echo "running samples..."
19+
java $JAVA_PATH_OPTS -jar sample/build/libs/sample-all.jar 2>&1 | tee sample_output.log
20+
21+
echo "checking for leaks..."
22+
if grep --quiet "objects alive:" sample_output.log; then
23+
echo "failure - detected a memory leak!"
24+
exit 1
25+
fi
26+
27+
echo "no leaks detected 🎉"

run_docker_tests.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -eou pipefail
3+
4+
echo "building samples..."
5+
./gradlew sample:clean sample:shadowJar
6+
7+
echo "running docker tests..."
8+
WORKSPACE_DIR="$PWD"
9+
10+
pushd docker_tests/debian-12
11+
cp -r "$WORKSPACE_DIR"/sample .
12+
cp "$WORKSPACE_DIR"/run_samples.sh .
13+
docker build -t vips-ffm-debian-test .
14+
docker run vips-ffm-debian-test
15+
popd

run_samples.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!/usr/bin/env bash
22
set -eou pipefail
33

4-
echo "building samples..."
5-
./gradlew sample:clean sample:shadowJar
4+
if [ -f "gradlew" ]; then
5+
echo "building samples..."
6+
./gradlew sample:clean sample:shadowJar
7+
else
8+
echo "skipping sample build as no gradle present..."
9+
fi
610

711
export JAVA_PATH_OPTS=""
812
if [[ "$OSTYPE" == "darwin"* ]]; then

0 commit comments

Comments
 (0)