diff --git a/.github/workflows/Dockerfile.Ubuntu b/.github/workflows/Dockerfile.Ubuntu new file mode 100644 index 0000000..8fd595b --- /dev/null +++ b/.github/workflows/Dockerfile.Ubuntu @@ -0,0 +1,35 @@ +FROM ubuntu:24.10 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && apt upgrade --yes && apt install --no-install-recommends --yes \ + build-essential \ + cmake \ + libavif-dev \ + libexif-dev \ + libfontconfig-dev \ + libfreetype-dev \ + libgif-dev \ + libgtest-dev \ + libheif-dev \ + libjpeg-dev \ + libjson-c-dev \ + libjxl-dev \ + libopenexr-dev \ + libopenexr-dev \ + librsvg2-dev \ + libtiff-dev \ + libwayland-dev \ + libwebp-dev \ + libxkbcommon-dev \ + meson \ + pkg-config \ + wayland-protocols + +# install gtest +RUN mkdir /tmp/gtest && \ + cd /tmp/gtest && \ + cmake /usr/src/gtest && \ + make -j8 && \ + cp /tmp/gtest/lib/* /usr/lib/ + +USER ubuntu diff --git a/.github/workflows/Ubuntu.yml b/.github/workflows/Ubuntu.yml index 5e76451..8f530c6 100644 --- a/.github/workflows/Ubuntu.yml +++ b/.github/workflows/Ubuntu.yml @@ -10,26 +10,6 @@ jobs: steps: - - name: Update package info - run: sudo apt update - - - name: Install dependencies - run: > - sudo apt install --no-install-recommends --yes - build-essential meson pkg-config wayland-protocols - libwayland-dev libjson-c-dev libxkbcommon-dev - libfreetype-dev libfontconfig-dev libexif-dev - libopenexr-dev libgif-dev libheif-dev libavif-dev - libjpeg-dev librsvg2-dev libtiff-dev libwebp-dev - libopenexr-dev libjxl-dev - libgtest-dev cmake - - - name: Install gtest - run: | - mkdir /tmp/gtest - cd /tmp/gtest && cmake /usr/src/gtest && make -j$(nproc) - sudo cp /tmp/gtest/lib/* /usr/lib/ - - name: Check out source code uses: actions/checkout@v4 with: @@ -39,8 +19,15 @@ jobs: run: echo "VERSION=$(git describe --tags --long --always | sed 's/^v//;s/-/./')" >> $GITHUB_OUTPUT id: version + - name: Build docker image + run: docker build --tag=swayimg --file=.github/workflows/Dockerfile.Ubuntu . + + - name: Run docker container + run: docker run --tty --detach --name=swayimg --volume=$PWD:$PWD:ro --workdir=$PWD swayimg + - name: Configure run: > + docker exec swayimg meson setup -D version=${{steps.version.outputs.VERSION}} -D tests=enabled @@ -50,13 +37,22 @@ jobs: ${{ env.BUILD_PATH }} - name: Compile and link - run: meson compile -C ${{ env.BUILD_PATH }} + run: > + docker exec swayimg + meson compile -C ${{ env.BUILD_PATH }} - name: Install - run: env DESTDIR=${{ env.INSTALL_PATH }} meson install -C ${{ env.BUILD_PATH }} + run: > + docker exec swayimg + env DESTDIR=${{ env.INSTALL_PATH }} + meson install -C ${{ env.BUILD_PATH }} - name: Run installed - run: ${{ env.INSTALL_PATH }}/usr/bin/swayimg --version + run: > + docker exec swayimg + ${{ env.INSTALL_PATH }}/usr/bin/swayimg --version - name: Run unit tests - run: meson test --verbose -C ${{ env.BUILD_PATH }} + run: > + docker exec swayimg + meson test --verbose -C ${{ env.BUILD_PATH }}