Merge pull request #89 from klippa-app/dependabot/go_modules/golang.o… #472
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 | |
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.18", "1.19", "1.20" ] | |
pdfium: [ "4849", "4874", "4929", "5038", "5079", "5254", "5378", "5664", "5854", "5907" ] | |
env: | |
PDFIUM_EXPERIMENTAL_VERSION: "5907" | |
PDFIUM_EXPERIMENTAL_GO_VERSION: "1.20" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
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 /usr/lib/pkgconfig/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-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 | |
- 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 GODEBUG=cgocheck=2 | |
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 GODEBUG=cgocheck=2 | |
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 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@v2 | |
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@v2 | |
with: | |
files: coverage.out | |
test-webassembly: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
go: [ "1.18", "1.19", "1.20" ] | |
env: | |
PDFIUM_EXPERIMENTAL_GO_VERSION: "1.20" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
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 |