-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests that the script converts an HEIC image as intended
- Loading branch information
1 parent
3b06e42
commit d46bd3f
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Test heif-convert | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test-script: | ||
name: Test Script | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install heif-convert | ||
run: pip3 install . | ||
|
||
- name: Add executable permission to test-script | ||
working-directory: tests | ||
run: chmod +x test-script.sh | ||
|
||
- name: Run Test | ||
working-directory: tests | ||
run: ./test-script.sh | ||
|
||
test-docker-image: | ||
name: Test Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: false | ||
tags: nevermendel/heif-convert | ||
|
||
- name: Add executable permission to test-docker-image | ||
working-directory: tests | ||
run: chmod +x test-docker-image.sh | ||
|
||
- name: Run Test | ||
working-directory: tests | ||
run: ./test-docker-image.sh |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
docker run -v "$(pwd)":/usr/app/out --rm nevermendel/heif-convert image.heic -f jpg -q 90 | ||
docker run -v "$(pwd)":/usr/app/out --rm nevermendel/heif-convert image.heic -f png | ||
|
||
status_code=0 | ||
|
||
expected_jpg_hash="3fb5fff1c6bb5f0f5d76d9839f82564d857e81f71e748da1ec480affde10fa8e" | ||
actual_jpg_hash=$(sha256sum image.jpg | awk '{print $1}') | ||
|
||
if [ "$expected_jpg_hash" != "$actual_jpg_hash" ]; then | ||
echo "JPG image hash differs from expected. Expected: ${expected_jpg_hash}, Actual: ${actual_jpg_hash}" | ||
status_code=1 | ||
fi | ||
|
||
expected_png_hash="f6e29566f59bcce7d0486c9745602354cd903da0dbfce3facb8bba476abeee54" | ||
actual_png_hash=$(sha256sum image.png | awk '{print $1}') | ||
|
||
if [ "$expected_png_hash" != "$actual_png_hash" ]; then | ||
echo "PNG image hash differs from expected. Expected: ${expected_png_hash}, Actual: ${actual_png_hash}" | ||
status_code=1 | ||
fi | ||
|
||
exit $status_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
heif-convert image.heic -f jpg -q 90 | ||
heif-convert image.heic -f png | ||
|
||
status_code=0 | ||
|
||
expected_jpg_hash="3fb5fff1c6bb5f0f5d76d9839f82564d857e81f71e748da1ec480affde10fa8e" | ||
actual_jpg_hash=$(sha256sum image.jpg | awk '{print $1}') | ||
|
||
if [ "$expected_jpg_hash" != "$actual_jpg_hash" ]; then | ||
echo "JPG image hash differs from expected. Expected: ${expected_jpg_hash}, Actual: ${actual_jpg_hash}" | ||
status_code=1 | ||
fi | ||
|
||
expected_png_hash="f6e29566f59bcce7d0486c9745602354cd903da0dbfce3facb8bba476abeee54" | ||
actual_png_hash=$(sha256sum image.png | awk '{print $1}') | ||
|
||
if [ "$expected_png_hash" != "$actual_png_hash" ]; then | ||
echo "PNG image hash differs from expected. Expected: ${expected_png_hash}, Actual: ${actual_png_hash}" | ||
status_code=1 | ||
fi | ||
|
||
exit $status_code |