From 75c8a6d47db6631e9baac28e663836c7ccd1122a Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Tue, 23 Jun 2026 15:54:43 +0200 Subject: [PATCH 1/3] Add linux ci --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9608fa7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: CI + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + ruby: + - "3.0" + - "3.1" + - "3.2" + - "3.3" + - "3.4" + - "4.0" + + steps: + - uses: actions/checkout@v4 + + - name: Install native dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + build-essential \ + git \ + pkg-config \ + ninja-build \ + pipx \ + python3-pip \ + poppler-utils \ + libcairo2-dev \ + libexpat1-dev \ + libicu-dev \ + libfreetype6-dev \ + libfontconfig1-dev \ + libharfbuzz-dev + pipx install meson==1.3.2 + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: Build PlutoBook + 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: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Run tests + env: + PKG_CONFIG_PATH: ${{ github.workspace }}/tmp/plutobook-ci-install/lib/pkgconfig + LD_LIBRARY_PATH: ${{ github.workspace }}/tmp/plutobook-ci-install/lib + run: bundle exec rake From ed2c8af217f1f6725db8df9b091ca8b55dc2e2c9 Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Tue, 23 Jun 2026 16:42:37 +0200 Subject: [PATCH 2/3] force fallback harfbuzz --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9608fa7..0de2ea8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: CI on: push: + branches: + - main pull_request: jobs: @@ -49,6 +51,7 @@ jobs: --prefix="$PWD/tmp/plutobook-ci-install" \ --libdir=lib \ --buildtype=release \ + --force-fallback-for=harfbuzz \ -Dcurl=disabled \ -Dturbojpeg=disabled \ -Dwebp=disabled \ From 12a3e194e86c9d83d31c6aa34a9d5be5f26eb422 Mon Sep 17 00:00:00 2001 From: Dino Maric Date: Tue, 23 Jun 2026 17:11:34 +0200 Subject: [PATCH 3/3] Change min supported ruby version to 3.2 --- .github/workflows/ci.yml | 2 -- .github/workflows/package.yml | 6 +++--- README.md | 2 +- page_print.gemspec | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0de2ea8..4b2c3d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,6 @@ jobs: fail-fast: false matrix: ruby: - - "3.0" - - "3.1" - "3.2" - "3.3" - "3.4" diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 425ae0b..c48e6c2 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -34,7 +34,7 @@ jobs: - name: Build native Linux gem run: | - docker run --rm -v "$PWD:/work" -w /work ruby:3.0-bullseye bash -lc ' + docker run --rm -v "$PWD:/work" -w /work ruby:3.2-bullseye bash -lc ' apt-get update && apt-get install -y --no-install-recommends \ build-essential \ ca-certificates \ @@ -59,11 +59,11 @@ jobs: - name: Verify Linux gem compiles extension on install run: | - docker run --rm -v "$PWD/pkg:/pkg" ruby:3.0-slim ruby -rrubygems/package -e 'gem_path = Dir["/pkg/page_print-*-x86_64-linux.gem"].fetch(0); spec = Gem::Package.new(gem_path).spec; abort "Linux gem must not include precompiled Ruby extension" if spec.files.any? { |file| file == "lib/page_print/page_print.so" }' + docker run --rm -v "$PWD/pkg:/pkg" ruby:3.2-slim ruby -rrubygems/package -e 'gem_path = Dir["/pkg/page_print-*-x86_64-linux.gem"].fetch(0); spec = Gem::Package.new(gem_path).spec; abort "Linux gem must not include precompiled Ruby extension" if spec.files.any? { |file| file == "lib/page_print/page_print.so" }' - name: Smoke test native Linux gem in clean Ruby image run: | - docker run --rm -v "$PWD/pkg:/pkg" ruby:3.0-slim bash -lc 'apt-get update && apt-get install -y --no-install-recommends build-essential && gem install /pkg/page_print-*-x86_64-linux.gem || { find /usr/local/bundle/extensions -name mkmf.log -print -exec cat {} \;; exit 1; }; ruby -e "require \"page_print\"; pdf = PagePrint.html_to_pdf_string(\"

Hello

\"); abort \"bad pdf\" unless pdf.start_with?(\"%PDF\"); puts \"ok\""' + docker run --rm -v "$PWD/pkg:/pkg" ruby:3.2-slim bash -lc 'apt-get update && apt-get install -y --no-install-recommends build-essential && gem install /pkg/page_print-*-x86_64-linux.gem || { find /usr/local/bundle/extensions -name mkmf.log -print -exec cat {} \;; exit 1; }; ruby -e "require \"page_print\"; pdf = PagePrint.html_to_pdf_string(\"

Hello

\"); abort \"bad pdf\" unless pdf.start_with?(\"%PDF\"); puts \"ok\""' docker run --rm -v "$PWD/pkg:/pkg" ruby:3.4.7-slim bash -lc 'apt-get update && apt-get install -y --no-install-recommends build-essential && gem install /pkg/page_print-*-x86_64-linux.gem || { find /usr/local/bundle/extensions -name mkmf.log -print -exec cat {} \;; exit 1; }; ruby -e "require \"page_print\"; pdf = PagePrint.html_to_pdf_string(\"

Hello

\"); abort \"bad pdf\" unless pdf.start_with?(\"%PDF\"); puts \"ok\""' - uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index 6c55df4..b77374f 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ For options and CSV output, see `benchmark/README.md`. ## Requirements -- Ruby 3.0+ +- Ruby 3.2+ - Native gems are published for `x86_64-linux` and `arm64-darwin`. - Native gems vendor PlutoBook but compile the small Ruby extension during install so it links against your local Ruby. - Source builds on unsupported platforms require PlutoBook development headers and library files. diff --git a/page_print.gemspec b/page_print.gemspec index c59acac..afd2030 100644 --- a/page_print.gemspec +++ b/page_print.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.description = 'A Ruby gem with a native extension that renders HTML strings to PDF files via the plutobook C library.' spec.homepage = 'https://github.com/WizardComputer/page_print' spec.license = 'MIT' - spec.required_ruby_version = '>= 3.0' + spec.required_ruby_version = '>= 3.2' precompiled = ENV['PAGE_PRINT_PRECOMPILED'] == '1' vendor_only = ENV['PAGE_PRINT_VENDOR_ONLY'] == '1'