-
-
Notifications
You must be signed in to change notification settings - Fork 10
195 lines (183 loc) · 6.9 KB
/
Copy pathrelease-libpdfium.yml
File metadata and controls
195 lines (183 loc) · 6.9 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
name: Release EmbedPDF PDF Runtime Libraries
on:
workflow_dispatch:
inputs:
ref:
description: Git ref to build
required: false
default: embedpdf/main
release:
description: Publish GitHub release
type: boolean
required: false
default: false
permissions:
contents: read
jobs:
source-tests:
name: Source tests (Linux x64)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref_name }}
- name: Install depot_tools
shell: bash
run: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "$RUNNER_TEMP/depot_tools"
echo "$RUNNER_TEMP/depot_tools" >> "$GITHUB_PATH"
- name: Install Linux base deps
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake clang lld curl g++ pkg-config tar
- name: Run PDFium unit and embedder tests
shell: bash
run: scripts/embedpdf-runtime/test-target.sh linux-x64
- name: Upload PDFium test results
if: always()
uses: actions/upload-artifact@v6
with:
name: pdfium-source-test-results-linux-x64
path: out/embedpdf-runtime-test-results/linux-x64/
if-no-files-found: ignore
build:
name: Build ${{ matrix.target }}
needs: source-tests
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- { target: linux-x64, runner: ubuntu-24.04 }
- { target: linux-arm64, runner: ubuntu-24.04 }
- { target: linuxmusl-x64, runner: ubuntu-24.04 }
- { target: linuxmusl-arm64, runner: ubuntu-24.04 }
- { target: wasm32, runner: ubuntu-24.04 }
- { target: darwin-arm64, runner: macos-15 }
- { target: darwin-x64, runner: macos-15 }
- { target: win32-x64, runner: windows-2022 }
- { target: win32-arm64, runner: windows-2022 }
env:
DEPOT_TOOLS_WIN_TOOLCHAIN: 0
EMSDK_VERSION: 3.1.72
MUSL_URLS: ${{ secrets.MUSL_URL || 'https://more.musl.cc https://musl.cc' }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref_name }}
- name: Install depot_tools
shell: bash
run: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git "$RUNNER_TEMP/depot_tools"
echo "$RUNNER_TEMP/depot_tools" >> "$GITHUB_PATH"
- name: Install Linux base deps
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake curl g++ pkg-config tar
- name: Install aarch64 cross-compiler
if: matrix.target == 'linux-arm64'
shell: bash
run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install musl toolchain
if: startsWith(matrix.target, 'linuxmusl-')
shell: bash
run: |
triple=x86_64-linux-musl
if [[ "${{ matrix.target }}" == "linuxmusl-arm64" ]]; then
triple=aarch64-linux-musl
fi
archive="$triple-cross.tgz"
for base_url in $MUSL_URLS; do
url="$base_url/$archive"
if [[ "$base_url" == *"more.musl.cc"* ]]; then
url="$base_url/$triple/$archive"
fi
echo "Downloading $url"
if curl --fail --location --retry 5 --retry-all-errors --connect-timeout 20 --max-time 300 -o "$archive" "$url"; then
tar xzf "$archive"
echo "$PWD/$triple-cross/bin" >> "$GITHUB_PATH"
exit 0
fi
done
echo "Failed to download musl toolchain for $triple" >&2
exit 1
- name: Install Emscripten
if: matrix.target == 'wasm32'
shell: bash
run: |
mkdir -p third_party
if [[ -d third_party/emsdk ]]; then
git -C third_party/emsdk pull
else
git clone https://github.com/emscripten-core/emsdk.git third_party/emsdk
fi
third_party/emsdk/emsdk install "$EMSDK_VERSION"
third_party/emsdk/emsdk activate "$EMSDK_VERSION"
echo "$PWD/third_party/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
echo "$PWD/third_party/emsdk/upstream/bin" >> "$GITHUB_PATH"
- name: Select Xcode
if: runner.os == 'macOS'
shell: bash
run: sudo xcode-select -s "/Applications/Xcode_26.0.app"
- name: Install Windows deps
if: runner.os == 'Windows'
shell: pwsh
run: |
$kitsRoot = 'C:\Program Files (x86)\Windows Kits\10\bin'
$sdk = Get-ChildItem $kitsRoot -Directory |
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
Sort-Object Name -Descending |
Select-Object -First 1
if ($null -eq $sdk) {
throw "No Windows SDK version directory found in $kitsRoot"
}
$rcPath = Join-Path $sdk.FullName 'x64'
if (!(Test-Path (Join-Path $rcPath 'rc.exe'))) {
throw "rc.exe not found in $rcPath"
}
$rcPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build target
shell: bash
run: scripts/embedpdf-runtime/build-target.sh "${{ matrix.target }}"
- name: Package target
shell: bash
run: scripts/embedpdf-runtime/package-target.sh "${{ matrix.target }}"
- uses: actions/upload-artifact@v6
with:
name: libembedpdf-pdf-runtime-${{ matrix.target }}
path: out/embedpdf-runtime-artifacts/*.tar.gz
release:
name: Publish release
runs-on: ubuntu-24.04
needs: build
if: github.event_name == 'workflow_dispatch' && inputs.release == true
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.ref || github.ref_name }}
- uses: actions/download-artifact@v7
with:
path: artifacts
- name: Flatten artifacts
shell: bash
run: |
mkdir -p out/embedpdf-runtime-artifacts
find artifacts -name '*.tar.gz' -exec cp {} out/embedpdf-runtime-artifacts/ \;
- name: Write manifest
shell: bash
run: |
tag="runtime-$(git rev-parse HEAD)"
export PDF_RUNTIME_ARTIFACT_DIR="$PWD/out/embedpdf-runtime-artifacts"
export PDF_RUNTIME_RELEASE_BASE_URL="https://github.com/${{ github.repository }}/releases/download/$tag"
scripts/embedpdf-runtime/write-manifest.sh "$PDF_RUNTIME_ARTIFACT_DIR/pdf-runtime-build.generated.json"
- uses: ncipollo/release-action@v1
with:
tag: runtime-${{ github.sha }}
name: EmbedPDF PDF Runtime ${{ github.sha }}
artifacts: out/embedpdf-runtime-artifacts/*
allowUpdates: true