From 95b1267acc6aaaf0bae11e15f13cd4bcde5d6269 Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Sun, 28 Jun 2026 13:47:33 +0200 Subject: [PATCH] CI for macs --- .github/workflows/ci.yml | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b7c617..91dc2b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,3 +109,81 @@ jobs: --with-plutobook-include="$PAGE_PRINT_PLUTOBOOK_PREFIX/include" \ --with-plutobook-lib="$PAGE_PRINT_PLUTOBOOK_PREFIX/lib" bundle exec rake test + + build-plutobook-macos: + runs-on: macos-14 + + steps: + - uses: actions/checkout@v4 + + - name: Install native dependencies + run: | + brew update + brew install meson ninja pkg-config cairo freetype harfbuzz fontconfig expat icu4c + + - name: Configure Homebrew pkg-config paths + run: echo "PKG_CONFIG_PATH=$(brew --prefix icu4c)/lib/pkgconfig:$PKG_CONFIG_PATH" >> "$GITHUB_ENV" + + - name: Cache PlutoBook install + uses: actions/cache@v4 + id: plutobook-cache-macos + with: + path: tmp/plutobook-ci-install + key: plutobook-v0.17.0-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }} + restore-keys: | + plutobook-v0.17.0-${{ runner.os }}- + + - name: Build PlutoBook + if: steps.plutobook-cache-macos.outputs.cache-hit != 'true' + run: | + git clone --depth 1 --branch v0.17.0 https://github.com/plutoprint/plutobook.git tmp/plutobook-ci-src + meson setup tmp/plutobook-ci-build tmp/plutobook-ci-src \ + --prefix="$PWD/tmp/plutobook-ci-install" \ + --libdir=lib \ + --buildtype=release \ + -Dcurl=disabled \ + -Dturbojpeg=disabled \ + -Dwebp=disabled \ + -Dtools=disabled \ + -Dtests=disabled \ + -Dexamples=disabled + meson compile -C tmp/plutobook-ci-build + meson install -C tmp/plutobook-ci-build + + - uses: actions/upload-artifact@v4 + with: + name: plutobook-ci-install-macos + path: tmp/plutobook-ci-install + retention-days: 1 + + test-macos: + needs: build-plutobook-macos + runs-on: macos-14 + + env: + PAGE_PRINT_PLUTOBOOK_PREFIX: ${{ github.workspace }}/tmp/plutobook-ci-install + PKG_CONFIG_PATH: ${{ github.workspace }}/tmp/plutobook-ci-install/lib/pkgconfig + DYLD_LIBRARY_PATH: ${{ github.workspace }}/tmp/plutobook-ci-install/lib + + steps: + - uses: actions/checkout@v4 + + - name: Install test dependencies + run: brew install poppler + + - uses: actions/download-artifact@v4 + with: + name: plutobook-ci-install-macos + path: tmp/plutobook-ci-install + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Run tests + run: | + bundle exec rake compile -- \ + --with-plutobook-include="$PAGE_PRINT_PLUTOBOOK_PREFIX/include" \ + --with-plutobook-lib="$PAGE_PRINT_PLUTOBOOK_PREFIX/lib" + bundle exec rake test