Update go-pdfium to v1.10.0 (#34) #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go tests | |
on: | |
push: | |
branches: | |
- main | |
- development | |
pull_request: | |
branches: | |
- main | |
- development | |
env: | |
GO_VERSION: "1.21" | |
PDFIUM_VERSION: "6150" | |
jobs: | |
test-webassembly: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
env: | |
CGO_ENABLED: 0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run tests | |
run: | | |
go test ./... -v | |
- name: Test build | |
run: | | |
go build main.go | |
test-cgo-linux: | |
env: | |
CGO_ENABLED: 1 | |
LD_LIBRARY_PATH: "/opt/pdfium/lib" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-linux-x64.tgz -o pdfium-linux-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-x64.tgz | |
sudo rm pdfium-linux-x64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /usr/lib/pkgconfig/pdfium.pc | |
sudo apt-get update -y | |
sudo apt-get install -y libturbojpeg libturbojpeg-dev | |
- name: Test Linux | |
run: | | |
go test ./... -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -v | |
- name: Build | |
run: | | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg main.go | |
test-cgo-linux-musl: | |
env: | |
CGO_ENABLED: 1 | |
CC: "musl-gcc" | |
LD_LIBRARY_PATH: "/opt/pdfium/lib:/opt/libjpegturbo/libjpeg-turbo-3.0.0/build" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library, musl and libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-linux-musl-x64.tgz -o pdfium-linux-musl-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-musl-x64.tgz | |
sudo rm pdfium-linux-musl-x64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /usr/lib/pkgconfig/pdfium.pc | |
sudo cp ./.github/workflows/libturbojpeg.pc /usr/lib/pkgconfig/libturbojpeg.pc | |
sudo apt-get update -y | |
sudo apt-get install -y musl-dev musl-tools | |
sudo curl -L https://master.dl.sourceforge.net/project/libjpeg-turbo/3.0.0/libjpeg-turbo-3.0.0.tar.gz -o libjpeg-turbo-3.0.0.tar.gz && sudo mkdir /opt/libjpegturbo && sudo tar -C /opt/libjpegturbo -xvf libjpeg-turbo-3.0.0.tar.gz | |
cd /opt/libjpegturbo/libjpeg-turbo-3.0.0 && sudo mkdir build && cd build | |
sudo cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=musl-gcc -DWITH_JPEG8=1 -DCMAKE_BUILD_TYPE=None ../ | |
sudo make turbojpeg | |
- name: Test Linux | |
run: | | |
go test ./... --ldflags '-linkmode external -extldflags "-fno-PIC -L/opt/libjpegturbo/libjpeg-turbo-3.0.0/build"' -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -v | |
- name: Build | |
run: | | |
go build --ldflags '-linkmode external -extldflags "-fno-PIC -L/opt/libjpegturbo/libjpeg-turbo-3.0.0/build"' -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg main.go | |
test-cgo-macos: | |
env: | |
CGO_ENABLED: 1 | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library and libjpeg-turbo | |
run: | | |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-mac-x64.tgz -o pdfium-mac-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-mac-x64.tgz | |
sudo rm pdfium-mac-x64.tgz | |
sudo cp ./.github/workflows/pdfium.pc /usr/local/lib/pkgconfig/pdfium.pc | |
brew install jpeg-turbo | |
- name: Test | |
run: | | |
export LD_LIBRARY_PATH="/opt/pdfium/lib" | |
go test ./... -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -exec "env DYLD_LIBRARY_PATH=/opt/pdfium/lib" -v | |
- name: Build | |
run: | | |
export LD_LIBRARY_PATH="/opt/pdfium/lib" | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg main.go | |
test-cgo-windows: | |
env: | |
CGO_ENABLED: 1 | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Set up PDFium library and libjpeg-turbo | |
run: | | |
curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-win-x64.tgz -o pdfium-win-x64.tgz | |
mkdir -p D:\opt\pdfium | |
tar -C D:\opt\pdfium -xvf pdfium-win-x64.tgz | |
rm pdfium-win-x64.tgz | |
mkdir D:\opt\pkgconfig | |
cp ./.github/workflows/pdfium-windows.pc D:\opt\pkgconfig\pdfium.pc | |
curl -L https://master.dl.sourceforge.net/project/libjpeg-turbo/3.0.0/libjpeg-turbo-3.0.0-gcc64.exe -o libjpeg-turbo-3.0.0-gcc64.exe | |
./libjpeg-turbo-3.0.0-gcc64.exe /S | |
$Folder = 'C:\libjpeg-turbo-gcc64\lib\pkgconfig' | |
while (!(Test-Path -Path $Folder)) { | |
"libjpeg-turbo does not exist yet!" | |
Start-Sleep -s 5 | |
} | |
- name: Test | |
run: | | |
$env:PKG_CONFIG_PATH = 'D:\opt\pkgconfig;C:\libjpeg-turbo-gcc64\lib\pkgconfig' | |
$env:Path += ";D:\opt\pdfium\bin;C:\libjpeg-turbo-gcc64\bin" | |
go test ./... -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -v | |
- name: Build | |
run: | | |
$env:PKG_CONFIG_PATH = 'D:\opt\pkgconfig;C:\libjpeg-turbo-gcc64\lib\pkgconfig' | |
$env:Path += ";D:\opt\pdfium\bin;C:\libjpeg-turbo-gcc64\bin" | |
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg main.go |