-
Notifications
You must be signed in to change notification settings - Fork 5
267 lines (218 loc) · 8.69 KB
/
build_questpdf_skia.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
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: Build Skia + QuestPDF
on:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.runtime.name }}
runs-on: ${{ matrix.runtime.runs-on }}
container: ${{ matrix.runtime.container }}
strategy:
fail-fast: false
matrix:
runtime:
# - name: win-x64
# runs-on: windows-latest-xlarge
# - name: win-x86
# runs-on: windows-latest-xlarge
- name: linux-x64
runs-on: ubuntu-latest-xlarge
container: ubuntu:18.04
- name: linux-arm64
runs-on: ubuntu-latest-xlarge-arm64
container: ubuntu:18.04
# - name: linux-musl-x64
# runs-on: ubuntu-latest-xlarge
# container: alpine:3.17
# - name: osx-x64
# runs-on: macos-latest-large
# - name: osx-arm64
# runs-on: macos-latest-xlarge
steps:
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- uses: actions/checkout@v3
- name: Install Build Tools
if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64'
shell: bash
run: |
apt update --yes
apt upgrade --yes
apt install wget git cmake fontconfig --yes
- name: Install Clang
if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64'
shell: bash
run: |
apt install --yes software-properties-common
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-15 main"
apt update --yes
apt install --yes clang-15 lldb-15 lld-15
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-15 100
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-15 100
update-alternatives --config cc
update-alternatives --config c++
cc --version
c++ --version
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
update-alternatives --config clang
update-alternatives --config clang++
clang --version
clang++ --version
- name: Install Cmake
if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64'
shell: bash
run: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
apt update
apt install cmake --yes
cmake --version
- name: Install Python 3.8
if: matrix.runtime.name == 'linux-x64' || matrix.runtime.name == 'linux-arm64'
shell: bash
run: |
apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget --yes
wget https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tgz
tar xzf Python-3.8.18.tgz
cd Python-3.8.18
./configure --enable-optimizations
make --silent
make install --silent
python3 --version
- name: Install Build Tools (Alpine)
if: matrix.runtime.name == 'linux-musl-x64'
shell: sh
run: |
apk update
apk upgrade
apk add bash wget git python3 build-base cmake clang llvm15 icu-libs linux-headers bsd-compat-headers gn fontconfig font-noto
- name: Install 3.x
if: runner.os != 'Linux'
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Skia Build System
if: matrix.runtime.name != 'linux-musl-x64'
shell: bash
run: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "${PWD}/depot_tools" >> $GITHUB_PATH
export PATH="${PWD}/depot_tools:${PATH}"
- name: Build Skia
shell: bash
run: |
git clone https://github.com/google/skia.git --branch chrome/m126 --single-branch
cd skia
git apply ../patches/*.patch
bin/fetch-ninja
python3 tools/git-sync-deps
COMMON_ARGS='
is_official_build=true
is_component_build=false
is_debug=false
skia_enable_optimize_size=true
skia_enable_tools=true
skia_use_system_expat=false
skia_use_system_icu=false
skia_use_system_harfbuzz=false
skia_use_system_libjpeg_turbo=false
skia_use_system_libpng=false
skia_use_system_libwebp=false
skia_use_system_zlib=false
skia_use_system_freetype2=false
skia_use_dng_sdk=false
skia_use_harfbuzz=true
skia_use_icu=false
skia_use_icu4x=false
skia_use_libgrapheme=true
skia_use_fontconfig=false
skia_use_gl=false
skia_use_libjpeg_turbo_decode=true
skia_use_libjpeg_turbo_encode=true
skia_use_libpng_encode=true
skia_use_libpng_decode=true
skia_use_libwebp_encode=true
skia_use_libwebp_decode=true
skia_enable_android_utils=false
skia_enable_spirv_validation=false
skia_enable_gpu=false
skia_enable_gpu_debug_layers=false
skia_enable_fontmgr_custom_directory=true
skia_use_freetype=true
skia_use_jpeg_gainmaps=false
skia_use_libheif=false
skia_use_lua=false
skia_enable_svg=true
skia_use_expat=true
skia_enable_skshaper=true
skia_enable_skunicode=true
skia_pdf_subset_harfbuzz=true
skia_enable_pdf=true
skia_compile_modules=false
extra_cflags=["-fPIC", "-fno-rtti"]'
if [[ "${{ matrix.runtime.name }}" == linux-* ]]; then
COMMON_ARGS+=' cc="clang" cxx="clang++"'
fi
if [ "${{ runner.os }}" = "macOS" ]; then
COMMON_ARGS+=' skia_use_fonthost_mac=true'
fi
if [ "${{ matrix.runtime.name }}" = "win-x86" ]; then
COMMON_ARGS+=' target_cpu="x86"'
fi
if [ "${{ matrix.runtime.name }}" = "linux-musl-x64" ]; then
gn gen out/release --args="$COMMON_ARGS"
else
bin/gn gen out/release --args="$COMMON_ARGS"
fi
ninja -C out/release skia svg skparagraph skresources
- name: Configure CMake
shell: bash
run: |
CMAKE_ARGS="
-S ${PWD}/native
-B ${PWD}/native/build
-DSKIA_DIR=${PWD}/skia
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER=clang
-DCMAKE_BUILD_TYPE=Release"
if [ "${{ matrix.runtime.name }}" = "win-x86" ]; then
CMAKE_ARGS+=" -A Win32"
fi
cmake $CMAKE_ARGS
- name: Build CMake
shell: bash
run: >
cmake
--build ${PWD}/native/build
--config Release
- name: Copy build artifact to output directory
shell: bash
run: |
mkdir -p output/runtimes/${{ matrix.runtime.name }}/native
find native/build -type f \( -name "*.dylib" -o -name "*.dll" -o -name "*.so" \) -exec cp {} output/runtimes/${{ matrix.runtime.name }}/native \;
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: questpdf-native-libraries
path: output
- name: Setup .NET 8.0 SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Test build artifacts
shell: bash
run: |
TEST_EXECUTION_PATH='managed/NativeSkia.Tests/bin/Debug/net8.0/${{ matrix.runtime.name }}'
mkdir -p "$TEST_EXECUTION_PATH"
cp -R output/* "$TEST_EXECUTION_PATH"
dotnet test managed --framework net8.0 --runtime ${{ matrix.runtime.name }}
mkdir -p testOutput/${{ matrix.runtime.name }}
ls -lR $TEST_EXECUTION_PATH
cp -r $TEST_EXECUTION_PATH/Output/* testOutput/${{ matrix.runtime.name }}
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: questpdf-test-results
path: testOutput