From 5cd397aa538acda5bfa41978ad07d13630dc2675 Mon Sep 17 00:00:00 2001 From: EtiennePelletier Date: Mon, 23 Sep 2024 12:39:10 -0400 Subject: [PATCH] Improve tests to use all image files, run on push --- .github/workflows/test.yml | 6 +++--- Makefile | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2819db..53ca6c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ name: Test on: + - push - pull_request jobs: @@ -46,9 +47,8 @@ jobs: - name: Run in debug and color mode run: | - find exif-samples-master -name *.tiff -o -name *.jpg -o -name *.heif | xargs EXIF.py -dc + make run - name: Compare image processing output run: | - find exif-samples-master -name *.tiff -o -name *.jpg -o -name *.heif | sort -f | xargs EXIF.py > exif-samples-master/dump_test - diff -Z --side-by-side --suppress-common-lines exif-samples-master/dump exif-samples-master/dump_test + make compare diff --git a/Makefile b/Makefile index d5c8f22..bafca76 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ else PIP_INSTALL := $(PIP_BIN) install --progress-bar=off endif +# Find images, support multiple case insensitive extensions and file names with spaces, consistently sort files +FIND_IMAGES := find exif-samples-master -regextype posix-egrep -iregex ".*\.(bmp|gif|heic|heif|jpg|jpeg|png|tiff|webp)" -print0 | LC_COLLATE=C sort -fz | xargs -0 + .PHONY: help all: help @@ -41,6 +44,13 @@ samples-download: ## Install sample files used for testing. wget https://github.com/ianare/exif-samples/archive/master.tar.gz tar -xzf master.tar.gz +run: ## Run EXIF.py on sample images + $(FIND_IMAGES) EXIF.py -dc + +compare: ## Run and compare exif dump + $(FIND_IMAGES) EXIF.py > exif-samples-master/dump_test + diff -Zu --color --suppress-common-lines exif-samples-master/dump exif-samples-master/dump_test + build: ## build distribution rm -fr ./dist $(PYTHON_BIN) setup.py sdist bdist_wheel @@ -53,4 +63,4 @@ help: Makefile @echo "Choose a command to run:" @echo @grep --no-filename -E '^[a-zA-Z_%-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' - @echo + @echo