Skip to content

Merge pull request #185 from klippa-app/dependabot/go_modules/github.… #699

Merge pull request #185 from klippa-app/dependabot/go_modules/github.…

Merge pull request #185 from klippa-app/dependabot/go_modules/github.… #699

Workflow file for this run

name: Go
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
jobs:
test-cgo:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go: [ "1.20", "1.21", "1.22" ]
pdfium: [ "4849", "6392" ]
env:
PDFIUM_EXPERIMENTAL_VERSION: "6392"
PDFIUM_EXPERIMENTAL_GO_VERSION: "1.22"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Set up PDFium library (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ matrix.pdfium }}/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 /opt/pdfium/pdfium.pc
- name: Set up PDFium library (MacOS)
if: matrix.os == 'macos-latest'
run: |
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ matrix.pdfium }}/pdfium-mac-arm64.tgz -o pdfium-mac-arm64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-mac-arm64.tgz
sudo rm pdfium-mac-arm64.tgz
sudo cp ./.github/workflows/pdfium.pc /opt/pdfium/pdfium.pc
- name: Set up PDFium library (Windows)
if: matrix.os == 'windows-latest'
run: |
curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ matrix.pdfium }}/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
- name: Test all packages (Linux & MacOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
export LD_LIBRARY_PATH="/opt/pdfium/lib"
export PKG_CONFIG_PATH="/opt/pdfium"
go test -timeout 30m `go list ./... | grep -v webassembly` -exec "env DYLD_LIBRARY_PATH=/opt/pdfium/lib" -v
- name: Test all packages (Linux & MacOS) - Experimental
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.pdfium == env.PDFIUM_EXPERIMENTAL_VERSION
run: |
export LD_LIBRARY_PATH="/opt/pdfium/lib"
export PKG_CONFIG_PATH="/opt/pdfium"
export IS_EXPERIMENTAL="1"
go test -timeout 30m `go list ./... | grep -v webassembly` -tags pdfium_experimental -exec "env DYLD_LIBRARY_PATH=/opt/pdfium/lib" -v
- name: Test all packages (Windows)
if: matrix.os == 'windows-latest'
run: |
$env:PKG_CONFIG_PATH = 'D:\opt\pkgconfig'
$env:Path += ";D:\opt\pdfium\bin"
go test -timeout 30m $(go list ./... | grep -v webassembly) -v
- name: Test all packages (Windows) - Experimental
if: matrix.os == 'windows-latest' && matrix.pdfium == env.PDFIUM_EXPERIMENTAL_VERSION
run: |
$env:PKG_CONFIG_PATH = 'D:\opt\pkgconfig'
$env:Path += ";D:\opt\pdfium\bin"
$env:IS_EXPERIMENTAL = '1'
go test -timeout 30m $(go list ./... | grep -v webassembly) -tags pdfium_experimental -v
- name: Test implementation for coverage
if: matrix.os == 'ubuntu-latest' && matrix.go == env.PDFIUM_EXPERIMENTAL_GO_VERSION && matrix.pdfium == env.PDFIUM_EXPERIMENTAL_VERSION
run: |
export LD_LIBRARY_PATH="/opt/pdfium/lib"
export PKG_CONFIG_PATH="/opt/pdfium"
export IS_EXPERIMENTAL="1"
go test -timeout 30m ./internal/implementation_cgo ./internal/implementation_webassembly -coverprofile=coverage.out -covermode=atomic -tags pdfium_experimental -v
- name: Archive code coverage results
if: matrix.os == 'ubuntu-latest' && matrix.go == env.PDFIUM_EXPERIMENTAL_GO_VERSION && matrix.pdfium == env.PDFIUM_EXPERIMENTAL_VERSION
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ./coverage.out
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go == env.PDFIUM_EXPERIMENTAL_GO_VERSION && matrix.pdfium == env.PDFIUM_EXPERIMENTAL_VERSION
uses: codecov/codecov-action@v4
with:
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
test-webassembly:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go: [ "1.20", "1.21", "1.22" ]
env:
PDFIUM_EXPERIMENTAL_GO_VERSION: "1.22"
CGO_ENABLED: "0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Test all packages
run: |
go test -timeout 30m ./internal/implementation_webassembly -v
go test -timeout 30m ./webassembly -v
- name: Test all packages - Experimental (non-Windows)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
export IS_EXPERIMENTAL="1"
go test -timeout 30m ./internal/implementation_webassembly -tags pdfium_experimental -v
go test -timeout 30m ./webassembly -tags pdfium_experimental -v
- name: Test all packages - Experimental (Windows)
if: matrix.os == 'windows-latest'
run: |
$env:IS_EXPERIMENTAL = '1'
go test -timeout 30m ./internal/implementation_webassembly -tags pdfium_experimental -v
go test -timeout 30m ./webassembly -tags pdfium_experimental -v