Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ BUILDAH_PUSH ?= 0
KIND_CLUSTER_NAME := wire-server
BUILDAH_KIND_LOAD ?= 1

package ?= all
EXE_SCHEMA := ./dist/$(package)-schema

# This ensures that focused unit tests written in hspec fail. This is supposed
Expand All @@ -44,7 +45,7 @@ install: init
ifeq ($(WIRE_BUILD_WITH_CABAL), 1)
cabal build all
./hack/bin/cabal-run-all-tests.sh
./hack/bin/cabal-install-all-artefacts.sh
./hack/bin/cabal-install-artefacts.sh all
else
stack install --pedantic --test --bench --no-run-benchmarks --local-bin-path=dist
endif
Expand All @@ -71,11 +72,7 @@ endif
# Usage: make ci package=brig test=1
.PHONY: ci
ci: c
ifeq ("$(pattern)", "")
make -C services/$(package) i
else
make -C services/$(package) i-$(pattern)
endif
./hack/bin/cabal-run-integration.sh $(package) $(pattern)

# reset db using cabal
.PHONY: db-reset-package
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5-internal/improve-make-c-target
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve cabal make targets: faster installation and better support for building and testing all packages
11 changes: 0 additions & 11 deletions hack/bin/cabal-install-all-artefacts.sh

This file was deleted.

11 changes: 10 additions & 1 deletion hack/bin/cabal-install-artefacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ TOP_LEVEL="$(cd "$DIR/../.." && pwd)"

DIST="$TOP_LEVEL/dist"

cabal-plan list-bins "$1"':exe:*' | awk '{print $2}' | xargs -I '{}' rsync -a {} "$DIST"
if [[ "$1" == "all" ]]; then
pattern='*'
else
pattern="$1"
fi

cabal-plan list-bins "$pattern:exe:*" |
awk '{print $2}' |
xargs -i sh -c 'test -f {} && echo {} || true' |
xargs -P8 -i rsync -a {} "$DIST"
26 changes: 26 additions & 0 deletions hack/bin/cabal-run-integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TOP_LEVEL="$(cd "$DIR/../.." && pwd)"

package=${1:-all}
pattern=${2:-}

opts=""

if [[ "$package" != "all" ]]; then
opts="$opts -C services/$package"
fi

if [[ -n "$pattern" ]]; then
if [[ "$package" == "all" ]]; then
echo -e "\e[31mGlobal pattern not supported\e[0m" >&2
exit 1
fi
opts="$opts i-$pattern"
else
opts="$opts i"
fi

exec make $opts