diff --git a/.docker/Dockerfile-archlinux b/.docker/Dockerfile-archlinux index 0b30ab71..386c50eb 100644 --- a/.docker/Dockerfile-archlinux +++ b/.docker/Dockerfile-archlinux @@ -2,6 +2,6 @@ FROM archlinux ENV DEBIAN_FRONTEND noninteractive -RUN pacman -Sy --noconfirm ruby fontconfig freetype2 libjpeg libpng libxext libxrender +RUN pacman -Sy --noconfirm ruby fontconfig freetype2 libjpeg libpng libxext libxrender openssl-1.1 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_10_arm b/.docker/Dockerfile-debian_10_arm new file mode 100644 index 00000000..0666c57b --- /dev/null +++ b/.docker/Dockerfile-debian_10_arm @@ -0,0 +1,8 @@ +FROM --platform=arm64 debian:10 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_11 b/.docker/Dockerfile-debian_11 new file mode 100644 index 00000000..9ad7544c --- /dev/null +++ b/.docker/Dockerfile-debian_11 @@ -0,0 +1,8 @@ +FROM debian:11 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_11_arm b/.docker/Dockerfile-debian_11_arm new file mode 100644 index 00000000..0e23b901 --- /dev/null +++ b/.docker/Dockerfile-debian_11_arm @@ -0,0 +1,8 @@ +FROM --platform=arm64 debian:11 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_12 b/.docker/Dockerfile-debian_12 new file mode 100644 index 00000000..08a734fd --- /dev/null +++ b/.docker/Dockerfile-debian_12 @@ -0,0 +1,8 @@ +FROM debian:12 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_12_arm b/.docker/Dockerfile-debian_12_arm new file mode 100644 index 00000000..ee3aa5da --- /dev/null +++ b/.docker/Dockerfile-debian_12_arm @@ -0,0 +1,8 @@ +FROM --platform=arm64 debian:12 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_9 b/.docker/Dockerfile-debian_9 index cc66dfaf..b7acc99b 100644 --- a/.docker/Dockerfile-debian_9 +++ b/.docker/Dockerfile-debian_9 @@ -2,7 +2,12 @@ FROM debian:9 ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update +RUN echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list + +RUN apt-get -o Acquire::Check-Valid-Until=false update && \ + apt-get -o Acquire::AllowInsecureRepositories=true update + RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-debian_9_arm b/.docker/Dockerfile-debian_9_arm new file mode 100644 index 00000000..710ed424 --- /dev/null +++ b/.docker/Dockerfile-debian_9_arm @@ -0,0 +1,13 @@ +FROM --platform=arm64 debian:9 + +ENV DEBIAN_FRONTEND noninteractive + +RUN echo "deb http://archive.debian.org/debian stretch main contrib non-free" > /etc/apt/sources.list && \ + echo "deb http://archive.debian.org/debian-security stretch/updates main contrib non-free" >> /etc/apt/sources.list + +RUN apt-get -o Acquire::Check-Valid-Until=false update && \ + apt-get -o Acquire::AllowInsecureRepositories=true update + +RUN apt-get install -y ruby libjpeg62-turbo libpng16-16 libxrender1 libfontconfig1 libxext6 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-oraclelinux_8 b/.docker/Dockerfile-oraclelinux_8 new file mode 100644 index 00000000..6e976ed9 --- /dev/null +++ b/.docker/Dockerfile-oraclelinux_8 @@ -0,0 +1,5 @@ +FROM oraclelinux:8 + +RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-ubuntu_22.04 b/.docker/Dockerfile-ubuntu_22.04 new file mode 100644 index 00000000..9bf1cde3 --- /dev/null +++ b/.docker/Dockerfile-ubuntu_22.04 @@ -0,0 +1,8 @@ +FROM ubuntu:22.04 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update +RUN apt-get install -y ruby libjpeg8 libxrender1 libfontconfig1 + +CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57dbc855..cacb5775 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,14 +3,13 @@ name: CI on: [push, pull_request] jobs: - tests: - runs-on: ${{ matrix.os }} + tests-on-x86-mac: + runs-on: macos-13 strategy: matrix: - os: [ubuntu-latest, macos-latest] - ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1'] + ruby-version: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }} uses: ruby/setup-ruby@v1 @@ -22,3 +21,48 @@ jobs: - name: Run tests with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }} run: bundle exec rake + tests-on-x86-docker: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.2'] + steps: + - uses: actions/checkout@v4 + + - name: Install Ruby ${{ matrix.ruby-version }} on ubuntu + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + + - name: Install dependencies + run: bundle install + + - name: Run tests on docker(x86) + run: bundle exec rake + tests-on-arm: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.2'] + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - uses: actions/checkout@v4 + - name: Install Ruby ${{ matrix.ruby-version }} on ubuntu + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - name: Run tests on docker(arm64) + env: + ARM: 1 + COMPOSE_FILE: docker-compose-arm.yml + run: | + set -xeu + sudo apt update + sudo apt-get install -y docker-compose + bundle install + bundle exec rake + + diff --git a/.gitignore b/.gitignore index b1dba3db..b0e72329 100644 --- a/.gitignore +++ b/.gitignore @@ -6,10 +6,18 @@ bin/wkhtmltopdf_centos_7_amd64 bin/wkhtmltopdf_centos_8_amd64 bin/wkhtmltopdf_debian_9_amd64 bin/wkhtmltopdf_debian_10_amd64 +bin/wkhtmltopdf_debian_11_amd64 +bin/wkhtmltopdf_debian_12_amd64 +bin/wkhtmltopdf_debian_9_arm64 +bin/wkhtmltopdf_debian_10_arm64 +bin/wkhtmltopdf_debian_11_arm64 +bin/wkhtmltopdf_debian_12_arm64 bin/wkhtmltopdf_macos_cocoa bin/wkhtmltopdf_ubuntu_16.04_amd64 bin/wkhtmltopdf_ubuntu_18.04_amd64 bin/wkhtmltopdf_ubuntu_20.04_amd64 +bin/wkhtmltopdf_ubuntu_20.04_arm64 +bin/wkhtmltopdf_ubuntu_22.04_amd64 bin/wkhtmltopdf_centos_6_i386 bin/wkhtmltopdf_centos_7_i386 bin/wkhtmltopdf_debian_9_i386 diff --git a/CHANGELOG.md b/CHANGELOG.md index 39595537..238427cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ - Setup of Github action automation for Linux/MacOS builds +# 0.12.6.6 + +Add support for Ubuntu 22.04 + # 0.12.6.5 Fix ability to use on Debian 9 systems diff --git a/README.md b/README.md index 38c63243..042f6cd7 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,12 @@ macOS Binaries should be compressed with `gzip --best` after extracting. The matching binary will be extracted on first execution of `bin/wkhtmltopdf`. +Hints for compressing binaries + +Debian/Ubuntu + user/local/bin refers to the extracted binaries directory + gzip --best -c usr/local/bin/wkhtmltopdf > wkhtmltopdf_ubuntu_22.04.amd64.gz + ## Testing To execute gem tests locally, install in your OS: diff --git a/bin/wkhtmltopdf b/bin/wkhtmltopdf index 1b89a9cb..66ed8040 100755 --- a/bin/wkhtmltopdf +++ b/bin/wkhtmltopdf @@ -10,23 +10,40 @@ require 'rbconfig' require 'zlib' +def architecture + case RbConfig::CONFIG['host_cpu'] + when *%w[arm64 aarch64 arch64] + 'arm64' + when 'x86_64' + 'amd64' + else + 'i386' + end +end + suffix = case RbConfig::CONFIG['host_os'] when /linux/ os = `. /etc/os-release 2> /dev/null && echo ${ID}_${VERSION_ID}`.strip os = 'ubuntu_16.04' if os.start_with?('ubuntu_16.') || - os.start_with?('ubuntu_17.') + os.start_with?('ubuntu_17.') || + os.start_with?('linuxmint_18.') os = 'ubuntu_18.04' if os.start_with?('ubuntu_18.') || os.start_with?('ubuntu_19.') || os.start_with?('elementary') || - os.start_with?('linuxmint') || + os.start_with?('linuxmint_19.') || os.start_with?('pop') || os.start_with?('zorin') - os = 'ubuntu_20.04' if os.start_with?('ubuntu_20.') + os = 'ubuntu_20.04' if os.start_with?('ubuntu_20.') || + os.start_with?('linuxmint_20.') - os = 'ubuntu_21.10' if os.start_with?('ubuntu_21.') + os = 'ubuntu_21.10' if os.start_with?('ubuntu_21.') || + os.start_with?('linuxmint_21.') + + os = 'ubuntu_22.04' if os.start_with?('ubuntu_22.') || + os.start_with?('tuxedo_22.') os = 'centos_6' if (os.start_with?('amzn_') && os != 'amzn_2') || (os.empty? && File.read('/etc/centos-release').start_with?('CentOS release 6')) @@ -34,19 +51,23 @@ suffix = case RbConfig::CONFIG['host_os'] os = 'centos_7' if (os.start_with?('amzn_2') && !os.start_with?('amzn_20')) || os.start_with?('rhel_7.') - os = 'centos_8' if os.start_with?('rocky_8') || os.start_with?('rhel_8.') + os = 'centos_8' if os.start_with?('rocky_8') || + os.start_with?('rhel_8.') || + os.start_with?('ol_8.') os_based_on_debian_9 = os.start_with?('debian_9') || os.start_with?('deepin') os = 'debian_9' if os_based_on_debian_9 - os = 'debian_10' if !os_based_on_debian_9 && os.start_with?('debian') + os = 'debian_10' if !os_based_on_debian_9 && os.start_with?('debian_10') + + os = 'debian_11' if !os_based_on_debian_9 && os.start_with?('debian_11') + + os = 'debian_12' if !os_based_on_debian_9 && os.start_with?('debian_12') os = 'archlinux' if os.start_with?('arch_') || os.start_with?('manjaro_') - architecture = RbConfig::CONFIG['host_cpu'] == 'x86_64' ? 'amd64' : 'i386' - "#{os}_#{architecture}" when /darwin/ 'macos_cocoa' @@ -65,8 +86,8 @@ if File.exist?("#{binary}.gz") && !File.exist?(binary) end unless File.exist? binary - raise 'Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/21.10, ' \ - 'CentOS 6/7/8, Debian 9/10, Archlinux amd64, or Intel-based Cocoa macOS ' \ + raise 'Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, ' \ + 'CentOS 6/7/8, Debian 9/10/11/12, Archlinux amd64, Debian 9/10/11/12 arm64, or Intel-based Cocoa macOS ' \ "(missing binary: #{binary})." end diff --git a/bin/wkhtmltopdf_debian_10_arm64.gz b/bin/wkhtmltopdf_debian_10_arm64.gz new file mode 100755 index 00000000..35398a3b Binary files /dev/null and b/bin/wkhtmltopdf_debian_10_arm64.gz differ diff --git a/bin/wkhtmltopdf_debian_11_amd64.gz b/bin/wkhtmltopdf_debian_11_amd64.gz new file mode 100644 index 00000000..35da9cd2 Binary files /dev/null and b/bin/wkhtmltopdf_debian_11_amd64.gz differ diff --git a/bin/wkhtmltopdf_debian_11_arm64.gz b/bin/wkhtmltopdf_debian_11_arm64.gz new file mode 100644 index 00000000..0ca3b644 Binary files /dev/null and b/bin/wkhtmltopdf_debian_11_arm64.gz differ diff --git a/bin/wkhtmltopdf_debian_11_i386.gz b/bin/wkhtmltopdf_debian_11_i386.gz new file mode 100644 index 00000000..ad70311a Binary files /dev/null and b/bin/wkhtmltopdf_debian_11_i386.gz differ diff --git a/bin/wkhtmltopdf_debian_12_amd64.gz b/bin/wkhtmltopdf_debian_12_amd64.gz new file mode 100755 index 00000000..c6c415ea Binary files /dev/null and b/bin/wkhtmltopdf_debian_12_amd64.gz differ diff --git a/bin/wkhtmltopdf_debian_12_arm64.gz b/bin/wkhtmltopdf_debian_12_arm64.gz new file mode 100755 index 00000000..e46c0089 Binary files /dev/null and b/bin/wkhtmltopdf_debian_12_arm64.gz differ diff --git a/bin/wkhtmltopdf_debian_12_i386.gz b/bin/wkhtmltopdf_debian_12_i386.gz new file mode 100755 index 00000000..4f706148 Binary files /dev/null and b/bin/wkhtmltopdf_debian_12_i386.gz differ diff --git a/bin/wkhtmltopdf_debian_9_arm64.gz b/bin/wkhtmltopdf_debian_9_arm64.gz new file mode 100755 index 00000000..8dd9d69c Binary files /dev/null and b/bin/wkhtmltopdf_debian_9_arm64.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_20.04_arm64.gz b/bin/wkhtmltopdf_ubuntu_20.04_arm64.gz new file mode 100644 index 00000000..87352ca4 Binary files /dev/null and b/bin/wkhtmltopdf_ubuntu_20.04_arm64.gz differ diff --git a/bin/wkhtmltopdf_ubuntu_22.04_amd64.gz b/bin/wkhtmltopdf_ubuntu_22.04_amd64.gz new file mode 100644 index 00000000..a1b0037b Binary files /dev/null and b/bin/wkhtmltopdf_ubuntu_22.04_amd64.gz differ diff --git a/docker-compose-arm.yml b/docker-compose-arm.yml new file mode 100644 index 00000000..2f854b4a --- /dev/null +++ b/docker-compose-arm.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + debian_9: + build: + context: . + dockerfile: .docker/Dockerfile-debian_9_arm + volumes: + - .:/root/wkhtmltopdf_binary_gem + + debian_10: + build: + context: . + dockerfile: .docker/Dockerfile-debian_10_arm + volumes: + - .:/root/wkhtmltopdf_binary_gem + + debian_11: + build: + context: . + dockerfile: .docker/Dockerfile-debian_11_arm + volumes: + - .:/root/wkhtmltopdf_binary_gem + + debian_12: + build: + context: . + dockerfile: .docker/Dockerfile-debian_12_arm + volumes: + - .:/root/wkhtmltopdf_binary_gem diff --git a/docker-compose.yml b/docker-compose.yml index 616d5bb8..47e99ee5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,13 @@ services: volumes: - .:/root/wkhtmltopdf_binary_gem + ubuntu_22.04: + build: + context: . + dockerfile: .docker/Dockerfile-ubuntu_22.04 + volumes: + - .:/root/wkhtmltopdf_binary_gem + debian_9: build: context: . @@ -37,6 +44,20 @@ services: volumes: - .:/root/wkhtmltopdf_binary_gem + debian_11: + build: + context: . + dockerfile: .docker/Dockerfile-debian_11 + volumes: + - .:/root/wkhtmltopdf_binary_gem + + debian_12: + build: + context: . + dockerfile: .docker/Dockerfile-debian_12 + volumes: + - .:/root/wkhtmltopdf_binary_gem + centos_6: build: context: . @@ -57,6 +78,14 @@ services: dockerfile: .docker/Dockerfile-centos_8 volumes: - .:/root/wkhtmltopdf_binary_gem + + oraclelinux_8: + build: + context: . + dockerfile: .docker/Dockerfile-oraclelinux_8 + volumes: + - .:/root/wkhtmltopdf_binary_gem + rockylinux_8: build: context: . diff --git a/test/test_with_docker.rb b/test/test_with_docker.rb index 18c0cc04..c9745026 100644 --- a/test/test_with_docker.rb +++ b/test/test_with_docker.rb @@ -4,58 +4,82 @@ def macos? ENV['RUNNER_OS'] && ENV['RUNNER_OS'] == 'macOS' end +def arm? + ENV['ARM'] +end + class WithDockerTest < Minitest::Test SETUP = begin - `docker-compose build --no-cache` unless macos? - end + `docker-compose build --no-cache` if !macos? + end def test_centos_6 - test with: 'centos_6' + test_on_x86 with: 'centos_6' end def test_centos_7 - test with: 'centos_7' + test_on_x86 with: 'centos_7' end def test_centos_8 - test with: 'centos_8' + test_on_x86 with: 'centos_8' end def test_debian_9 - test with: 'debian_9' + test_on_x86_and_arm with: 'debian_9' end def test_debian_10 - test with: 'debian_10' + test_on_x86_and_arm with: 'debian_10' + end + + def test_debian_11 + test_on_x86_and_arm with: 'debian_11' + end + + def test_debian_12 + test_on_x86_and_arm with: 'debian_12' end def test_with_ubuntu_16 - test with: 'ubuntu_16.04' + test_on_x86 with: 'ubuntu_16.04' end def test_with_ubuntu_18 - test with: 'ubuntu_18.04' + test_on_x86 with: 'ubuntu_18.04' end def test_with_ubuntu_20 - test with: 'ubuntu_20.04' + test_on_x86 with: 'ubuntu_20.04' + end + + def test_with_ubuntu_22 + test_on_x86 with: 'ubuntu_22.04' end def test_with_archlinux - test with: 'archlinux' + test_on_x86 with: 'archlinux' end - + def test_rockylinux_8 - test with: 'rockylinux_8' + test_on_x86 with: 'rockylinux_8' end - + def test_with_macos - assert_equal(`bin/wkhtmltopdf --version`.strip, 'wkhtmltopdf 0.12.6 (with patched qt)') if macos? + assert_equal('wkhtmltopdf 0.12.6 (with patched qt)', `bin/wkhtmltopdf --version`.strip) if macos? end private - def test(with:) - assert_equal(`docker-compose run --rm #{with}`.strip, 'wkhtmltopdf 0.12.6 (with patched qt)') unless macos? + def test_on_x86(with:) + test_on_docker(with: with) if !macos? && !arm? + end + + def test_on_x86_and_arm(with:) + test_on_docker(with: with) unless macos? + end + + def test_on_docker(with:) + assert_match(/wkhtmltopdf 0\.12\.6(.1)? \(with patched qt\)/, `docker-compose run --rm #{with}`.strip) end end diff --git a/wkhtmltopdf-binary.gemspec b/wkhtmltopdf-binary.gemspec index 74f7f637..ba25552f 100644 --- a/wkhtmltopdf-binary.gemspec +++ b/wkhtmltopdf-binary.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = "wkhtmltopdf-binary" - s.version = "0.12.6.5" + s.version = "0.12.6.6" s.license = "Apache-2.0" s.author = "Zakir Durumeric" s.email = "zakird@gmail.com"