Add paperify CI for github actions (#20)

* Add paperify CI for github actions

* Fix checkout in workflow steps

* Switch to ubuntu for gh-actions

* Fix zbar installation using apt in gh-actions

* Fix install roboto fonts in gh-actions

* Remove font config from env in gh-actions

* Readd roboto font with different name gh-actions

* Switch to linuxtv precompiled zbar gh-actions

* Fix superuser privilage in dpkg gh-actions

* Fix libv4l-0 dependency of zbar gh-actions

* Fix libmagick++-dev dependency gh-actions

* Add package workflow for readme image
This commit is contained in:
Alisina Bahadori
2021-04-20 05:09:27 +04:30
committed by GitHub
parent 71dd87a41c
commit 3ee45b6db9
2 changed files with 74 additions and 0 deletions

40
.github/workflows/paperify_ci.yaml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Paperify CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Test paperify
runs-on: ubuntu-latest
env:
FONT: Roboto
IMG_HELP_MESSAGE: "UNPACK: zbarimg --raw -Sbinary -1 FILENAME.jpg | head -c 2953 > paperify.tgz"
steps:
- name: Install packages
run: sudo apt-get install qrencode imagemagick fonts-roboto libv4l-0 libmagick++-dev
- name: Install zbar
run: |
wget -q https://linuxtv.org/downloads/zbar/binaries/zbar-0.23.91-ubuntu-20.04.tar.gz &&
tar -xvf zbar-0.23.91-ubuntu-20.04.tar.gz &&
rm zbar-0.23.91-ubuntu-20.04.tar.gz &&
sudo dpkg -i libzbar0_0.23.91_amd64.deb libzbar-dev_0.23.91_amd64.deb python3-zbar_0.23.91_amd64.deb zbar-tools_0.23.91_amd64.deb &&
rm -rf *.deb
- uses: actions/checkout@v2
- name: Generate test files
run: |
echo "Generating testfine.bin"
dd if=/dev/urandom of=testfile.bin bs=1 count=10240
sha1sum testfile.bin
echo "Test file generated! running paperify.sh"
- name: Paperify
run: ./paperify.sh testfile.bin
- name: Digitallify
run: ./digitallify.sh testfile.regen.bin testfile.bin-qr
- name: Check if both digitallified is same as original
run: diff testfile.bin testfile.regen.bin

34
.github/workflows/paperify_package.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Paperify Package
on:
push:
tags:
- '*'
jobs:
test:
name: Make paperify printable asset
runs-on: ubuntu-latest
env:
FONT: Roboto
IMG_HELP_MESSAGE: "UNPACK: zbarimg --raw -Sbinary -1 FILENAME.jpg | head -c 2953 > paperify.tgz"
steps:
- name: Install packages
run: sudo apt-get install qrencode imagemagick fonts-roboto
- uses: actions/checkout@v2
- name: Package paperify using paperify
run: |
tar cfz paperify.tgz README.md paperify.sh digitallify.sh
./paperify.sh -c "$IMG_HELP_MESSAGE" paperify.tgz
mv paperify.tgz-qr/paperify.tgz-000.png paperify.tgz.png
- name: Ensure paperify is in a single file
run: if [[ $(ls -A paperify.tgz-qr) ]]; then exit 1; fi
- name: Upload paprify package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./paprify.tgz.png
asset_name: paperify.png
asset_content_type: image/png