Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt at adding CI #17

Merged
merged 54 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
98f8289
try 1
LaurenzV Aug 16, 2024
d7a4c1d
try 2
LaurenzV Aug 16, 2024
8cd155b
try 3
LaurenzV Aug 16, 2024
d2f3f1d
disable some tests
LaurenzV Aug 16, 2024
1a44418
next try
LaurenzV Aug 16, 2024
475e70b
next try
LaurenzV Aug 16, 2024
e220ade
next try
LaurenzV Aug 16, 2024
510e9ad
next try
LaurenzV Aug 16, 2024
2e2a933
next try
LaurenzV Aug 16, 2024
2131aab
next try
LaurenzV Aug 16, 2024
0c9d86e
next try
LaurenzV Aug 16, 2024
d2cab5d
add xpdf
LaurenzV Aug 16, 2024
c28e1d7
download xpdf
LaurenzV Aug 16, 2024
f4fb48b
Split build and test
LaurenzV Aug 16, 2024
e32a926
next
LaurenzV Aug 16, 2024
3113aff
debug
LaurenzV Aug 16, 2024
08ac0c6
debug
LaurenzV Aug 16, 2024
ca0ee20
debug next
LaurenzV Aug 16, 2024
d2f161d
try cache
LaurenzV Aug 16, 2024
18f2f75
does the cache work?
LaurenzV Aug 16, 2024
3a01d76
test xpdf upload
LaurenzV Aug 16, 2024
372d264
try workflow
LaurenzV Aug 16, 2024
62050b3
next try
LaurenzV Aug 16, 2024
3d8144b
next try
LaurenzV Aug 16, 2024
b052e94
next try
LaurenzV Aug 16, 2024
251815d
next try
LaurenzV Aug 16, 2024
af2cda2
next try
LaurenzV Aug 16, 2024
9258df6
next try
LaurenzV Aug 16, 2024
8b198c2
try pdfbox
LaurenzV Aug 16, 2024
a2c5b54
new try
LaurenzV Aug 16, 2024
f99d18c
print dir ocntents
LaurenzV Aug 16, 2024
4da644e
update deps
LaurenzV Aug 16, 2024
d729772
update link
LaurenzV Aug 16, 2024
c2792dd
try pdfjs
LaurenzV Aug 16, 2024
58bc010
try building mupdf
LaurenzV Aug 16, 2024
359827a
next
LaurenzV Aug 16, 2024
c1292d2
next
LaurenzV Aug 16, 2024
5e6022b
next
LaurenzV Aug 16, 2024
b30f3fc
next
LaurenzV Aug 16, 2024
378178e
Check if the cache works
LaurenzV Aug 16, 2024
4319924
next cache attempt
LaurenzV Aug 16, 2024
f57a1f5
next
LaurenzV Aug 16, 2024
3aa9adc
try mupdf cache
LaurenzV Aug 16, 2024
7939969
try integration
LaurenzV Aug 16, 2024
0e1d21e
try again
LaurenzV Aug 16, 2024
3456e91
next
LaurenzV Aug 16, 2024
5e00111
whyy
LaurenzV Aug 16, 2024
a5ac4f4
debug
LaurenzV Aug 16, 2024
5c0c7b3
debug
LaurenzV Aug 16, 2024
8b3e32d
next attemptt
LaurenzV Aug 16, 2024
4f8cd8c
next
LaurenzV Aug 16, 2024
85e807f
small sanity check
LaurenzV Aug 16, 2024
41c0aea
Add missing if
LaurenzV Aug 16, 2024
0f17a2a
another...
LaurenzV Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Continuous integration
on: [push, pull_request]

env:
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"

jobs:
xpdf:
name: XPDF
runs-on: ubuntu-latest
steps:
- name: Cache XPDF binary
id: cache-xpdf
uses: actions/cache@v4
with:
path: pdftopng
key: xpdf-binary-v1
- name: Download XPDF
if: steps.cache-xpdf.outputs.cache-hit != 'true'
run: |
curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz
tar -xvzf ./xpdf-tools-linux-4.05.tar.gz
mv xpdf-tools-linux-4.05/bin64/pdftopng pdftopng

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-v1
- name: Download MuPDF
if: steps.cache-mupdf.outputs.cache-hit != 'true'
run: |
curl -LO https://mupdf.com/downloads/archive/mupdf-1.24.8-source.tar.gz
tar -xvzf ./mupdf-1.24.8-source.tar.gz
- name: Build MuPDF
if: steps.cache-mupdf.outputs.cache-hit != 'true'
run: |
cd mupdf-1.24.8-source
make HAVE_X11=no HAVE_GLUT=no
- name: Finish
if: steps.cache-mupdf.outputs.cache-hit != 'true'
run: mv mupdf-1.24.8-source/build/release/mutool mutool

tests:
name: Tests
runs-on: ubuntu-latest
needs: [xpdf, pdfium, mupdf]
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
id: cache-xpdf
with:
path: pdftopng
key: xpdf-binary-v1

- uses: actions/cache@v4
with:
path: pdfium
key: pdfium-binary-v1

- uses: actions/cache@v4
with:
path: mutool
key: mupdf-binary-v1

- 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 pdftopng
sudo chmod +x pdfium
sudo chmod +x mutool
echo "XPDF_BIN=$(pwd)/pdftopng" >> $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 --release

- name: Run tests
run: cargo test --release
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resvg = {git = "https://github.com/LaurenzV/resvg", rev = "1c2b6bd0"}
siphasher = "1.0.1"
skrifa = {git="https://github.com/LaurenzV/fontations", rev="0ed7955"}
tiny-skia = "0.11.4"
subsetter = {path = "../subsetter"}
subsetter = {git = "https://github.com/typst/subsetter/", rev="67bde74"}
tiny-skia-path = {git = "https://github.com/RazrFalcon/tiny-skia", rev="eec0a47"}
usvg = {git = "https://github.com/LaurenzV/resvg", rev="1c2b6bd0"}
cosmic-text = {git = "https://github.com/pop-os/cosmic-text", rev = "6f78d23"}
Expand All @@ -26,6 +26,6 @@ tiny-skia-path = {git = "https://github.com/RazrFalcon/tiny-skia", rev="eec0a47"
[dev-dependencies]
difference = "2.0.0"
paste = "1.0.15"
sitro = {git = "https://github.com/LaurenzV/sitro", rev="87c0d14"}
sitro = {git = "https://github.com/LaurenzV/sitro", rev = "9b8b1fb"}


1 change: 1 addition & 0 deletions src/font/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mod tests {

use std::sync::Arc;

#[ignore]
#[test]
fn sbix_apple_color() {
let font_data = std::fs::read("/System/Library/Fonts/Apple Color Emoji.ttc").unwrap();
Expand Down
3 changes: 3 additions & 0 deletions src/font/colr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ mod tests {

use std::sync::Arc;

#[ignore]
#[test]
fn colr_test() {
let font_data =
Expand All @@ -340,12 +341,14 @@ mod tests {
draw(Arc::new(font_data), Some(glyphs), "colr_test");
}

#[ignore]
#[test]
fn noto_color() {
let font_data = std::fs::read("/Library/Fonts/NotoColorEmoji-Regular.ttf").unwrap();
draw(Arc::new(font_data), None, "colr_noto");
}

#[ignore]
#[test]
fn segoe_emoji() {
let font_data = std::fs::read("/Library/Fonts/seguiemj.ttf").unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/font/cosmic_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod tests {
use skrifa::GlyphId;
use std::sync::Arc;

#[ignore]
#[test]
fn cosmic_text_integration() {
let mut font_system = FontSystem::new_with_fonts([Source::Binary(Arc::new(std::fs::read("/Users/lstampfl/Programming/GitHub/resvg/crates/resvg/tests/fonts/NotoSans-Regular.ttf").unwrap()))]);
Expand Down
1 change: 1 addition & 0 deletions src/font/outline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ mod tests {
use std::sync::Arc;

// This will not use Type3
#[ignore]
#[test]
fn outline_noto_sans() {
let font_data = std::fs::read("/Library/Fonts/NotoSans-Regular.ttf").unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/font/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mod tests {
use crate::font::draw;
use std::sync::Arc;

#[ignore]
#[test]
fn svg_twitter() {
let font_data = std::fs::read("/Library/Fonts/TwitterColorEmoji-SVGinOT.ttf").unwrap();
Expand Down
4 changes: 1 addition & 3 deletions src/object/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ impl RegisterableObject for Page {}

#[cfg(test)]
mod tests {
use crate::object::mask::Mask;
use crate::object::page::Page;
use crate::rgb::Rgb;
use crate::serialize::{SerializeSettings, SerializerContext};
use crate::surface::StreamBuilder;
use crate::test_utils::check_snapshot;
use crate::{rgb, Fill, MaskType, Paint};
use crate::Fill;
use tiny_skia_path::{PathBuilder, Rect, Size};
use usvg::NormalizedF32;

#[test]
fn simple_page() {
Expand Down
14 changes: 7 additions & 7 deletions tests/visreg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ macro_rules! generate_renderer_tests {
$test_body(renderer);
}

#[cfg(target_os = "macos")]
#[test]
fn [<$test_name _quartz>]() {
let renderer = Renderer::QuartzRenderer;
$test_body(renderer);
}

// #[cfg(target_os = "macos")]
// #[test]
// fn [<$test_name _quartz>]() {
// let renderer = Renderer::QuartzRenderer;
// $test_body(renderer);
// }
//
#[test]
fn [<$test_name _pdfjs>]() {
let renderer = Renderer::PdfjsRenderer;
Expand Down