Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
unixmonkey authored May 9, 2024
2 parents 2097fdb + dd07d7a commit c42cff2
Show file tree
Hide file tree
Showing 29 changed files with 272 additions and 35 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
8 changes: 8 additions & 0 deletions .docker/Dockerfile-ubuntu_22.04
Original file line number Diff line number Diff line change
@@ -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
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
41 changes: 31 additions & 10 deletions bin/wkhtmltopdf
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,64 @@
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'))

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'
Expand All @@ -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

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_22.04_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
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -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: .
Expand All @@ -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: .
Expand Down
Loading

0 comments on commit c42cff2

Please sign in to comment.