-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (165 loc) · 5.15 KB
/
ci.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
name: Continuous integration
on: [push, pull_request]
env:
KRILLA_THRESHOLD: "200"
VISREG: ""
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"
jobs:
pdfium:
name: PDFium
runs-on: ubuntu-latest
steps:
- name: Cache PDFium binary
id: cache-pdfium
uses: actions/cache@v4
with:
path: pdfium
key: pdfium-binary-v1
- name: Clone sitro repo
if: steps.cache-pdfium.outputs.cache-hit != 'true'
run: |
git clone https://github.com/LaurenzV/sitro
- name: Build pdfium
if: steps.cache-pdfium.outputs.cache-hit != 'true'
run: |
cd sitro/src/pdfium
cargo build --release
- name: Finish
if: steps.cache-pdfium.outputs.cache-hit != 'true'
run: mv sitro/target/release/pdfium pdfium
mupdf:
name: MuPDF
runs-on: ubuntu-latest
steps:
- name: Cache MuPDF
id: cache-mupdf
uses: actions/cache@v4
with:
path: mutool
key: mupdf-binary-v2
- name: Download MuPDF
if: steps.cache-mupdf.outputs.cache-hit != 'true'
run: |
curl -LO https://mupdf.com/downloads/archive/mupdf-1.25.1-source.tar.gz
tar -xvzf ./mupdf-1.25.1-source.tar.gz
- name: Build MuPDF
if: steps.cache-mupdf.outputs.cache-hit != 'true'
run: |
cd mupdf-1.25.1-source
make HAVE_X11=no HAVE_GLUT=no
- name: Finish
if: steps.cache-mupdf.outputs.cache-hit != 'true'
run: mv mupdf-1.25.1-source/build/release/mutool mutool
gs:
name: gs
runs-on: ubuntu-latest
steps:
- name: Cache GhostScript
id: cache-gs
uses: actions/cache@v4
with:
path: gs
key: gs-binary-v2
- name: Download GhostScript
if: steps.cache-gs.outputs.cache-hit != 'true'
run: |
curl -LO https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10040/ghostscript-10.04.0.tar.gz
tar -xvzf ./ghostscript-10.04.0.tar.gz
- name: Build GhostScript
if: steps.cache-gs.outputs.cache-hit != 'true'
run: |
cd ghostscript-10.04.0
./configure
make
- name: Finish
if: steps.cache-gs.outputs.cache-hit != 'true'
run: mv ghostscript-10.04.0/bin/gs gs
tests:
name: Tests
runs-on: ubuntu-latest
needs: [pdfium, mupdf, gs]
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Get Rust cache
uses: Swatinem/rust-cache@v2
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
with:
path: pdfium
key: pdfium-binary-v1
- uses: actions/cache@v4
with:
path: mutool
key: mupdf-binary-v2
- uses: actions/cache@v4
with:
path: gs
key: gs-binary-v2
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: poppler-utils
version: 1.0
- name: Download the pdfium library
run: |
curl -LO https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F5880/pdfium-linux-x64.tgz
mkdir pdfium-linux-x64
tar -xvzf ./pdfium-linux-x64.tgz -C pdfium-linux-x64
sudo mv ./pdfium-linux-x64/lib/libpdfium.so /usr/lib
rm -r pdfium-linux-x64.tgz
rm -r pdfium-linux-x64
- name: Get pdfbox
run: |
curl -LO https://dlcdn.apache.org/pdfbox/3.0.3/pdfbox-app-3.0.3.jar
mv pdfbox-app-3.0.3.jar pdfbox.jar
ls .
- name: Clone sitro
run: |
git clone https://github.com/LaurenzV/sitro
- name: npm install
run: |
cd sitro/src/pdfjs
npm i
- name: Setup
run: |
sudo chmod +x pdfium
sudo chmod +x mutool
echo "POPPLER_BIN=pdftoppm" >> $GITHUB_ENV
echo "GHOSTSCRIPT_BIN=$(pwd)/gs" >> $GITHUB_ENV
echo "PDFIUM_BIN=$(pwd)/pdfium" >> $GITHUB_ENV
echo "PDFBOX_BIN=$(pwd)/pdfbox.jar" >> $GITHUB_ENV
echo "PDFJS_BIN=$(pwd)/sitro/src/pdfjs/pdfjs_render.mjs" >> $GITHUB_ENV
echo "MUPDF_BIN=$(pwd)/mutool" >> $GITHUB_ENV
- name: Build
run: cargo build
- name: Run tests
run: cargo test --workspace -- --nocapture
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
path: ./assets/diffs
checks:
name: Check clippy, formatting, and documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- run: cargo clippy
- run: cargo fmt --check --all
- run: cargo doc --workspace --no-deps
- run: RUSTFLAGS=-Awarnings cargo hack check --each-feature