Skip to content

Commit

Permalink
On CI upgrade docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
JonJagger committed Nov 6, 2023
1 parent 3852df8 commit f419fbf
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
5 changes: 5 additions & 0 deletions sh/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ git_commit_sha()
echo "$(cd "$(repo_root)" && git rev-parse HEAD)"
}

on_ci()
{
[ -n "${CI:-}" ]
}

write_test_evidence_json()
{
{
Expand Down
26 changes: 26 additions & 0 deletions sh/on_ci_upgrade_docker_compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

# - - - - - - - - - - - - - - - - - - - - - - - -
on_ci_upgrade_docker_compose()
{
echo
if ! on_ci; then
echo 'not on CI so not upgrading docker-compose'
else
echo 'on CI so upgrading docker-compose'
# docker-compose.yml uses this:
#
# volumes:
# - type: tmpfs
# target: /tmp
# tmpfs:
# mode: 01777
#
# and the mode: option is not supported in the version of docker-compose
# currently installed in ubuntu-latest in the Github Action's main.yml
#
# https://stackoverflow.com/questions/49839028
sudo curl -L "https://github.com/docker/compose/releases/download/`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | sed 's#.*tag/##g' && echo`/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
fi
echo
}

4 changes: 3 additions & 1 deletion sh/run_tests_with_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ set -Eeu
export ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
export SH_DIR="${ROOT_DIR}/sh"

source "${SH_DIR}/lib.sh"
source "${SH_DIR}/containers_down.sh"
source "${SH_DIR}/containers_up_healthy_and_clean.sh"
source "${SH_DIR}/echo_versioner_env_vars.sh"
source "${SH_DIR}/lib.sh"
source "${SH_DIR}/on_ci_upgrade_docker_compose.sh"
source "${SH_DIR}/test_in_containers.sh"
export $(echo_versioner_env_vars)

on_ci_upgrade_docker_compose
server_up_healthy_and_clean
client_up_healthy_and_clean "$@"
test_in_containers "$@"
Expand Down
61 changes: 61 additions & 0 deletions test/evidence.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{ "server":
{
"timestamp": 1699306114,
"command_name": "Minitest",
"groups": {
"app": {
"lines": {
"total": 69,
"covered": 69,
"missed": 0
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0
}
},
"test": {
"lines": {
"total": 0,
"covered": 0,
"missed": 0
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0
}
}
}
}, "client":
{
"timestamp": 1699306118,
"command_name": "Minitest",
"groups": {
"app": {
"lines": {
"total": 52,
"covered": 52,
"missed": 0
},
"branches": {
"total": 2,
"covered": 1,
"missed": 1
}
},
"test": {
"lines": {
"total": 0,
"covered": 0,
"missed": 0
},
"branches": {
"total": 0,
"covered": 0,
"missed": 0
}
}
}
}}

0 comments on commit f419fbf

Please sign in to comment.