Skip to content

Commit

Permalink
Add docker test suite, include debian 12 to start
Browse files Browse the repository at this point in the history
  • Loading branch information
lopcode committed Nov 23, 2024
1 parent 704082f commit c32b0ab
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 4 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,24 @@ jobs:
Write-Output $env:Path
Get-ChildItem .\vips_w64\vips-dev-8.15
.\gradlew.bat sample:clean sample:shadowJar
java -jar sample/build/libs/sample-all.jar
java -jar sample/build/libs/sample-all.jar
docker-checks:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 22

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.10.1

- name: Run checks
run: ./run_docker_tests.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ hs_err*
sample_run
.kotlin
sample_output*
sample*.jar
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and [faster](https://github.com/lopcode/vips-ffm/issues/59#issuecomment-23676349

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

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

Expand Down Expand Up @@ -153,6 +153,13 @@ memory: high-water mark 151.24 MB
[main] INFO vipsffm.SampleRunner - all samples ran successfully 🎉
```

### Docker checks

These samples are also run in Docker containers, to verify behaviour on specific Linux distributions. They're useful to
look at if you're deploying `libvips` and `vips-ffm` workloads using containers.

You can find them in the [`docker_tests`](docker_tests) folder.

## Native library loading

This library requires the `libvips`, `glib`, and `gobject` native libraries to be present in your library path:
Expand Down
2 changes: 2 additions & 0 deletions docker_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/sample/*
*/sample/run_samples.sh
12 changes: 12 additions & 0 deletions docker_tests/debian-12/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM debian:12.1-slim
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"

COPY sample /opt/sample
COPY run_samples.sh /opt/run_samples.sh

RUN apt update && apt install libvips-dev -y

WORKDIR /opt
CMD ./run_samples.sh
15 changes: 15 additions & 0 deletions run_docker_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -eou pipefail

echo "building samples..."
./gradlew sample:clean sample:shadowJar

echo "running docker tests..."
WORKSPACE_DIR="$PWD"

pushd docker_tests/debian-12
cp -r "$WORKSPACE_DIR"/sample .
cp "$WORKSPACE_DIR"/run_samples.sh .
docker build -t vips-ffm-debian-test .
docker run vips-ffm-debian-test
popd
8 changes: 6 additions & 2 deletions run_samples.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env bash
set -eou pipefail

echo "building samples..."
./gradlew sample:clean sample:shadowJar
if [ -f "gradlew" ]; then
echo "building samples..."
./gradlew sample:clean sample:shadowJar
else
echo "skipping sample build as no gradle present..."
fi

export JAVA_PATH_OPTS=""
if [[ "$OSTYPE" == "darwin"* ]]; then
Expand Down

0 comments on commit c32b0ab

Please sign in to comment.