Circleci project setup (#1)

* Add .circleci/config.yml

* Fix image and deps

* Skip interactive apt-get in CI

* DEBIAN_FRONTEND noninteractive

* Add imagemagick

* Fix typo

* Remove oneshot option from zbarimg in digitallify

* Switch to alpine

* Fix date command to be backward-compatible

* Switch to my beloved arch

* Add noconfig to pacman

* Fix CI pipeline

* Add badge
This commit is contained in:
Alisina Bahadori
2020-09-07 03:10:05 +04:30
committed by GitHub
parent 5a7a3a7c96
commit 5609ed8c12
4 changed files with 34 additions and 3 deletions

28
.circleci/config.yml Normal file
View File

@@ -0,0 +1,28 @@
version: 2.1
# Define the jobs we want to run for this project
jobs:
test:
environment:
FONT: Roboto-Regular
docker:
- image: archlinux
steps:
- run: pacman --noconfirm -Sy qrencode zbar imagemagick git ttf-roboto fontconfig diffutils
- checkout
- run: echo "Running encode and decode tests for paperify"
- run: |
echo "Generating testfine.bin"
dd if=/dev/urandom of=testfile.bin bs=1 count=10240
echo "Test file generated! running paperify.sh"
- run: fc-cache --force
- run: ./paperify.sh testfile.bin
- run: ./digitallify.sh testfile.regen.bin testfile.bin-qr
- run: diff testfile.bin testfile.regen.bin
- run: echo "Tests were successful. diff exit code $?"
# Orchestrate our job run sequence
workflows:
test:
jobs:
- test

View File

@@ -1,5 +1,7 @@
# Paperify
[![CircleCI](https://circleci.com/gh/alisinabh/paperify.svg?style=svg)](https://circleci.com/gh/alisinabh/paperify)
Use QR codes to backup your data on papers.
## Sample

View File

@@ -15,7 +15,7 @@ do
noext=${f%.*}
chunk=$(echo $noext |rev | cut -f 1 -d '-' | rev)
zbarimg --raw -Sbinary --quiet --oneshot $f | head -c 2953 > "$chunk-$noext.chunk"
zbarimg --raw -Sbinary --quiet $f | head -c 2953 > "$chunk-$noext.chunk"
done
cd $cur

View File

@@ -16,13 +16,14 @@ mkdir -p $dir
rm -f $dir/*
sha=$(sha1sum $file | cut -f 1 -d ' ')
date=$(date -u --iso-8601=seconds)
date=$(date -u +%Y-%m-%dT%H:%M:%S+00:00)
cat $file | split -d -b 2953 -a3 - "$dir/$prefix"
cd $dir
count=$(ls | wc -l)
FONT=${FONT:-fixed}
for f in $prefix*
do
@@ -32,7 +33,7 @@ do
out="$f.png"
cat $f | qrencode --8bit -v 40 --size=13 --margin=1 --output "$out"
convert -size 2490x3510 xc:white \( $out -gravity center \) -composite \
-pointsize 72 -gravity northwest -annotate +100+200 "FILE: $filename\n\nCHUNK: $f\n\nTOTAL CHUNKS: $count" \
-font $FONT -pointsize 72 -gravity northwest -annotate +100+200 "FILE: $filename\n\nCHUNK: $f\n\nTOTAL CHUNKS: $count" \
-gravity southwest -pointsize 41 -annotate +100+300 "CHUNK ${f##*-} SHA1: $chunksha\n\nFINAL SHA1: $sha" \
-gravity northeast -pointsize 41 -annotate +100+130 "$date" \
-gravity southeast -pointsize 41 -annotate +100+150 "$comment" \