roc/ci/build_basic_cli.sh

40 lines
1.0 KiB
Bash
Raw Normal View History

2022-12-10 20:12:42 +03:00
#!/usr/bin/env bash
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -euxo pipefail
git clone https://github.com/roc-lang/basic-cli.git
2023-02-07 16:30:32 +03:00
if [ "$(uname -m)" == "x86_64" ] && [ "$(uname -s)" == "Linux" ]; then
sudo apt-get install musl-tools
cd basic-cli/src # we cd to install the target for the right rust version
rustup target add x86_64-unknown-linux-musl
cd ../..
fi
2023-02-07 18:26:51 +03:00
mv $(ls -d artifact/* | grep "roc_nightly.*tar\.gz" | grep "$1") ./roc_nightly.tar.gz
2022-12-10 20:12:42 +03:00
# decompress the tar
2023-02-07 18:26:51 +03:00
tar -xzvf roc_nightly.tar.gz
2022-12-10 20:12:42 +03:00
2023-01-17 13:28:08 +03:00
# delete tar
2023-02-07 18:26:51 +03:00
rm roc_nightly.tar.gz
2023-01-17 13:28:08 +03:00
# simplify dir name
mv roc_nightly* roc_nightly
cd roc_nightly
2022-12-10 20:12:42 +03:00
# build the basic cli platform
2023-01-28 16:03:36 +03:00
./roc build ../basic-cli/examples/countdown.roc
2022-12-24 17:30:12 +03:00
2022-12-24 17:47:55 +03:00
# We need this extra variable so we can safely check if $2 is empty later
EXTRA_ARGS=${2:-}
2022-12-24 17:30:12 +03:00
# In some rare cases it's nice to be able to use the legacy linker, so we produce the .o file to be able to do that
2022-12-26 18:53:30 +03:00
if [ -n "${EXTRA_ARGS}" ];
2023-01-28 16:03:36 +03:00
then ./roc build $EXTRA_ARGS ../basic-cli/examples/countdown.roc
2022-12-24 17:30:12 +03:00
fi
2022-12-13 19:53:21 +03:00
cd ..