From 98f828977eff9dde8c120765021bc696fe23b876 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:21:35 +0200 Subject: [PATCH 01/54] try 1 --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++ tests/visreg.rs | 60 ++++++++++++++++++++-------------------- 2 files changed, 64 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f009104c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: Continuous integration +on: [push, pull_request] + +env: + RUSTFLAGS: "-Dwarnings" + RUSTDOCFLAGS: "-Dwarnings" + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + 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 + + - name: Get pdfium + 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 + mv ./pdfium-linux-x64/lib/libpdfium.so ./tests/pdfium + + - name: Run tests + id: tests + run: cargo test --release diff --git a/tests/visreg.rs b/tests/visreg.rs index dc7628fc..3a4e6565 100644 --- a/tests/visreg.rs +++ b/tests/visreg.rs @@ -52,36 +52,36 @@ macro_rules! generate_renderer_tests { $test_body(renderer); } - #[test] - fn [<$test_name _mupdf>]() { - let renderer = Renderer::Mupdf; - $test_body(renderer); - } - - #[test] - fn [<$test_name _xpdf>]() { - let renderer = Renderer::Xpdf; - $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; - $test_body(renderer); - } - - #[test] - fn [<$test_name _pdfbox>]() { - let renderer = Renderer::PdfboxRenderer; - $test_body(renderer); - } + // #[test] + // fn [<$test_name _mupdf>]() { + // let renderer = Renderer::Mupdf; + // $test_body(renderer); + // } + // + // #[test] + // fn [<$test_name _xpdf>]() { + // let renderer = Renderer::Xpdf; + // $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; + // $test_body(renderer); + // } + // + // #[test] + // fn [<$test_name _pdfbox>]() { + // let renderer = Renderer::PdfboxRenderer; + // $test_body(renderer); + // } } }; } From d7a4c1d940f98198c5b4fc9726fad64dfabf0037 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:22:45 +0200 Subject: [PATCH 02/54] try 2 --- Cargo.lock | 1 + Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index e86e8812..686d1de4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -868,6 +868,7 @@ dependencies = [ [[package]] name = "subsetter" version = "0.11.0" +source = "git+https://github.com/typst/subsetter/?rev=67bde74#67bde74c76a3d3a27b4f4f3f62cfc553ce965443" [[package]] name = "svgtypes" diff --git a/Cargo.toml b/Cargo.toml index ed3be421..268fdf8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"} From 8cd155bcff6658e58670eddac67a01e275278044 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:25:27 +0200 Subject: [PATCH 03/54] try 3 --- src/object/page.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/object/page.rs b/src/object/page.rs index cfcab57d..2963cf22 100644 --- a/src/object/page.rs +++ b/src/object/page.rs @@ -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() { From d2f3f1de99abe14922ad2c4adde68f9382ce9d3e Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:29:18 +0200 Subject: [PATCH 04/54] disable some tests --- src/font/bitmap.rs | 1 + src/font/colr.rs | 3 +++ src/font/cosmic_text.rs | 1 + src/font/outline.rs | 1 + src/font/svg.rs | 1 + 5 files changed, 7 insertions(+) diff --git a/src/font/bitmap.rs b/src/font/bitmap.rs index 80e40081..26223977 100644 --- a/src/font/bitmap.rs +++ b/src/font/bitmap.rs @@ -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(); diff --git a/src/font/colr.rs b/src/font/colr.rs index 77985450..d03b093e 100644 --- a/src/font/colr.rs +++ b/src/font/colr.rs @@ -327,6 +327,7 @@ mod tests { use std::sync::Arc; + #[ignore] #[test] fn colr_test() { let font_data = @@ -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(); diff --git a/src/font/cosmic_text.rs b/src/font/cosmic_text.rs index bb863798..add62ff8 100644 --- a/src/font/cosmic_text.rs +++ b/src/font/cosmic_text.rs @@ -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()))]); diff --git a/src/font/outline.rs b/src/font/outline.rs index 3eaeb37f..d6ac76f6 100644 --- a/src/font/outline.rs +++ b/src/font/outline.rs @@ -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(); diff --git a/src/font/svg.rs b/src/font/svg.rs index 24789342..7cb443f6 100644 --- a/src/font/svg.rs +++ b/src/font/svg.rs @@ -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(); From 1a4441822af4308f27dd2c5ff54ba34244af5fee Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:36:30 +0200 Subject: [PATCH 05/54] next try --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f009104c..37661727 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,19 @@ jobs: tar -xvzf ./pdfium-linux-x64.tgz -C pdfium-linux-x64 mv ./pdfium-linux-x64/lib/libpdfium.so ./tests/pdfium + - name: Clone sitro repository + run: | + git clone https://github.com/LaurenzV/sitro + cd sitro/src/pdfium + + - name: Build pdfium binary + run: | + cd sitro/src/pdfium + cargo run --release + + - name: Set PDFIUM_BIN environment variable + run: echo "PDFIUM_BIN=$(pwd)/sitro/target/release/pdfium" >> $GITHUB_ENV + - name: Run tests id: tests run: cargo test --release From 475e70b320c1c99b5c06e19d87a2e2f009cec9ba Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:39:56 +0200 Subject: [PATCH 06/54] next try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37661727..8dd3c0c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: 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 - mv ./pdfium-linux-x64/lib/libpdfium.so ./tests/pdfium + mv ./pdfium-linux-x64/lib/libpdfium.so ./usr/lib - name: Clone sitro repository run: | From e220ade2e741260682b80a319a061aebfa6a5289 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:42:59 +0200 Subject: [PATCH 07/54] next try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8dd3c0c9..24be2e72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: 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 - mv ./pdfium-linux-x64/lib/libpdfium.so ./usr/lib + mv ./pdfium-linux-x64/lib/libpdfium.so usr/lib - name: Clone sitro repository run: | From 510e9ad39a96608b464b50f6cc5372cdf7bb25df Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:44:33 +0200 Subject: [PATCH 08/54] next try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24be2e72..9363a436 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: 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 - mv ./pdfium-linux-x64/lib/libpdfium.so usr/lib + mv ./pdfium-linux-x64/lib/libpdfium.so /usr/lib - name: Clone sitro repository run: | From 2e2a933faba6040f282713cf3674186df21968a3 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:46:17 +0200 Subject: [PATCH 09/54] next try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9363a436..7059dea8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: 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 - mv ./pdfium-linux-x64/lib/libpdfium.so /usr/lib + mv ./pdfium-linux-x64/lib/libpdfium.so /usr/local/lib - name: Clone sitro repository run: | From 2131aabc3494e3c7680f0f03e14de86ccf486874 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:53:12 +0200 Subject: [PATCH 10/54] next try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7059dea8..4f500878 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: 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 - mv ./pdfium-linux-x64/lib/libpdfium.so /usr/local/lib + sudo mv ./pdfium-linux-x64/lib/libpdfium.so /usr/lib - name: Clone sitro repository run: | From 0c9d86ec594ab4c907e73743121f5242fe16699d Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 18:55:05 +0200 Subject: [PATCH 11/54] next try --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f500878..856775c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - name: Build pdfium binary run: | cd sitro/src/pdfium - cargo run --release + cargo build --release - name: Set PDFIUM_BIN environment variable run: echo "PDFIUM_BIN=$(pwd)/sitro/target/release/pdfium" >> $GITHUB_ENV From d2cab5d66d5d13c195702fc9e9e6a2df275fbd8c Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:13:42 +0200 Subject: [PATCH 12/54] add xpdf --- tests/visreg.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/visreg.rs b/tests/visreg.rs index 3a4e6565..d73fb43f 100644 --- a/tests/visreg.rs +++ b/tests/visreg.rs @@ -58,11 +58,11 @@ macro_rules! generate_renderer_tests { // $test_body(renderer); // } // - // #[test] - // fn [<$test_name _xpdf>]() { - // let renderer = Renderer::Xpdf; - // $test_body(renderer); - // } + #[test] + fn [<$test_name _xpdf>]() { + let renderer = Renderer::Xpdf; + $test_body(renderer); + } // #[cfg(target_os = "macos")] // #[test] From c28e1d71e7469535171ba0b955a197b3e1d31b9f Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:16:58 +0200 Subject: [PATCH 13/54] download xpdf --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 856775c0..c11e2846 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,13 @@ jobs: tar -xvzf ./pdfium-linux-x64.tgz -C pdfium-linux-x64 sudo mv ./pdfium-linux-x64/lib/libpdfium.so /usr/lib + - name: Get xpdf + run: | + curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz + mkdir xpdf + tar -xvzf ./xpdf-tools-linux-4.05.tar.gz -C xpdf + echo "XPDF_BIN=$(pwd)/xpdf/bin64/pdftopng" >> $GITHUB_ENV + - name: Clone sitro repository run: | git clone https://github.com/LaurenzV/sitro From f4fb48b6dc2c1f621aa0c2f877a408ecbca7d626 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:18:31 +0200 Subject: [PATCH 14/54] Split build and test --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c11e2846..3a4c792d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,8 @@ jobs: - name: Set PDFIUM_BIN environment variable run: echo "PDFIUM_BIN=$(pwd)/sitro/target/release/pdfium" >> $GITHUB_ENV + - name: Build + run: cargo build --release + - name: Run tests - id: tests run: cargo test --release From e32a9264090d31ec87f6ecf26d8ea68120f3dc98 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:24:21 +0200 Subject: [PATCH 15/54] next --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a4c792d..eeba0976 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,12 +34,12 @@ jobs: curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz mkdir xpdf tar -xvzf ./xpdf-tools-linux-4.05.tar.gz -C xpdf + ls $(pwd)/xpdf/bin64 echo "XPDF_BIN=$(pwd)/xpdf/bin64/pdftopng" >> $GITHUB_ENV - name: Clone sitro repository run: | git clone https://github.com/LaurenzV/sitro - cd sitro/src/pdfium - name: Build pdfium binary run: | From 3113affa79f23aa31df7503d96a84551f4192307 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:27:58 +0200 Subject: [PATCH 16/54] debug --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eeba0976..66199f74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,9 @@ jobs: - name: Get xpdf run: | curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz - mkdir xpdf tar -xvzf ./xpdf-tools-linux-4.05.tar.gz -C xpdf + echo $(pwd) + ls . ls $(pwd)/xpdf/bin64 echo "XPDF_BIN=$(pwd)/xpdf/bin64/pdftopng" >> $GITHUB_ENV From 08ac0c62421cdaf3a667ab09770f244366f00af0 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:29:34 +0200 Subject: [PATCH 17/54] debug --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66199f74..c8cfd48d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,9 +32,13 @@ jobs: - name: Get xpdf run: | curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz + mkdir xpdf tar -xvzf ./xpdf-tools-linux-4.05.tar.gz -C xpdf + pwd echo $(pwd) ls . + ls ./xpdf + ls ./xpdf/bin64 ls $(pwd)/xpdf/bin64 echo "XPDF_BIN=$(pwd)/xpdf/bin64/pdftopng" >> $GITHUB_ENV From ca0ee20f46107b9615d49a4c24ec26ef2e1f2863 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:32:30 +0200 Subject: [PATCH 18/54] debug next --- .github/workflows/ci.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8cfd48d..311453dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,15 +32,9 @@ jobs: - name: Get xpdf run: | curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz - mkdir xpdf - tar -xvzf ./xpdf-tools-linux-4.05.tar.gz -C xpdf - pwd - echo $(pwd) - ls . - ls ./xpdf - ls ./xpdf/bin64 - ls $(pwd)/xpdf/bin64 - echo "XPDF_BIN=$(pwd)/xpdf/bin64/pdftopng" >> $GITHUB_ENV + tar -xvzf ./xpdf-tools-linux-4.05.tar.gz + ls $(pwd)/xpdf-tools-linux-4.05/bin64 + echo "XPDF_BIN=$(pwd)/xpdf-tools-linux-4.05/bin64/pdftopng" >> $GITHUB_ENV - name: Clone sitro repository run: | From d2f161da3fc1bf69e26e0a8ccecca4f822852173 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:39:27 +0200 Subject: [PATCH 19/54] try cache --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 311453dd..7b866e04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,25 +22,50 @@ jobs: - name: Get Rust cache uses: Swatinem/rust-cache@v2 + - name: Cache PDFium binaries + id: pdfium-cache + uses: actions/cache@v3 + with: + path: pdfium-linux-x64 + key: pdfium-5880 + - name: Get pdfium + if: steps.pdfium-cache.outputs.cache-hit != 'true' 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 + - name: Cache XPDF binaries + id: xpdf-cache + uses: actions/cache@v3 + with: + path: xpdf-tools-linux-4.05 + key: xpdf-4.05 + - name: Get xpdf + if: steps.xpdf-cache.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 ls $(pwd)/xpdf-tools-linux-4.05/bin64 echo "XPDF_BIN=$(pwd)/xpdf-tools-linux-4.05/bin64/pdftopng" >> $GITHUB_ENV + - name: Cache sitro repository and PDFium build + id: sitro-cache + uses: actions/cache@v3 + with: + path: sitro + key: sitro-1 + - name: Clone sitro repository + if: steps.sitro-cache.outputs.cache-hit != 'true' run: | git clone https://github.com/LaurenzV/sitro - name: Build pdfium binary + if: steps.sitro-cache.outputs.cache-hit != 'true' run: | cd sitro/src/pdfium cargo build --release From 18f2f7578de7beef9ab6169d295a1b998425ab69 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 19:47:48 +0200 Subject: [PATCH 20/54] does the cache work? --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b866e04..56a0a93e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,5 +76,5 @@ jobs: - name: Build run: cargo build --release - - name: Run tests + - name: Run testss run: cargo test --release From 3a01d76bb960882cecbaebedaacb664a02647676 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:17:00 +0200 Subject: [PATCH 21/54] test xpdf upload --- .github/workflows/ci.yml | 115 ++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56a0a93e..ced35a76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,75 +6,56 @@ env: RUSTDOCFLAGS: "-Dwarnings" jobs: - tests: - name: Tests + pdfium: + name: XPDF runs-on: ubuntu-latest - 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 - - - name: Cache PDFium binaries - id: pdfium-cache - uses: actions/cache@v3 - with: - path: pdfium-linux-x64 - key: pdfium-5880 - - - name: Get pdfium - if: steps.pdfium-cache.outputs.cache-hit != 'true' - 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 - - - name: Cache XPDF binaries - id: xpdf-cache - uses: actions/cache@v3 - with: - path: xpdf-tools-linux-4.05 - key: xpdf-4.05 - - - name: Get xpdf - if: steps.xpdf-cache.outputs.cache-hit != 'true' - run: | + - run: | curl -LO https://dl.xpdfreader.com/xpdf-tools-linux-4.05.tar.gz tar -xvzf ./xpdf-tools-linux-4.05.tar.gz - ls $(pwd)/xpdf-tools-linux-4.05/bin64 - echo "XPDF_BIN=$(pwd)/xpdf-tools-linux-4.05/bin64/pdftopng" >> $GITHUB_ENV - - - name: Cache sitro repository and PDFium build - id: sitro-cache - uses: actions/cache@v3 + - name: Upload binary + uses: actions/upload-artifact@v4 with: - path: sitro - key: sitro-1 - - - name: Clone sitro repository - if: steps.sitro-cache.outputs.cache-hit != 'true' - run: | - git clone https://github.com/LaurenzV/sitro - - - name: Build pdfium binary - if: steps.sitro-cache.outputs.cache-hit != 'true' - run: | - cd sitro/src/pdfium - cargo build --release - - - name: Set PDFIUM_BIN environment variable - run: echo "PDFIUM_BIN=$(pwd)/sitro/target/release/pdfium" >> $GITHUB_ENV - - - name: Build - run: cargo build --release - - - name: Run testss - run: cargo test --release + name: pdftopng + path: | + xpdf-tools-linux-4.05/bin64/pdftopng +# tests: +# name: Tests +# runs-on: ubuntu-latest +# 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 +# +# - name: Get pdfium +# 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 +# +# - name: Clone sitro repository +# run: | +# git clone https://github.com/LaurenzV/sitro +# +# - name: Build pdfium binary +# run: | +# cd sitro/src/pdfium +# cargo build --release +# +# - name: Set PDFIUM_BIN environment variable +# run: echo "PDFIUM_BIN=$(pwd)/sitro/target/release/pdfium" >> $GITHUB_ENV +# +# - name: Build +# run: cargo build --release +# +# - name: Run testss +# run: cargo test --release From 372d2647d778cfe4b58d80f5fa4c860ec5f9d895 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:32:30 +0200 Subject: [PATCH 22/54] try workflow --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ced35a76..0dcacade 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ env: RUSTDOCFLAGS: "-Dwarnings" jobs: - pdfium: + xpdf: name: XPDF runs-on: ubuntu-latest steps: @@ -19,22 +19,28 @@ jobs: name: pdftopng path: | xpdf-tools-linux-4.05/bin64/pdftopng -# tests: -# name: Tests -# runs-on: ubuntu-latest -# 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 -# + tests: + name: Tests + runs-on: ubuntu-latest + needs: xpdf + 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 + + - name: Download pdftopng binary + uses: actions/download-artifact@v4 + with: + name: pdftopng + path: . # - name: Get pdfium # run: | # curl -LO https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F5880/pdfium-linux-x64.tgz @@ -51,11 +57,11 @@ jobs: # cd sitro/src/pdfium # cargo build --release # -# - name: Set PDFIUM_BIN environment variable -# run: echo "PDFIUM_BIN=$(pwd)/sitro/target/release/pdfium" >> $GITHUB_ENV -# -# - name: Build -# run: cargo build --release -# -# - name: Run testss -# run: cargo test --release + - name: Set env variable + run: echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV + + - name: Build + run: cargo build --release + + - name: Run testss + run: cargo test --release From 62050b325cac1e8069a6913ba9725ca8cc8707e3 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:37:03 +0200 Subject: [PATCH 23/54] next try --- .github/workflows/ci.yml | 4 +++- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dcacade..cf74d6e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,9 @@ jobs: # cargo build --release # - name: Set env variable - run: echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV + run: | + ls . + echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV - name: Build run: cargo build --release diff --git a/Cargo.toml b/Cargo.toml index 268fdf8f..0d9a6692 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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="ad6ef25"} From 3d8144b69fa071a81a2b88bd6d897fd4c93c2d5a Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:38:41 +0200 Subject: [PATCH 24/54] next try --- .github/workflows/ci.yml | 2 +- Cargo.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf74d6e3..0d378e78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: # - name: Set env variable run: | - ls . + sudo chmod +x pdftopng echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV - name: Build diff --git a/Cargo.lock b/Cargo.lock index 686d1de4..e333b832 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -796,7 +796,7 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "sitro" version = "0.1.0" -source = "git+https://github.com/LaurenzV/sitro?rev=87c0d14#87c0d145f20b7cec36a50109ccfbfc9612991587" +source = "git+https://github.com/LaurenzV/sitro?rev=ad6ef25#ad6ef250932bc3a898538ac4c6312bb4a54a03e3" dependencies = [ "image 0.24.9", "imagesize", From b052e94abbd34e91dee112b912e5a15507083af8 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:43:18 +0200 Subject: [PATCH 25/54] next try --- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d378e78..5a80c041 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,23 @@ jobs: name: pdftopng path: | xpdf-tools-linux-4.05/bin64/pdftopng + pdfium: + runs-on: ubuntu-latest + steps: + - name: Clone sitro + run: | + git clone https://github.com/LaurenzV/sitro + - name: Build pdfium + run: | + cd sitro/src/pdfium + cargo build --release + - name: Upload binary + - uses: actions/upload-artifact@v4 + with: + name: pdfium + path: | + sitro/target/release/pdfium + tests: name: Tests runs-on: ubuntu-latest @@ -36,31 +53,31 @@ jobs: - name: Get Rust cache uses: Swatinem/rust-cache@v2 - - name: Download pdftopng binary + - name: Download pdftopng uses: actions/download-artifact@v4 with: name: pdftopng path: . -# - name: Get pdfium -# 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 -# -# - name: Clone sitro repository -# run: | -# git clone https://github.com/LaurenzV/sitro -# -# - name: Build pdfium binary -# run: | -# cd sitro/src/pdfium -# cargo build --release -# - - name: Set env variable + + - name: Download pdfium + uses: actions/download-artifact@v4 + with: + name: pdfium + path: . + - name: Get 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 pdfium-linux-x64.tgz + rm pdfium-linux-x64 + + - name: Setup run: | sudo chmod +x pdftopng echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV + echo "PDFIUM_BIN=$(pwd)/pdfium" >> $GITHUB_ENV - name: Build run: cargo build --release From 251815d0f592907c2338675da1930bec2ba0554d Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:45:31 +0200 Subject: [PATCH 26/54] next try --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a80c041..f1470023 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,8 @@ jobs: run: | cd sitro/src/pdfium cargo build --release - - name: Upload binary - - uses: actions/upload-artifact@v4 + - name: Upload binary + uses: actions/upload-artifact@v4 with: name: pdfium path: | @@ -39,7 +39,7 @@ jobs: tests: name: Tests runs-on: ubuntu-latest - needs: xpdf + needs: [xpdf, pdfium] defaults: run: shell: bash From af2cda2b9b23d88b9820052feb78fa10cc415e51 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:47:15 +0200 Subject: [PATCH 27/54] next try --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1470023..fe9c3d87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,8 +70,8 @@ jobs: 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 pdfium-linux-x64.tgz - rm pdfium-linux-x64 + rm -r pdfium-linux-x64.tgz + rm -r pdfium-linux-x64 - name: Setup run: | From 9258df6a391e68d6783845df126c69cabcb9da4b Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:49:31 +0200 Subject: [PATCH 28/54] next try --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe9c3d87..ec877755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,6 +76,7 @@ jobs: - name: Setup run: | sudo chmod +x pdftopng + sudo chmod +x pdfium echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV echo "PDFIUM_BIN=$(pwd)/pdfium" >> $GITHUB_ENV From 8b198c2b7c1553995b6cf94aaef329d2f9d8aca6 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:54:01 +0200 Subject: [PATCH 29/54] try pdfbox --- .github/workflows/ci.yml | 12 ++++++++++++ tests/visreg.rs | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec877755..f5ea9c2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,11 @@ jobs: - name: Get Rust cache uses: Swatinem/rust-cache@v2 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Download pdftopng uses: actions/download-artifact@v4 with: @@ -64,6 +69,7 @@ jobs: with: name: pdfium path: . + - name: Get pdfium library run: | curl -LO https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F5880/pdfium-linux-x64.tgz @@ -73,12 +79,18 @@ jobs: rm -r pdfium-linux-x64.tgz rm -r pdfium-linux-x64 + - name: Get pdfium library + run: | + curl -LO https://www.apache.org/dyn/closer.lua/pdfbox/3.0.3/pdfbox-app-3.0.3.jar + mv pdfbox-app-3.0.3.jar pdfbox.jar + - name: Setup run: | sudo chmod +x pdftopng sudo chmod +x pdfium echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV echo "PDFIUM_BIN=$(pwd)/pdfium" >> $GITHUB_ENV + echo "PDFBOX_BIN=$(pwd)/pdfbox" >> $GITHUB_ENV - name: Build run: cargo build --release diff --git a/tests/visreg.rs b/tests/visreg.rs index d73fb43f..c7dbbd3c 100644 --- a/tests/visreg.rs +++ b/tests/visreg.rs @@ -77,11 +77,11 @@ macro_rules! generate_renderer_tests { // $test_body(renderer); // } // - // #[test] - // fn [<$test_name _pdfbox>]() { - // let renderer = Renderer::PdfboxRenderer; - // $test_body(renderer); - // } + #[test] + fn [<$test_name _pdfbox>]() { + let renderer = Renderer::PdfboxRenderer; + $test_body(renderer); + } } }; } From a2c5b547f9f2c4a808c1baf486c3913c68336b52 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 20:58:35 +0200 Subject: [PATCH 30/54] new try --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5ea9c2f..e859dd68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: rm -r pdfium-linux-x64.tgz rm -r pdfium-linux-x64 - - name: Get pdfium library + - name: Get pdfbox run: | curl -LO https://www.apache.org/dyn/closer.lua/pdfbox/3.0.3/pdfbox-app-3.0.3.jar mv pdfbox-app-3.0.3.jar pdfbox.jar @@ -90,7 +90,7 @@ jobs: sudo chmod +x pdfium echo "XPDF_BIN=$(pwd)/pdftopng" >> $GITHUB_ENV echo "PDFIUM_BIN=$(pwd)/pdfium" >> $GITHUB_ENV - echo "PDFBOX_BIN=$(pwd)/pdfbox" >> $GITHUB_ENV + echo "PDFBOX_BIN=$(pwd)/pdfbox.jar" >> $GITHUB_ENV - name: Build run: cargo build --release From f99d18c74b69ba8dcda9842f6c6d72b419e584fc Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 21:03:06 +0200 Subject: [PATCH 31/54] print dir ocntents --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e859dd68..b05fa9a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,7 @@ jobs: run: | curl -LO https://www.apache.org/dyn/closer.lua/pdfbox/3.0.3/pdfbox-app-3.0.3.jar mv pdfbox-app-3.0.3.jar pdfbox.jar + ls . - name: Setup run: | From 4da644ee2918b0d0f4e391d76bf186ebd83a1052 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 21:09:52 +0200 Subject: [PATCH 32/54] update deps --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e333b832..7f48c1fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -796,7 +796,7 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "sitro" version = "0.1.0" -source = "git+https://github.com/LaurenzV/sitro?rev=ad6ef25#ad6ef250932bc3a898538ac4c6312bb4a54a03e3" +source = "git+https://github.com/LaurenzV/sitro?rev=9b8b1fb#9b8b1fb2d1ef150ba072bebdf168cf582347d106" dependencies = [ "image 0.24.9", "imagesize", diff --git a/Cargo.toml b/Cargo.toml index 0d9a6692..63f1c205 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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="ad6ef25"} +sitro = {git = "https://github.com/LaurenzV/sitro", rev = "9b8b1fb"} From d729772f7ad1f9c9dee5870ce1230a7dfa864327 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 21:12:40 +0200 Subject: [PATCH 33/54] update link --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b05fa9a7..ca5365ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: - name: Get pdfbox run: | - curl -LO https://www.apache.org/dyn/closer.lua/pdfbox/3.0.3/pdfbox-app-3.0.3.jar + 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 . From c2792dd5ce573e174086c9f0ed9ce571663952fb Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 21:53:29 +0200 Subject: [PATCH 34/54] try pdfjs --- .github/workflows/ci.yml | 14 ++++++++++++++ tests/visreg.rs | 12 ++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca5365ac..69aee632 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,10 @@ jobs: java-version: '17' distribution: 'temurin' + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Download pdftopng uses: actions/download-artifact@v4 with: @@ -85,6 +89,15 @@ jobs: 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 @@ -92,6 +105,7 @@ jobs: 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 - name: Build run: cargo build --release diff --git a/tests/visreg.rs b/tests/visreg.rs index c7dbbd3c..033816d6 100644 --- a/tests/visreg.rs +++ b/tests/visreg.rs @@ -71,12 +71,12 @@ macro_rules! generate_renderer_tests { // $test_body(renderer); // } // - // #[test] - // fn [<$test_name _pdfjs>]() { - // let renderer = Renderer::PdfjsRenderer; - // $test_body(renderer); - // } - // + #[test] + fn [<$test_name _pdfjs>]() { + let renderer = Renderer::PdfjsRenderer; + $test_body(renderer); + } + #[test] fn [<$test_name _pdfbox>]() { let renderer = Renderer::PdfboxRenderer; From 58bc010262449b75c57c033306e0438880c13c90 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:01:04 +0200 Subject: [PATCH 35/54] try building mupdf --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69aee632..29a93925 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,11 +35,21 @@ jobs: name: pdfium path: | sitro/target/release/pdfium + mupdf: + runs-on: ubuntu-latest + steps: + - name: Download mupdf + run: | + curl -LO https://mupdf.com/downloads/archive/mupdf-1.24.8-source.tar.gz + tar -xvzf ./mupdf-1.24.8-source.tar.gz + cd mupdf-1.24.8-source.tar.gz + - name: Build mupdf + run: make HAVE_X11=no HAVE_GLUT=no prefix=/usr/local install tests: name: Tests runs-on: ubuntu-latest - needs: [xpdf, pdfium] + needs: [xpdf, pdfium, mupdf] defaults: run: shell: bash From 359827ad99849d117a8b66f3e15629fa4f2f805e Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:03:04 +0200 Subject: [PATCH 36/54] next --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29a93925..dec06ddf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,9 +42,10 @@ jobs: run: | curl -LO https://mupdf.com/downloads/archive/mupdf-1.24.8-source.tar.gz tar -xvzf ./mupdf-1.24.8-source.tar.gz - cd mupdf-1.24.8-source.tar.gz - name: Build mupdf - run: make HAVE_X11=no HAVE_GLUT=no prefix=/usr/local install + run: | + cd mupdf-1.24.8-source + make HAVE_X11=no HAVE_GLUT=no prefix=/usr/local install tests: name: Tests From c1292d2b0e88a266536f4153e7ce3b12e93faaff Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:08:00 +0200 Subject: [PATCH 37/54] next --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dec06ddf..7bbfe144 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,13 @@ jobs: - name: Build mupdf run: | cd mupdf-1.24.8-source - make HAVE_X11=no HAVE_GLUT=no prefix=/usr/local install + make HAVE_X11=no HAVE_GLUT=no + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: mutool + path: | + build/release/mutool tests: name: Tests From 5e6022bfcdec6344a8fd82147da8658c32edc7c2 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:11:57 +0200 Subject: [PATCH 38/54] next --- .github/workflows/ci.yml | 9 ++++++++- tests/visreg.rs | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bbfe144..a319d00e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: with: name: mutool path: | - build/release/mutool + mupdf-1.24.8-source/build/release/mutool tests: name: Tests @@ -91,6 +91,12 @@ jobs: name: pdfium path: . + - name: Download mutool + uses: actions/download-artifact@v4 + with: + name: mutool + path: . + - name: Get pdfium library run: | curl -LO https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F5880/pdfium-linux-x64.tgz @@ -123,6 +129,7 @@ jobs: 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 diff --git a/tests/visreg.rs b/tests/visreg.rs index 033816d6..502f954a 100644 --- a/tests/visreg.rs +++ b/tests/visreg.rs @@ -52,12 +52,12 @@ macro_rules! generate_renderer_tests { $test_body(renderer); } - // #[test] - // fn [<$test_name _mupdf>]() { - // let renderer = Renderer::Mupdf; - // $test_body(renderer); - // } - // + #[test] + fn [<$test_name _mupdf>]() { + let renderer = Renderer::Mupdf; + $test_body(renderer); + } + #[test] fn [<$test_name _xpdf>]() { let renderer = Renderer::Xpdf; From b30f3fcda79b4098d9e6bee522e8b943c9931285 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:18:21 +0200 Subject: [PATCH 39/54] next --- .github/workflows/ci.yml | 48 +++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a319d00e..5963ca9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,48 +10,73 @@ jobs: name: XPDF runs-on: ubuntu-latest steps: - - run: | + - name: Cache XPDF binary + uses: actions/cache@v4 + with: + path: xpdf-tools-linux-4.05/bin64/pdftopng + key: xpdf-binary-v1 + - name: Download XPDF (if not cached) + if: steps.cache.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 - name: Upload binary + if: steps.cache.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: pdftopng - path: | - xpdf-tools-linux-4.05/bin64/pdftopng + path: xpdf-tools-linux-4.05/bin64/pdftopng + pdfium: + name: PDFium runs-on: ubuntu-latest steps: + - name: Cache PDFium binary + uses: actions/cache@v4 + with: + path: sitro/target/release/pdfium + key: pdfium-binary-v1 - name: Clone sitro + if: steps.cache.outputs.cache-hit != 'true' run: | git clone https://github.com/LaurenzV/sitro - - name: Build pdfium + - name: Build pdfium (if not cached) + if: steps.cache.outputs.cache-hit != 'true' run: | cd sitro/src/pdfium cargo build --release - name: Upload binary + if: steps.cache.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: pdfium - path: | - sitro/target/release/pdfium + path: sitro/target/release/pdfium + mupdf: + name: MuPDF runs-on: ubuntu-latest steps: - - name: Download mupdf + - name: Cache MuPDF binary + uses: actions/cache@v4 + with: + path: mupdf-1.24.8-source/build/release/mutool + key: mupdf-binary-v1 + - name: Download MuPDF (if not cached) + if: steps.cache.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 + - name: Build MuPDF (if not cached) + if: steps.cache.outputs.cache-hit != 'true' run: | cd mupdf-1.24.8-source make HAVE_X11=no HAVE_GLUT=no - name: Upload binary + if: steps.cache.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: mutool - path: | - mupdf-1.24.8-source/build/release/mutool + path: mupdf-1.24.8-source/build/release/mutool tests: name: Tests @@ -125,6 +150,7 @@ jobs: 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 @@ -134,5 +160,5 @@ jobs: - name: Build run: cargo build --release - - name: Run testss + - name: Run tests run: cargo test --release From 378178e93971c025ee21788d9515ac4a8452c831 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:23:29 +0200 Subject: [PATCH 40/54] Check if the cache works --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5963ca9b..92a62dba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,7 +122,7 @@ jobs: name: mutool path: . - - name: Get pdfium library + - 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 From 43199244f91211d12478879127cfa8e07432d026 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:30:43 +0200 Subject: [PATCH 41/54] next cache attempt --- .github/workflows/ci.yml | 227 ++++++++++++++++++++------------------- 1 file changed, 114 insertions(+), 113 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92a62dba..5067775d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,133 +32,134 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache PDFium binary + id: cache-pdfium uses: actions/cache@v4 with: path: sitro/target/release/pdfium key: pdfium-binary-v1 - name: Clone sitro - if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache-pdfium.outputs.cache-hit != 'true' run: | git clone https://github.com/LaurenzV/sitro - name: Build pdfium (if not cached) - if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache-pdfium.outputs.cache-hit != 'true' run: | cd sitro/src/pdfium cargo build --release - name: Upload binary - if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache-pdfium.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: pdfium path: sitro/target/release/pdfium - mupdf: - name: MuPDF - runs-on: ubuntu-latest - steps: - - name: Cache MuPDF binary - uses: actions/cache@v4 - with: - path: mupdf-1.24.8-source/build/release/mutool - key: mupdf-binary-v1 - - name: Download MuPDF (if not cached) - if: steps.cache.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 not cached) - if: steps.cache.outputs.cache-hit != 'true' - run: | - cd mupdf-1.24.8-source - make HAVE_X11=no HAVE_GLUT=no - - name: Upload binary - if: steps.cache.outputs.cache-hit != 'true' - uses: actions/upload-artifact@v4 - with: - name: mutool - path: mupdf-1.24.8-source/build/release/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 - - - name: Download pdftopng - uses: actions/download-artifact@v4 - with: - name: pdftopng - path: . - - - name: Download pdfium - uses: actions/download-artifact@v4 - with: - name: pdfium - path: . - - - name: Download mutool - uses: actions/download-artifact@v4 - with: - name: mutool - path: . - - - 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 +# mupdf: +# name: MuPDF +# runs-on: ubuntu-latest +# steps: +# - name: Cache MuPDF binary +# uses: actions/cache@v4 +# with: +# path: mupdf-1.24.8-source/build/release/mutool +# key: mupdf-binary-v1 +# - name: Download MuPDF (if not cached) +# if: steps.cache.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 not cached) +# if: steps.cache.outputs.cache-hit != 'true' +# run: | +# cd mupdf-1.24.8-source +# make HAVE_X11=no HAVE_GLUT=no +# - name: Upload binary +# if: steps.cache.outputs.cache-hit != 'true' +# uses: actions/upload-artifact@v4 +# with: +# name: mutool +# path: mupdf-1.24.8-source/build/release/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 +# +# - name: Download pdftopng +# uses: actions/download-artifact@v4 +# with: +# name: pdftopng +# path: . +# +# - name: Download pdfium +# uses: actions/download-artifact@v4 +# with: +# name: pdfium +# path: . +# +# - name: Download mutool +# uses: actions/download-artifact@v4 +# with: +# name: mutool +# path: . +# +# - 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 From f57a1f5b4e3017121a00af7330ee88f6b78e5a6b Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:31:52 +0200 Subject: [PATCH 42/54] next --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5067775d..f5897c91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,17 +11,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache XPDF binary + id: cache-xpdf uses: actions/cache@v4 with: path: xpdf-tools-linux-4.05/bin64/pdftopng key: xpdf-binary-v1 - name: Download XPDF (if not cached) - if: steps.cache.outputs.cache-hit != 'true' + 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 - name: Upload binary - if: steps.cache.outputs.cache-hit != 'true' + if: steps.cache-xpdf.outputs.cache-hit != 'true' uses: actions/upload-artifact@v4 with: name: pdftopng From 3aa9adc8fc821f0f3de20c27cba06e17fc43e28a Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:33:52 +0200 Subject: [PATCH 43/54] try mupdf cache --- .github/workflows/ci.yml | 51 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5897c91..d4ceae8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,31 +54,32 @@ jobs: name: pdfium path: sitro/target/release/pdfium -# mupdf: -# name: MuPDF -# runs-on: ubuntu-latest -# steps: -# - name: Cache MuPDF binary -# uses: actions/cache@v4 -# with: -# path: mupdf-1.24.8-source/build/release/mutool -# key: mupdf-binary-v1 -# - name: Download MuPDF (if not cached) -# if: steps.cache.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 not cached) -# if: steps.cache.outputs.cache-hit != 'true' -# run: | -# cd mupdf-1.24.8-source -# make HAVE_X11=no HAVE_GLUT=no -# - name: Upload binary -# if: steps.cache.outputs.cache-hit != 'true' -# uses: actions/upload-artifact@v4 -# with: -# name: mutool -# path: mupdf-1.24.8-source/build/release/mutool + mupdf: + name: MuPDF + runs-on: ubuntu-latest + steps: + - name: Cache MuPDF binary + id: cache-mupdf + uses: actions/cache@v4 + with: + path: mupdf-1.24.8-source/build/release/mutool + key: mupdf-binary-v1 + - name: Download MuPDF (if not cached) + 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 not cached) + if: steps.cache-mupdf.outputs.cache-hit != 'true' + run: | + cd mupdf-1.24.8-source + make HAVE_X11=no HAVE_GLUT=no + - name: Upload binary + if: steps.cache-mupdf.outputs.cache-hit != 'true' + uses: actions/upload-artifact@v4 + with: + name: mutool + path: mupdf-1.24.8-source/build/release/mutool # tests: # name: Tests From 79399698a07b85cb623e5c80b8b91ac76d904406 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:35:15 +0200 Subject: [PATCH 44/54] try integration --- .github/workflows/ci.yml | 168 +++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4ceae8e..8a1ab8a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,87 +81,87 @@ jobs: name: mutool path: mupdf-1.24.8-source/build/release/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 -# -# - name: Download pdftopng -# uses: actions/download-artifact@v4 -# with: -# name: pdftopng -# path: . -# -# - name: Download pdfium -# uses: actions/download-artifact@v4 -# with: -# name: pdfium -# path: . -# -# - name: Download mutool -# uses: actions/download-artifact@v4 -# with: -# name: mutool -# path: . -# -# - 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 + 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 + + - name: Download pdftopng + uses: actions/download-artifact@v4 + with: + name: pdftopng + path: . + + - name: Download pdfium + uses: actions/download-artifact@v4 + with: + name: pdfium + path: . + + - name: Download mutool + uses: actions/download-artifact@v4 + with: + name: mutool + path: . + + - 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 From 0e1d21ef01403de87a2d33387018fce037fef491 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:43:12 +0200 Subject: [PATCH 45/54] try again --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a1ab8a5..cb32d926 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,23 +107,23 @@ jobs: with: node-version: 20 - - name: Download pdftopng - uses: actions/download-artifact@v4 + - id: cache-xpdf + uses: actions/cache@v4 with: - name: pdftopng - path: . + path: pdftopng + key: xpdf-binary-v1 - - name: Download pdfium - uses: actions/download-artifact@v4 + - id: cache-pdfium + uses: actions/cache@v4 with: - name: pdfium - path: . + path: pdfium + key: pdfium-binary-v1 - - name: Download mutool - uses: actions/download-artifact@v4 + - id: cache-mupdf + uses: actions/cache@v4 with: - name: mutool - path: . + path: mutool + key: mupdf-binary-v1 - name: Download the pdfium library run: | From 3456e91c79431b1e8f00b7a555114effbcc8c017 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:53:17 +0200 Subject: [PATCH 46/54] next --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb32d926..6a2018ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,20 +107,17 @@ jobs: with: node-version: 20 - - id: cache-xpdf - uses: actions/cache@v4 + - uses: actions/cache@v4 with: path: pdftopng key: xpdf-binary-v1 - - id: cache-pdfium - uses: actions/cache@v4 + - uses: actions/cache@v4 with: path: pdfium key: pdfium-binary-v1 - - id: cache-mupdf - uses: actions/cache@v4 + - uses: actions/cache@v4 with: path: mutool key: mupdf-binary-v1 From 5e00111185c51d1c8a518a695e6e0b7a5f93d0d9 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 22:57:53 +0200 Subject: [PATCH 47/54] whyy --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a2018ad..1b8b6fcc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,6 +108,7 @@ jobs: node-version: 20 - uses: actions/cache@v4 + id: cache-xpdf with: path: pdftopng key: xpdf-binary-v1 From a5ac4f44127c4c8609fcf5f4574a8761a3f4c2a9 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:23:24 +0200 Subject: [PATCH 48/54] debug --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b8b6fcc..908bcde0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: - uses: actions/cache@v4 id: cache-xpdf with: - path: pdftopng + path: xpdf-tools-linux-4.05/bin64/pdftopng key: xpdf-binary-v1 - uses: actions/cache@v4 From 5c0c7b39c70b773a7c5d155463ba478c57c4eaca Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:25:47 +0200 Subject: [PATCH 49/54] debug --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 908bcde0..3e22a8dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,6 +149,7 @@ jobs: - name: Setup run: | + mv xpdf-tools-linux-4.05/bin64/pdftopng pdftopng sudo chmod +x pdftopng sudo chmod +x pdfium sudo chmod +x mutool From 8b3e32d33c52c826d1081b3ecf7b986ed0f982e3 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:29:06 +0200 Subject: [PATCH 50/54] next attemptt --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e22a8dc..07511a51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,12 +115,12 @@ jobs: - uses: actions/cache@v4 with: - path: pdfium + path: sitro/target/release/pdfium key: pdfium-binary-v1 - uses: actions/cache@v4 with: - path: mutool + path: mupdf-1.24.8-source/build/release/mutool key: mupdf-binary-v1 - name: Download the pdfium library @@ -150,6 +150,8 @@ jobs: - name: Setup run: | mv xpdf-tools-linux-4.05/bin64/pdftopng pdftopng + mv sitro/target/release/pdfium pdfium + mv mupdf-1.24.8-source/build/release/mutool mutool sudo chmod +x pdftopng sudo chmod +x pdfium sudo chmod +x mutool From 4f8cd8cfb54edbbb3cb3d2e883eaed2d319ab1c9 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:35:01 +0200 Subject: [PATCH 51/54] next --- .github/workflows/ci.yml | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07511a51..42d8fea2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,19 +14,14 @@ jobs: id: cache-xpdf uses: actions/cache@v4 with: - path: xpdf-tools-linux-4.05/bin64/pdftopng + path: pdftopng key: xpdf-binary-v1 - name: Download XPDF (if not cached) 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 - - name: Upload binary - if: steps.cache-xpdf.outputs.cache-hit != 'true' - uses: actions/upload-artifact@v4 - with: - name: pdftopng - path: xpdf-tools-linux-4.05/bin64/pdftopng + mv xpdf-tools-linux-4.05/bin64/pdftopng pdftopng pdfium: name: PDFium @@ -36,7 +31,7 @@ jobs: id: cache-pdfium uses: actions/cache@v4 with: - path: sitro/target/release/pdfium + path: pdfium key: pdfium-binary-v1 - name: Clone sitro if: steps.cache-pdfium.outputs.cache-hit != 'true' @@ -47,12 +42,8 @@ jobs: run: | cd sitro/src/pdfium cargo build --release - - name: Upload binary - if: steps.cache-pdfium.outputs.cache-hit != 'true' - uses: actions/upload-artifact@v4 - with: - name: pdfium - path: sitro/target/release/pdfium + - name: Finish + run: mv sitro/target/release/pdfium pdfium mupdf: name: MuPDF @@ -62,7 +53,7 @@ jobs: id: cache-mupdf uses: actions/cache@v4 with: - path: mupdf-1.24.8-source/build/release/mutool + path: mutool key: mupdf-binary-v1 - name: Download MuPDF (if not cached) if: steps.cache-mupdf.outputs.cache-hit != 'true' @@ -74,12 +65,8 @@ jobs: run: | cd mupdf-1.24.8-source make HAVE_X11=no HAVE_GLUT=no - - name: Upload binary - if: steps.cache-mupdf.outputs.cache-hit != 'true' - uses: actions/upload-artifact@v4 - with: - name: mutool - path: mupdf-1.24.8-source/build/release/mutool + - name: Finish + run: mv mupdf-1.24.8-source/build/release/mutool mutool tests: name: Tests @@ -110,17 +97,17 @@ jobs: - uses: actions/cache@v4 id: cache-xpdf with: - path: xpdf-tools-linux-4.05/bin64/pdftopng + path: pdftopng key: xpdf-binary-v1 - uses: actions/cache@v4 with: - path: sitro/target/release/pdfium + path: pdfium key: pdfium-binary-v1 - uses: actions/cache@v4 with: - path: mupdf-1.24.8-source/build/release/mutool + path: mutool key: mupdf-binary-v1 - name: Download the pdfium library @@ -149,9 +136,6 @@ jobs: - name: Setup run: | - mv xpdf-tools-linux-4.05/bin64/pdftopng pdftopng - mv sitro/target/release/pdfium pdfium - mv mupdf-1.24.8-source/build/release/mutool mutool sudo chmod +x pdftopng sudo chmod +x pdfium sudo chmod +x mutool From 85e807f249ce93c5d5df636f961279ec7a834386 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:41:27 +0200 Subject: [PATCH 52/54] small sanity check --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42d8fea2..cbe47242 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: with: path: pdftopng key: xpdf-binary-v1 - - name: Download XPDF (if not cached) + - 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 @@ -33,11 +33,11 @@ jobs: with: path: pdfium key: pdfium-binary-v1 - - name: Clone sitro + - name: Clone sitro repo if: steps.cache-pdfium.outputs.cache-hit != 'true' run: | git clone https://github.com/LaurenzV/sitro - - name: Build pdfium (if not cached) + - name: Build pdfium if: steps.cache-pdfium.outputs.cache-hit != 'true' run: | cd sitro/src/pdfium @@ -49,18 +49,18 @@ jobs: name: MuPDF runs-on: ubuntu-latest steps: - - name: Cache MuPDF binary + - name: Cache MuPDF id: cache-mupdf uses: actions/cache@v4 with: path: mutool key: mupdf-binary-v1 - - name: Download MuPDF (if not cached) + - 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 not cached) + - name: Build MuPDF if: steps.cache-mupdf.outputs.cache-hit != 'true' run: | cd mupdf-1.24.8-source From 41c0aea84a9cdde02da3e556032d147898f5b2ac Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:43:15 +0200 Subject: [PATCH 53/54] Add missing if --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbe47242..ef0f9994 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: cd sitro/src/pdfium cargo build --release - name: Finish + if: steps.cache-xpdf.outputs.cache-hit != 'true' run: mv sitro/target/release/pdfium pdfium mupdf: @@ -66,6 +67,7 @@ jobs: cd mupdf-1.24.8-source make HAVE_X11=no HAVE_GLUT=no - name: Finish + if: steps.cache-xpdf.outputs.cache-hit != 'true' run: mv mupdf-1.24.8-source/build/release/mutool mutool tests: From 0f17a2adce9e5701b5111aeee0da86d8161801e9 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl Date: Fri, 16 Aug 2024 23:45:28 +0200 Subject: [PATCH 54/54] another... --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef0f9994..80374bbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: cd sitro/src/pdfium cargo build --release - name: Finish - if: steps.cache-xpdf.outputs.cache-hit != 'true' + if: steps.cache-pdfium.outputs.cache-hit != 'true' run: mv sitro/target/release/pdfium pdfium mupdf: @@ -67,7 +67,7 @@ jobs: cd mupdf-1.24.8-source make HAVE_X11=no HAVE_GLUT=no - name: Finish - if: steps.cache-xpdf.outputs.cache-hit != 'true' + if: steps.cache-mupdf.outputs.cache-hit != 'true' run: mv mupdf-1.24.8-source/build/release/mutool mutool tests: