#!/bin/bash # Exit early. # See: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#The-Set-Builtin. set -e # Source dot env file. source .env # Arguments. version="" platform="" alternate_repository="" dry_run="" while [[ $# -gt 0 ]]; do case $1 in --version) version="${2//v/}" shift 2 ;; --platform) platform="$2" shift 2 ;; --alternate-repository) alternate_repository="$2" shift 2 ;; --dry-run) dry_run="$2" shift 2 ;; *) echo "Unknown option $1" exit 1 ;; esac done echo "Integration testing ๐Ÿงช" echo echo "Gotenberg version: $version" echo "Target platform: $platform" repository=$DOCKER_REPOSITORY if [ -n "$alternate_repository" ]; then echo "โš ๏ธ Using $alternate_repository for DOCKER_REPOSITORY" repository=$alternate_repository fi if [ "$dry_run" = "true" ]; then echo "๐Ÿšง Dry run" fi echo # Test image. run_cmd() { local cmd="$1" if [ "$dry_run" = "true" ]; then echo "๐Ÿšง Dry run - would run the following command:" echo "$cmd" echo else echo "โš™๏ธ Running command:" echo "$cmd" eval "$cmd" echo fi } cmd="make test-integration DOCKER_REPOSITORY=$repository GOTENBERG_VERSION=$version PLATFORM=$platform" run_cmd "$cmd" echo "โœ… Done!" exit 0