-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun-all.sh
56 lines (47 loc) · 1.36 KB
/
run-all.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# Exit immediately if a command returns a non-zero status
set -e
script_dir=$(dirname "$0")
project_root_path=$(realpath "$script_dir/../..")
cd "$project_root_path"
ci=${CI:-false}
if [ "$ci" = true ]; then
echo "Running in CI"
volume_options="--volumes-from runner --workdir $GITHUB_WORKSPACE"
else
echo "Not running in CI"
volume_options="-v $PWD:/wd --workdir /wd"
fi
# Read versions
node_version=$(head -n 1 .nvmrc)
terraform_version=$(head -n 1 .terraform-version)
echo "node version : $node_version"
echo "terraform version : $terraform_version"
# Run JS tests
echo "Build and test JS/TS"
js_cmd="docker run \
$volume_options --entrypoint /bin/bash --rm \
--env CI \
node:$node_version .tools/ci/test-js.sh"
echo "$js_cmd"
eval "$js_cmd"
# Run TF tests
echo "Build and test TF"
tf_cmd="docker run \
$volume_options --entrypoint /bin/sh --rm \
--env CI \
hashicorp/terraform:$terraform_version .tools/ci/test-tf.sh"
echo "$tf_cmd"
eval "$tf_cmd"
echo "Lint Packer"
packer_cmd="docker run \
$volume_options --entrypoint /bin/bash --rm --env CI \
hashicorp/packer .tools/ci/test-packer.sh"
echo "$packer_cmd"
eval "$packer_cmd"
echo "Lint bash"
bash_lint_cmd="docker run \
$volume_options --rm --env CI \
koalaman/shellcheck-alpine shellcheck .tools/**/*.sh ./modules/start-and-stop/function/runner-scripts/*.sh -x"
echo "$bash_lint_cmd"
eval "$bash_lint_cmd"