From 82f2bceeb37062f37b17a3512de908e72a5cb2b5 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Tue, 12 Nov 2024 11:29:16 +0100 Subject: [PATCH] Add github action testing the latest debian package by running unit tests against it --- .github/workflows/run-release-tests.yaml | 25 ++++++++++++++++++++++++ Dockerfile | 21 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/run-release-tests.yaml diff --git a/.github/workflows/run-release-tests.yaml b/.github/workflows/run-release-tests.yaml new file mode 100644 index 0000000..c605e88 --- /dev/null +++ b/.github/workflows/run-release-tests.yaml @@ -0,0 +1,25 @@ +name: Run release tests + +on: + push: # remove that after testing this action + release: + types: + - released + +jobs: + build-and-run-release-tests: + runs-on: ubuntu-latest + + steps: + - name: Build release test Docker image + uses: docker/build-push-action@v6 + with: + push: false + tags: | + ghcr.io/kit-mrt/util_caching_release_tests + target: release_test + + - name: Run unit tests with/against released version + run: | + docker run --rm ghcr.io/kit-mrt/util_caching_release_tests + diff --git a/Dockerfile b/Dockerfile index 5fb095b..cde2090 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,6 +46,27 @@ RUN cmake .. && \ +FROM base AS release_test + +# This downloads the latest util_caching debian release and adds it to the docker image +# This "bloats" the image. But otherwise, we'd have to installing wget and ca-certificates +# temporarily to download and install the package in one docker layer… +ADD https://github.com/KIT-MRT/util_caching/releases/latest/download/libutil-caching-dev.deb /tmp/debfiles/ + +# Install util_caching from release debian package +RUN dpkg -i /tmp/debfiles/*.deb && \ + rm -rf /tmp/debfiles + +COPY test /tmp/util_caching_test +WORKDIR /tmp/util_caching_test/build + +RUN cmake -DBUILD_TESTS=true .. && \ + cmake --build . -j9 + +CMD ["cmake", "--build", ".", "--target", "test"] + + + FROM base AS install # Install util_caching