-
Notifications
You must be signed in to change notification settings - Fork 8
/
build_test.sh
executable file
·42 lines (37 loc) · 1.32 KB
/
build_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# https://www.baeldung.com/linux/bash-expand-relative-path
resolve_relative_path() (
# If the path is a directory, we just need to 'cd' into it and print the new path.
if [ -d "$1" ]; then
cd "$1" || return 1
pwd
# If the path points to anything else, like a file or FIFO
elif [ -e "$1" ]; then
# Strip '/file' from '/dir/file'
# We only change the directory if the name doesn't match for the cases where
# we were passed something like 'file' without './'
if [ ! "${1%/*}" = "$1" ]; then
cd "${1%/*}" || return 1
fi
# Strip all leading slashes upto the filename
echo "$(pwd)/${1##*/}"
else
return 1 # Failure, neither file nor directory exists.
fi
)
# Use bogus file as railsenv - test build phase does not use it
rails_env_file=$(resolve_relative_path "$0")
export RAILS_ENV_FILE="${rails_env_file}"
echo $RAILS_ENV_FILE
selenium_image="seleniarm/standalone-chromium"
SYSTEM_ARCH=$(arch | sed s/aarch64/arm64/)
if [ $SYSTEM_ARCH != 'arm64' ]
then
selenium_image="selenium/standalone-chrome"
fi
export SELENIUM_IMAGE=${selenium_image}
echo $SELENIUM_IMAGE
echo "docker compose -f docker-compose-test.yaml build"
docker compose -f docker-compose-test.yaml build
unset RAILS_ENV_FILE
unset SELENIUM_IMAGE