Skip to content

Commit

Permalink
Merge pull request tweag#233 from tweag/run-all-tests
Browse files Browse the repository at this point in the history
Run all tests and accumulate failures on CI
  • Loading branch information
mergify[bot] authored May 31, 2022
2 parents 178ad0e + 9be671a commit 38124e4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 19 deletions.
48 changes: 48 additions & 0 deletions .github/build-and-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /usr/bin/env nix-shell
#! nix-shell ../shell.nix -i bash

set -euo pipefail

declare SCRIPT_DIR

SCRIPT_DIR="$( realpath "${BASH_SOURCE[0]}" )"
SCRIPT_DIR="${SCRIPT_DIR%/*}"

cd "$( dirname "$SCRIPT_DIR" )"

declare -i FAILED=0
declare -a FAILURES=( )

function on_exit() {
echo
if [[ "$FAILED" -gt 0 ]]; then
echo "error: running tests in ${FAILURES[@]} was not successful"
exit 1
elif [[ $? -eq 0 ]]; then
echo "all tests passed."
fi
} >&2

trap on_exit EXIT

declare -ra dirs=(
.
core
toolchains/go
toolchains/java
toolchains/cc
toolchains/python
toolchains/posix
toolchains/rust
)
for dir in "${dirs[@]}"
do
pushd $dir
if ! bazel test //... ; then
let ++FAILED
FAILURES+=( "$dir" )
fi
bazel shutdown
popd
done

20 changes: 1 addition & 19 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,7 @@ jobs:
EOF
- name: Build & test
run: |
nix-shell --pure --run '
set -euo pipefail
dirs=(
.
core
toolchains/go
toolchains/java
toolchains/cc
toolchains/python
toolchains/posix
toolchains/rust
)
for dir in "${dirs[@]}"
do
pushd $dir
bazel test //...
popd
done
'
nix-shell --pure --keep GITHUB_REPOSITORY --run 'bash .github/build-and-test'
test-examples:
name: Build & Test - Examples
strategy:
Expand Down

0 comments on commit 38124e4

Please sign in to comment.