-
Notifications
You must be signed in to change notification settings - Fork 16
125 lines (121 loc) · 5.6 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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.19", "1.20", "1.21" ]
pdfium: [ "4849", "6029" ]
env:
PDFIUM_EXPERIMENTAL_VERSION: "6029"
PDFIUM_EXPERIMENTAL_GO_VERSION: "1.21"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
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"
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 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@v3
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@v3
with:
files: coverage.out
test-webassembly:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go: [ "1.19", "1.20", "1.21" ]
env:
PDFIUM_EXPERIMENTAL_GO_VERSION: "1.21"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
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