Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
navidemad committed Aug 1, 2024
1 parent 7bbd990 commit 1b5b19b
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 51 deletions.
21 changes: 15 additions & 6 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
#!/usr/bin/env bash

# bin/compile <build-dir> <cache-dir> <env-dir>
### Configure environment

# Fail hard and fast
set -euo pipefail
set -o errexit # always exit on error
set -o pipefail # don't ignore exit codes when piping output
set -o nounset # fail on unset variables
unset GIT_DIR # Avoid GIT_DIR leak from previous build steps

BUILD_DIR=$1
CACHE_DIR=$2
### Constants

BINARY_NAME="${STACK}.tar.bz2"
BIN_DIR=$(cd "$(dirname "$0")"; pwd)

### Configure directories

BUILD_DIR=${1:-}
CACHE_DIR=${2:-}
ENV_DIR=${3:-}
BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd)

BIN_DIR=$(cd "$(dirname "$0:-")"; pwd)
ROOT_DIR=$(dirname "$BIN_DIR")

function indent() {
Expand Down
50 changes: 19 additions & 31 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
#!/usr/bin/env bash

# bin/test <build-dir> <env-dir>
# env vars are passed in already, so we can ignore the dir

# Fail hard and fast
set -euo pipefail

# Setup Path variables, for later use in the Buildpack.
BIN_DIR=$(cd "$(dirname "$0")"; pwd)
export PATH=/app/.heroku/vendor/bin:$PATH

# unlike a regular app.json "test" script, this one isn't run with the app dir as the CWD
# we `cd` with a default value, so that the script can also be called from inside the app dir (`cd ""` does not change cwd)
cd "${1-}"

function indent() {
Expand All @@ -22,22 +10,22 @@ function indent() {
esac
}

echo "Running tests with images from fixtures folder." >&2
ldconfig -v
magick -list configure | indent
magick -resize 100 fixtures/test.avif fixtures/test-resize.avif | indent
magick -resize 100 fixtures/test.heic fixtures/test-resize.heic | indent
magick -resize 100 fixtures/test.jpg fixtures/test-resize.jpg | indent
magick -resize 100 fixtures/test.jpg webp:fixtures/test-jpg.webp | indent
magick -resize 100 fixtures/test.jpg avif:fixtures/test-jpg.avif | indent
magick -resize 100 fixtures/test.png fixtures/test-resize.png | indent
magick -resize 100 fixtures/test.png webp:fixtures/test-png.webp | indent
magick -resize 100 fixtures/test.png avif:fixtures/test-png.avif | indent
magick -resize 100 fixtures/test.png jxl:fixtures/test-png.jxl | indent
magick -resize 100 fixtures/test.tiff fixtures/test-resize.tiff | indent
magick -resize 100 fixtures/test.tiff webp:fixtures/test-tiff.webp | indent
magick -resize 100 fixtures/test.tiff avif:fixtures/test-tiff.avif | indent
magick -resize 100 fixtures/test.tiff jxl:fixtures/test-tiff.jxl | indent
magick fixtures/jpg-with-metadata.jpg fixtures/jpg-with-metadata.webp | indent
magick -coalesce fixtures/test.gif fixtures/test-gif.webp | indent
magick fixtures/test.jpg -antialias -font DejaVu-Sans -pointsize 20 -gravity Southeast -annotate +15+15 'TEST' fixtures/test-text.jpg | indent
echo "Test" | indent
# ldconfig
# magick -list configure | indent
# magick -resize 100 fixtures/test.avif fixtures/test-resize.avif | indent
# magick -resize 100 fixtures/test.heic fixtures/test-resize.heic | indent
# magick -resize 100 fixtures/test.jpg fixtures/test-resize.jpg | indent
# magick -resize 100 fixtures/test.jpg webp:fixtures/test-jpg.webp | indent
# magick -resize 100 fixtures/test.jpg avif:fixtures/test-jpg.avif | indent
# magick -resize 100 fixtures/test.png fixtures/test-resize.png | indent
# magick -resize 100 fixtures/test.png webp:fixtures/test-png.webp | indent
# magick -resize 100 fixtures/test.png avif:fixtures/test-png.avif | indent
# magick -resize 100 fixtures/test.png jxl:fixtures/test-png.jxl | indent
# magick -resize 100 fixtures/test.tiff fixtures/test-resize.tiff | indent
# magick -resize 100 fixtures/test.tiff webp:fixtures/test-tiff.webp | indent
# magick -resize 100 fixtures/test.tiff avif:fixtures/test-tiff.avif | indent
# magick -resize 100 fixtures/test.tiff jxl:fixtures/test-tiff.jxl | indent
# magick fixtures/jpg-with-metadata.jpg fixtures/jpg-with-metadata.webp | indent
# magick -coalesce fixtures/test.gif fixtures/test-gif.webp | indent
# magick fixtures/test.jpg -antialias -font DejaVu-Sans -pointsize 20 -gravity Southeast -annotate +15+15 'TEST' fixtures/test-text.jpg | indent
14 changes: 3 additions & 11 deletions bin/test-compile
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash
# usage: bin/test-compile <build-dir> <cache-dir> <env-dir>

# bin/test-compile <build-dir> <cache-dir> <env-dir>

# fail hard
set -o pipefail

# fail harder
set -eu

bp_dir=$(cd $(dirname $0); cd ..; pwd)
source $bp_dir/bin/compile
"$(dirname ${0:-})/compile" "$1" "$2" "$3"
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

# Fail hard and fast
set -euo pipefail
set -o errexit # always exit on error
set -o pipefail # don't ignore exit codes when piping output
set -o nounset # fail on unset variables

# Remove existing builds and configuration logs so that unsupported stacks are automatically removed
rm -rf ./build/*.tar.bz2 ./build/configurations/*.log 2> /dev/null || true
Expand Down
Binary file modified build/heroku-24.tar.bz2
Binary file not shown.
5 changes: 4 additions & 1 deletion check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

set -o errexit # always exit on error
set -o pipefail # don't ignore exit codes when piping output
set -o nounset # fail on unset variables

COMPILE_VERSION_LIBTIFF=$(cat container/Dockerfile | egrep -o 'COMPILE_VERSION_LIBTIFF=([a-zA-Z0-9.-]+)' | cut -f 2 -d =)
COMPILE_VERSION_LIBWEBP=$(cat container/Dockerfile | egrep -o 'COMPILE_VERSION_LIBWEBP=([0-9.-]+)' | cut -f 2 -d =)
Expand Down
2 changes: 2 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ WORKDIR /usr/local/src
RUN set -ex \
&& apt-get update -y -qq \
&& apt-get install --no-install-recommends -y --allow-remove-essential \
libtool \
build-essential \
pkg-config \
ninja-build \
yasm \
Expand Down

0 comments on commit 1b5b19b

Please sign in to comment.