diff --git a/.docker/Dockerfile-almalinux_8 b/.docker/Dockerfile-almalinux_8 new file mode 100644 index 00000000..39ff7225 --- /dev/null +++ b/.docker/Dockerfile-almalinux_8 @@ -0,0 +1,5 @@ +FROM almalinux/almalinux: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-archlinux b/.docker/Dockerfile-archlinux index aef7b3f5..386c50eb 100644 --- a/.docker/Dockerfile-archlinux +++ b/.docker/Dockerfile-archlinux @@ -1,8 +1,7 @@ -FROM archlinux:latest +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-centos_6 b/.docker/Dockerfile-centos_6 index b15c5d5a..689f4525 100644 --- a/.docker/Dockerfile-centos_6 +++ b/.docker/Dockerfile-centos_6 @@ -1,5 +1,9 @@ FROM centos:6 -RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext +RUN rm -f /etc/yum.repos.d/CentOS-Base.repo && \ + sed -i "s/enabled=0/enabled=1/g" /etc/yum.repos.d/CentOS-Vault.repo && \ + yum clean all && \ + yum update -y && \ + yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext CMD /root/wkhtmltopdf_binary_gem/bin/wkhtmltopdf --version diff --git a/.docker/Dockerfile-centos_8 b/.docker/Dockerfile-centos_8 index cdf38156..3b3fb7b5 100644 --- a/.docker/Dockerfile-centos_8 +++ b/.docker/Dockerfile-centos_8 @@ -1,5 +1,20 @@ FROM centos:8 +# https://centos.org/centos-stream/#centos-stream-8 +# Replace mirror +RUN find /etc/yum.repos.d -type f -exec sed -i 's/mirrorlist=http:\/\/mirrorlist.centos.org/\#mirrorlist=http:\/\/mirrorlist.centos.org/g' {} \; +RUN find /etc/yum.repos.d -type f -exec sed -i 's/\#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g' {} \; +RUN dnf update -y + +# Swap versions +RUN dnf swap centos-linux-repos centos-stream-repos -y +RUN dnf update -y +RUN dnf install centos-release-stream -y +RUN dnf swap centos-{linux,stream}-repos -y + +# Sync +RUN dnf distro-sync -y + RUN yum install -y ruby libjpeg-turbo libpng libXrender fontconfig libXext 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_13 b/.docker/Dockerfile-debian_13 new file mode 100644 index 00000000..822dead4 --- /dev/null +++ b/.docker/Dockerfile-debian_13 @@ -0,0 +1,8 @@ +FROM debian:13 + +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-rockylinux_8 b/.docker/Dockerfile-rockylinux_8 new file mode 100644 index 00000000..e636fa47 --- /dev/null +++ b/.docker/Dockerfile-rockylinux_8 @@ -0,0 +1,5 @@ +FROM rockylinux/rockylinux: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-deepin b/.docker/Dockerfile-ubuntu_24.04 similarity index 85% rename from .docker/Dockerfile-deepin rename to .docker/Dockerfile-ubuntu_24.04 index 5b59ddc2..49fa3fc3 100644 --- a/.docker/Dockerfile-deepin +++ b/.docker/Dockerfile-ubuntu_24.04 @@ -1,4 +1,4 @@ -FROM deepin/deepin-core:latest +FROM ubuntu:24.04 ENV DEBIAN_FRONTEND noninteractive diff --git a/.gitignore b/.gitignore index 9659ba2c..71adec04 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,24 @@ .DS_Store pkg/* +Gemfile.lock +bin/wkhtmltopdf_archlinux_amd64 bin/wkhtmltopdf_centos_6_amd64 +bin/wkhtmltopdf_centos_6_i386 bin/wkhtmltopdf_centos_7_amd64 +bin/wkhtmltopdf_centos_7_i386 bin/wkhtmltopdf_centos_8_amd64 bin/wkhtmltopdf_debian_9_amd64 +bin/wkhtmltopdf_debian_9_arm64 +bin/wkhtmltopdf_debian_9_i386 bin/wkhtmltopdf_debian_10_amd64 +bin/wkhtmltopdf_debian_10_arm64 +bin/wkhtmltopdf_debian_10_i386 +bin/wkhtmltopdf_debian_11_amd64 +bin/wkhtmltopdf_debian_11_arm64 +bin/wkhtmltopdf_debian_11_i386 +bin/wkhtmltopdf_debian_12_amd64 +bin/wkhtmltopdf_debian_12_arm64 +bin/wkhtmltopdf_debian_12_i386 bin/wkhtmltopdf_macos_cocoa bin/wkhtmltopdf_ubuntu_16.04_amd64 bin/wkhtmltopdf_ubuntu_18.04_amd64 @@ -15,5 +29,10 @@ bin/wkhtmltopdf_centos_7_i386 bin/wkhtmltopdf_debian_9_i386 bin/wkhtmltopdf_debian_10_i386 bin/wkhtmltopdf_ubuntu_16.04_i386 +bin/wkhtmltopdf_ubuntu_18.04_amd64 bin/wkhtmltopdf_ubuntu_18.04_i386 -bin/wkhtmltopdf_archlinux_amd64 +bin/wkhtmltopdf_ubuntu_20.04_amd64 +bin/wkhtmltopdf_ubuntu_20.04_arm64 +bin/wkhtmltopdf_ubuntu_21.10_amd64 +bin/wkhtmltopdf_ubuntu_22.04_amd64 +bin/wkhtmltopdf_ubuntu_22.04_arm64 diff --git a/CHANGELOG b/CHANGELOG.md similarity index 74% rename from CHANGELOG rename to CHANGELOG.md index d3464438..348a4cab 100644 --- a/CHANGELOG +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +# 0.12.6.10 (published to https://rubygems.pkg.github.com/mycase) + +- Add support for Debian 13 (with Debian 12 binaries) + +# 0.12.6.9 + +- Add support to ubuntu 22.04 and 24.04 in arm64 +- Add support for KDE Neon 22.04 & 24.04 (Ubuntu derivative) + +# 0.12.6.8 + +- Add support for Ubuntu 24.04 using the Ubuntu 22.04 binary +- Add support for Linux Mint 22 using the Ubuntu 22.04 binary +- Add support for Alibaba Cloud Linux using the CentOS 8 binary +- Add support for AlmaLinux using the CentOS 8 binary +- Fix Amazon Linux 2023 support using the CentOS binaries + +# 0.12.6.7 + +- Setup of GitHub action test automation for Linux/MacOS builds +- Add URLs to gemspec for inclusion on Rubygems.org +- Add support for several new Linux binaries for Debian, Centos, Ubuntu, Mint, Oracle, Tuxedo +- Add support for several arm64 Linux binaries + # 0.12.6.5.slim5 (published to https://rubygems.pkg.github.com/mycase) * Add binary to support Ubuntu 18.04 on amd64 @@ -90,4 +114,3 @@ Update MacOS `wkhtmltopdf` binary to 0.9.9 # 0.9.9 Update `wkhtmltopdf` binaries with version 0.9.9 - diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..5f10ba8c --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' +gemspec diff --git a/README.md b/README.md index fa7a7dad..042f6cd7 100644 --- a/README.md +++ b/README.md @@ -51,15 +51,26 @@ macOS Binaries should be compressed with `gzip --best` after extracting. The matching binary will be extracted on first execution of `bin/wkhtmltopdf`. -## Testing with Docker +Hints for compressing binaries -Make sure you have Docker and Docker Compose installed (see https://docs.docker.com/compose/install/ for more -information). +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 -There are Dockerfiles for the supported Linux based distributions under `.docker`. You can build them all with -`docker-compose build` and run each individually with e.g. `docker-compose run ubuntu_18.04`. +To execute gem tests locally, install in your OS: -There also is a rudimentary minitest test that simply invokes `docker-compose run` for each distribution and -expects to see the output of `wkhtmltopdf --version`. Just run `rake` to run it. +- Docker +- Docker compose +- Ruby +- Bundler -You can clean up after testing with `docker-compose down --rmi all`. +Then, execute the commands below: + +```bash +git clone https://github.com/zakird/wkhtmltopdf_binary_gem +cd wkhtmltopdf_binary_gem/ +bundle install +bundle exec rake +``` diff --git a/bin/wkhtmltopdf b/bin/wkhtmltopdf index a8be1b20..5627038c 100755 --- a/bin/wkhtmltopdf +++ b/bin/wkhtmltopdf @@ -10,35 +10,62 @@ 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_based_on_ubuntu_16_04 = os.start_with?('ubuntu_16.') || os.start_with?('ubuntu_17.') - os = 'ubuntu_16.04' if os_based_on_ubuntu_16_04 + os = 'ubuntu_16.04' if os.start_with?('ubuntu_16.') || + os.start_with?('ubuntu_17.') || + os.start_with?('linuxmint_18.') - os_based_on_ubuntu_18_04 = os.start_with?('ubuntu_18.') || os.start_with?('ubuntu_19.') || os.start_with?('elementary') || os.start_with?('linuxmint') || os.start_with?('pop') || os.start_with?('zorin') - os = 'ubuntu_18.04' if os_based_on_ubuntu_18_04 + os = 'ubuntu_18.04' if os.start_with?('ubuntu_18.') || + os.start_with?('ubuntu_19.') || + os.start_with?('elementary') || + os.start_with?('linuxmint_19.') || + os.start_with?('pop') || + os.start_with?('zorin') - os_based_on_ubuntu_20_04 = os.start_with?('ubuntu_20.') - os = 'ubuntu_20.04' if os_based_on_ubuntu_20_04 + os = 'ubuntu_20.04' if os.start_with?('ubuntu_20.') || + os.start_with?('linuxmint_20.') - os = 'ubuntu_22.04' if os.start_with?('ubuntu_22.') + os = 'ubuntu_22.04' if os.start_with?('ubuntu_22.') || + os.start_with?('ubuntu_24.') || + os.start_with?('tuxedo_22.') || + os.start_with?('neon_24.') || + os.start_with?('neon_22.') || + os.start_with?('linuxmint_22') - os = 'centos_6' if (os.start_with?('amzn_') && os != 'amzn_2') || + os = 'centos_6' if (os.start_with?('amzn_') && os != 'amzn_2' && os != 'amzn_2023') || (os.empty? && File.read('/etc/centos-release').start_with?('CentOS release 6')) - os_based_on_centos_7 = os.start_with?('amzn_2') - os = 'centos_7' if os_based_on_centos_7 + 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.start_with?('ol_8.') || + os.start_with?('almalinux_8') || + os.start_with?('alinux_') || + os == 'amzn_2023' - os_based_on_debian_9 = (/(debian_9|deepin)/ =~ os) + os_based_on_debian_9 = os.start_with?('debian_9') || + os.start_with?('deepin') os = 'debian_9' if os_based_on_debian_9 - os_based_on_debian = !os_based_on_debian_9 && os.start_with?('debian') - os = 'debian_10' if os_based_on_debian + os = 'debian_10' if !os_based_on_debian_9 && os.start_with?('debian_10') - os_based_on_archlinux = os.start_with?('arch_') || os.start_with?('manjaro_') - os = 'archlinux' if os_based_on_archlinux + os = 'debian_11' if !os_based_on_debian_9 && os.start_with?('debian_11') os_based_on_alpine = os.start_with?('alpine_') os = 'alpine' if os_based_on_alpine @@ -48,8 +75,14 @@ suffix = case RbConfig::CONFIG['host_os'] # We should probably break the build on unsupported platforms, but we need to un-break # builds for now and can revisit this once we upgrade to a newer version of Ruby + Alpine. - architecture = RbConfig::CONFIG['host_cpu'] == 'x86_64' ? 'amd64' : 'i386' + os = 'debian_12' if !os_based_on_debian_9 && os.start_with?('debian_12') + + os = 'debian_12' if !os_based_on_debian_9 && os.start_with?('debian_13') + 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' @@ -68,8 +101,8 @@ if File.exist?("#{binary}.gz") && !File.exist?(binary) end unless File.exist? binary - raise 'Invalid platform, must be running on Ubuntu 18.04/20.04/22.04, ' \ - 'CentOS 7, Amazon Linux 2, 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_centos_7_amd64.gz b/bin/wkhtmltopdf_centos_7_amd64.gz deleted file mode 100755 index 881dc120..00000000 Binary files a/bin/wkhtmltopdf_centos_7_amd64.gz and /dev/null differ diff --git a/bin/wkhtmltopdf_centos_7_i386.gz b/bin/wkhtmltopdf_centos_7_i386.gz deleted file mode 100755 index 0d0659e3..00000000 Binary files a/bin/wkhtmltopdf_centos_7_i386.gz and /dev/null differ diff --git a/bin/wkhtmltopdf_ubuntu_20.04_amd64.gz b/bin/wkhtmltopdf_ubuntu_20.04_amd64.gz deleted file mode 100644 index 1889a418..00000000 Binary files a/bin/wkhtmltopdf_ubuntu_20.04_amd64.gz and /dev/null differ diff --git a/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz b/bin/wkhtmltopdf_ubuntu_22.04_arm64.gz old mode 100755 new mode 100644 similarity index 63% rename from bin/wkhtmltopdf_ubuntu_18.04_amd64.gz rename to bin/wkhtmltopdf_ubuntu_22.04_arm64.gz index 2fbed746..c5e5156f Binary files a/bin/wkhtmltopdf_ubuntu_18.04_amd64.gz and b/bin/wkhtmltopdf_ubuntu_22.04_arm64.gz differ diff --git a/docker-compose-arm.yml b/docker-compose-arm.yml new file mode 100644 index 00000000..cba273b2 --- /dev/null +++ b/docker-compose-arm.yml @@ -0,0 +1,44 @@ +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 + + ubuntu_22.04: + build: + context: . + dockerfile: .docker/Dockerfile-ubuntu_22.04 + volumes: + - .:/root/wkhtmltopdf_binary_gem + + ubuntu_24.04: + build: + context: . + dockerfile: .docker/Dockerfile-ubuntu_24.04 + volumes: + - .:/root/wkhtmltopdf_binary_gem diff --git a/docker-compose.yml b/docker-compose.yml index 07b4e4d2..dcdeed40 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ version: '3' services: - ubuntu_16.04: build: context: . @@ -44,6 +43,27 @@ 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 + + debian_13: + build: + context: . + dockerfile: .docker/Dockerfile-debian_13 + volumes: + - .:/root/wkhtmltopdf_binary_gem + centos_6: build: context: . @@ -65,10 +85,24 @@ services: volumes: - .:/root/wkhtmltopdf_binary_gem - deepin: + oraclelinux_8: + build: + context: . + dockerfile: .docker/Dockerfile-oraclelinux_8 + volumes: + - .:/root/wkhtmltopdf_binary_gem + + rockylinux_8: + build: + context: . + dockerfile: .docker/Dockerfile-rockylinux_8 + volumes: + - .:/root/wkhtmltopdf_binary_gem + + almalinux_8: build: context: . - dockerfile: .docker/Dockerfile-deepin + dockerfile: .docker/Dockerfile-almalinux_8 volumes: - .:/root/wkhtmltopdf_binary_gem diff --git a/ext/wkhtmltopdf-binary/Rakefile b/ext/wkhtmltopdf-binary/Rakefile index 323b7994..45e53a88 100644 --- a/ext/wkhtmltopdf-binary/Rakefile +++ b/ext/wkhtmltopdf-binary/Rakefile @@ -25,6 +25,9 @@ suffix = case RbConfig::CONFIG['host_os'] os_based_on_ubuntu_20_04 = os.start_with?('ubuntu_20.') os = 'ubuntu_20.04' if os_based_on_ubuntu_20_04 + os_based_on_ubuntu_22_04 = os.start_with?('ubuntu_22.') || os.start_with?('ubuntu_24.') + os = 'ubuntu_22.04' if os_based_on_ubuntu_22_04 + os_based_on_centos_6 = (os.empty? && File.read('/etc/centos-release').start_with?('CentOS release 6')) || (os.start_with?('amzn_') && !os.start_with?('amzn_2')) os = 'centos_6' if os_based_on_centos_6 @@ -69,8 +72,8 @@ task :default do end unless File.exist? binary - raise 'Invalid platform, must be running on Ubuntu 18.04/20.04 ' \ - 'CentOS 7, Amazon Linux 2, or intel-based Cocoa macOS ' \ + raise 'Invalid platform, must be running on Ubuntu 22.04/24.04 ' \ + 'alpine, or intel-based Cocoa macOS ' \ "(missing binary: #{binary})." end end diff --git a/test/test_with_docker.rb b/test/test_with_docker.rb index f8d9188f..35169683 100644 --- a/test/test_with_docker.rb +++ b/test/test_with_docker.rb @@ -1,41 +1,68 @@ require 'minitest/autorun' +def macos? + ENV['RUNNER_OS'] && ENV['RUNNER_OS'] == 'macOS' +end + +def arm? + ENV['ARM'] +end + class WithDockerTest < Minitest::Test - # Run code before a group of test (see: https://github.com/seattlerb/minitest#how-to-run-code-before-a-group-of-tests) SETUP = begin - `docker-compose build` - 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_debian_13 + test_on_x86 with: 'debian_13' 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_and_arm with: 'ubuntu_22.04' + end + + def test_with_ubuntu_24 + test_on_x86_and_arm with: 'ubuntu_24.04' end def test_with_ubuntu_22 @@ -43,16 +70,32 @@ def test_with_ubuntu_22 end def test_with_archlinux - test with: 'archlinux' + test_on_x86 with: 'archlinux' + end + + def test_rockylinux_8 + test_on_x86 with: 'rockylinux_8' + end + + def test_almalinux_8 + test_on_x86 with: 'almalinux_8' end def test_with_macos - assert_equal `bin/wkhtmltopdf --version`.strip, 'wkhtmltopdf 0.12.6 (with patched qt)' + 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)' + 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 a94c09cd..1b5a50bd 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.6.slim6" + s.version = "0.12.6.10.slim2" s.license = "Apache-2.0" s.author = "Zakir Durumeric" s.email = "zakird@gmail.com" @@ -16,4 +16,5 @@ Gem::Specification.new do |s| s.metadata['allowed_push_host'] = 'https://rubygems.pkg.github.com/mycase' s.add_development_dependency "minitest" + s.add_development_dependency "rake" end