#!/usr/bin/env murex

set project=github.com/lmorg/murex
set build_path=build-tests

cd $GOPATH/src/$project/test

mkdir $build_path
cd $build_path

set json targets = ([
    "linux",
    "darwin",
    "windows"
])

let status=0

$targets -> foreach target {
    try {
        ({BLUE}Building $target....{RESET})
        export GOOS=$target
        go build $project
        out "{GREEN}SUCCESSFUL{RESET}"
    }
    catch {
        out "{RED}FAILED{RESET}"
	    let status++
    }
}

cd ..

rm -rf $build_path

exit $status
