Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
qwlong authored Jun 22, 2024
2 parents d1c2c48 + 8d40094 commit 84974e7
Show file tree
Hide file tree
Showing 27 changed files with 256 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile-archlinux
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions .docker/Dockerfile-debian_10_arm
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .docker/Dockerfile-debian_11
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .docker/Dockerfile-debian_11_arm
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .docker/Dockerfile-debian_12
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .docker/Dockerfile-debian_12_arm
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion .docker/Dockerfile-debian_9
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions .docker/Dockerfile-debian_9_arm
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .docker/Dockerfile-oraclelinux_8
Original file line number Diff line number Diff line change
@@ -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
54 changes: 49 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
24 changes: 17 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
.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_16.04_i386
bin/wkhtmltopdf_ubuntu_18.04_amd64
bin/wkhtmltopdf_ubuntu_18.04_i386
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_centos_6_i386
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_i386
bin/wkhtmltopdf_archlinux_amd64
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# 0.12.6.x
# 0.12.6.7

- Setup of Github action automation for Linux/MacOS builds
- 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.6

Expand Down
32 changes: 25 additions & 7 deletions bin/wkhtmltopdf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
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
Expand All @@ -26,31 +37,38 @@ suffix = case RbConfig::CONFIG['host_os']
os.start_with?('zorin')

os = 'ubuntu_20.04' if os.start_with?('ubuntu_20.') ||
os.start_with?('ubuntu_21.') ||
os.start_with?('linuxmint_20.')

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?('linuxmint_21.')
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'))

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?('alinux_')
os = 'centos_8' if os.start_with?('rocky_8') ||
os.start_with?('rhel_8.') ||
os.start_with?('ol_8.') ||
os.start_with?('alinux_')

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'
Expand All @@ -70,7 +88,7 @@ end

unless File.exist? binary
raise 'Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, ' \
'CentOS 6/7/8, Debian 9/10, Archlinux amd64, or Intel-based Cocoa macOS ' \
'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

Expand Down
Binary file added bin/wkhtmltopdf_debian_10_arm64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_11_amd64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_11_arm64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_11_i386.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_12_amd64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_12_arm64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_12_i386.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_debian_9_arm64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_ubuntu_20.04_arm64.gz
Binary file not shown.
Binary file added bin/wkhtmltopdf_ubuntu_21.10_amd64.gz
Binary file not shown.
30 changes: 30 additions & 0 deletions docker-compose-arm.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,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: .
Expand All @@ -64,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: .
Expand Down
Loading

0 comments on commit 84974e7

Please sign in to comment.