Skip to content

Commit

Permalink
CI: test: add testing stage
Browse files Browse the repository at this point in the history
Add a job to exercise the script in CI by generating a throwaway PDF
document and then running shrinkpdf on it.

This will guard against any inadvertent breakage by future commits.
  • Loading branch information
aklomp committed May 23, 2022
1 parent ffe5ca8 commit f1ea65e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test

on: [push]

jobs:
Test:
runs-on: ubuntu-latest
steps:

# Checkout the code.
- name: Checkout
uses: actions/checkout@v3

# Install the test dependencies.
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install ghostscript
sudo apt install librsvg2-bin
sudo apt install texlive-latex-recommended
sudo apt install texlive-latex-extra
sudo apt install pandoc
# Generate a test PDF by using the README as a convenient source.
- name: Generate test PDF
run: pandoc -s -o orig.pdf README.md

# Shrink the PDF.
- name: Shrink the PDF
run: |
chmod +x shrinkpdf.sh
./shrinkpdf.sh orig.pdf new.pdf
ls -al orig.pdf new.pdf
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Shrinkpdf: shrink PDF files with Ghostscript

[![Shellcheck](https://github.com/aklomp/shrinkpdf/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/aklomp/shrinkpdf/actions/workflows/shellcheck.yml)
[![Test](https://github.com/aklomp/shrinkpdf/actions/workflows/test.yml/badge.svg)](https://github.com/aklomp/shrinkpdf/actions/workflows/test.yml)

A simple wrapper around Ghostscript to shrink PDFs (as in reduce filesize)
under Linux. Inspired by some code I found in an OpenOffice Python script (I
Expand Down

0 comments on commit f1ea65e

Please sign in to comment.