Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@95c9bf48d0c570bb3e28e57108f3450cd67c1a44 # v2.0.0
- uses: bazel-contrib/setup-bazel@0.18.0
- run: bazel build //...
- run: cd examples && bazel build //...
- run: cd examples && bazel test //...
21 changes: 19 additions & 2 deletions docker_compose_test/docker_compose_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,29 @@ if [ $? -eq 0 ]; then
docker_compose_bin="docker-compose"
fi

# bring up compose file & get exit status-code from the integration test container
cleanup() {
echo "Cleaning up docker-compose resources..."
docker_compose_down_cmd="$docker_compose_bin -f $ABSOLUTE_COMPOSE_FILE_PATH down --volumes --remove-orphans"
echo "running: $docker_compose_down_cmd"
echo "$docker_compose_down_cmd" | bash
}

# Ensure cleanup runs on EXIT (covers normal exit, errors, and signals).
# SIGTERM: sent by Bazel on test timeout or cancellation.
# SIGINT: sent on Ctrl+C.
trap cleanup EXIT

# bring up compose file & get exit status-code from the integration test container.
docker_compose_up_cmd="$docker_compose_bin -f $ABSOLUTE_COMPOSE_FILE_PATH up --exit-code-from $DOCKER_COMPOSE_TEST_CONTAINER $EXTRA_DOCKER_COMPOSE_UP_ARGS"
echo "running: $docker_compose_up_cmd"
echo "$docker_compose_up_cmd" | bash
result=$?

$docker_compose_bin -f $ABSOLUTE_COMPOSE_FILE_PATH down
# Figure out the exit code of the test container incase it never actually started.
EXIT_CODE=$(docker inspect $(docker compose -f $ABSOLUTE_COMPOSE_FILE_PATH ps -qa $DOCKER_COMPOSE_TEST_CONTAINER) --format='{{.State.ExitCode}}' 2>/dev/null)
if [ "$EXIT_CODE" != "0" ] || [ -z "$EXIT_CODE" ]; then
echo "Error: $DOCKER_COMPOSE_TEST_CONTAINER container failed or never started!"
exit 1
fi

exit $result