diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab2a36c8..6d382cbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,90 +53,115 @@ jobs: if: steps.cache-mupdf.outputs.cache-hit != 'true' run: mv mupdf-1.24.8-source/build/release/mutool mutool - tests: - name: Tests + ghostscript: + name: GhostScript runs-on: ubuntu-latest - needs: [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 - with: - path: pdfium - key: pdfium-binary-v1 - - - uses: actions/cache@v4 - with: - path: mutool - key: mupdf-binary-v1 - - - uses: awalsh128/cache-apt-pkgs-action@latest + - name: Cache GhostScript + id: cache-gs + uses: actions/cache@v4 with: - packages: poppler-utils ghostscript - 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 + path: gs + key: gs-binary-v1 + - name: Download GhostScript + if: steps.cache-gs.outputs.cache-hit != 'true' 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 + curl -LO https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10031/ghostscript-10.03.1.tar.gz + tar -xvzf ./ghostscript-10.03.1.tar.gz + - name: Build GhostScript + if: steps.cache-gs.outputs.cache-hit != 'true' 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=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 - - - name: Upload artifacts - if: failure() - uses: actions/upload-artifact@v3 - with: - path: ./tests/diff + cd ghostscript-10.03.1 + ./configure + make + - name: Finish + if: steps.cache-gs.outputs.cache-hit != 'true' + run: mv ghostscript-10.03.1/bin/gs mutool + +# tests: +# name: Tests +# runs-on: ubuntu-latest +# needs: [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 +# with: +# path: pdfium +# key: pdfium-binary-v1 +# +# - uses: actions/cache@v4 +# with: +# path: mutool +# key: mupdf-binary-v1 +# +# - uses: awalsh128/cache-apt-pkgs-action@latest +# with: +# packages: poppler-utils ghostscript +# 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=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 +# +# - name: Upload artifacts +# if: failure() +# uses: actions/upload-artifact@v3 +# with: +# path: ./tests/diff