-
Notifications
You must be signed in to change notification settings - Fork 3
238 lines (203 loc) · 9.34 KB
/
tests.yml
File metadata and controls
238 lines (203 loc) · 9.34 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: Go tests
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
- development
env:
GO_VERSION: "1.24"
PDFIUM_VERSION: "7789"
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@v4
- name: Set up Go
uses: actions/setup-go@v5
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@v4
- name: Set up Go
uses: actions/setup-go@v5
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.3/build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
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://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3.tar.gz -o libjpeg-turbo-3.0.3.tar.gz && sudo mkdir /opt/libjpegturbo && sudo tar -C /opt/libjpegturbo -xvf libjpeg-turbo-3.0.3.tar.gz
cd /opt/libjpegturbo/libjpeg-turbo-3.0.3 && 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.3/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.3/build"' -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg main.go
test-cgo-linux-arm64:
env:
CGO_ENABLED: 1
LD_LIBRARY_PATH: "/opt/pdfium/lib"
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
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-arm64.tgz -o pdfium-linux-arm64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-arm64.tgz
sudo rm pdfium-linux-arm64.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-arm64:
env:
CGO_ENABLED: 1
CC: "musl-gcc"
LD_LIBRARY_PATH: "/opt/pdfium/lib:/opt/libjpegturbo/libjpeg-turbo-3.0.3/build"
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
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-arm64.tgz -o pdfium-linux-musl-arm64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-musl-arm64.tgz
sudo rm pdfium-linux-musl-arm64.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://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3.tar.gz -o libjpeg-turbo-3.0.3.tar.gz && sudo mkdir /opt/libjpegturbo && sudo tar -C /opt/libjpegturbo -xvf libjpeg-turbo-3.0.3.tar.gz
cd /opt/libjpegturbo/libjpeg-turbo-3.0.3 && 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.3/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.3/build"' -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg main.go
test-cgo-macos-arm64:
env:
CGO_ENABLED: 1
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
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-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
brew install jpeg-turbo
- name: Test
run: |
export LD_LIBRARY_PATH="/opt/pdfium/lib"
export PKG_CONFIG_PATH="/opt/pdfium"
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"
export PKG_CONFIG_PATH="/opt/pdfium"
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@v4
- name: Set up Go
uses: actions/setup-go@v5
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://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.3/libjpeg-turbo-3.0.3-gcc64.exe -o libjpeg-turbo-3.0.3-gcc64.exe
./libjpeg-turbo-3.0.3-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