diff --git a/.github/workflows/Check.yml b/.github/workflows/Check.yml new file mode 100644 index 0000000..f3b1e17 --- /dev/null +++ b/.github/workflows/Check.yml @@ -0,0 +1,43 @@ +name: Check + +on: + push: + pull_request: + branches: [ "master" ] + +jobs: + + check: + + runs-on: ubuntu-latest + + steps: + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get swayimg version + 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 .github/workflows + + - 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 -Dversion=${{steps.version.outputs.VERSION}} -Dtests=enabled --prefix=/usr /tmp/build + + - name: Compile and link + run: docker exec swayimg ninja -C /tmp/build + + - name: Install + run: docker exec swayimg env DESTDIR=/tmp/install ninja -C /tmp/build install + + - name: Run installed + run: docker exec swayimg /tmp/install/usr/bin/swayimg --version + + - name: Run unit tests + run: docker exec swayimg meson test --verbose -C /tmp/build diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile new file mode 100644 index 0000000..a93129c --- /dev/null +++ b/.github/workflows/Dockerfile @@ -0,0 +1,32 @@ +FROM archlinux:latest + +RUN pacman --sync --sysupgrade --refresh --refresh --noconfirm \ + pkgconf \ + clang \ + meson \ + wayland wayland-protocols \ + gtest \ + fontconfig \ + libxkbcommon \ + libavif \ + libexif \ + libheif \ + libjpeg-turbo \ + libjxl \ + librsvg \ + libtiff \ + libwebp \ + openexr + +RUN useradd --create-home builder + +ENV USER=builder +ENV HOME=/home/builder + +ENV CC="clang" +ENV CXX="clang++" +ENV CFLAGS="-g -fsanitize=address" +ENV CXXFLAGS="-g -fsanitize=address" +ENV LDFLAGS="-fsanitize=address" + +USER builder diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml deleted file mode 100644 index edb04ae..0000000 --- a/.github/workflows/unittests.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Unit tests -on: [push, pull_request] - -jobs: - unittests: - - runs-on: ubuntu-latest - - 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 - libopenexr-dev libgif-dev libheif-dev libavif-dev - libjpeg-dev librsvg2-dev libtiff-dev libwebp-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: - fetch-depth: 0 - - - name: Get version - run: echo "VERSION=$(git describe --tags --long --always | sed 's/^v//;s/-/./')" >> $GITHUB_OUTPUT - id: version - - - name: Build - run: | - export CC="clang" - export CXX="clang++" - export CFLAGS="-g -fsanitize=address" - export CXXFLAGS="-g -fsanitize=address" - export LDFLAGS="-fsanitize=address" - meson -Dversion=${{steps.version.outputs.VERSION}} -Dtests=enabled --prefix=/usr ./build - ninja -C ./build - - - name: Install - run: DESTDIR=install ninja -C ./build install - - - name: Check version - run: ./build/install/usr/bin/swayimg --version - - - name: Run unit tests - run: meson test --verbose -C ./build