2023-07-17 17:09:35 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
|
|
|
set -euxo pipefail
|
|
|
|
|
2023-07-22 18:45:38 +03:00
|
|
|
# if to prevent unset vars errror
|
2023-07-22 18:48:32 +03:00
|
|
|
if [ -n "$(ls | grep -v "roc_nightly.*tar\.gz" | grep -v "^ci$")" ]; then
|
|
|
|
|
|
|
|
# Remove everything in this dir except the tar and ci folder.
|
|
|
|
# We want to test like a user who would have downloaded the release, so we clean up all files from the repo checkout.
|
|
|
|
to_delete=$(ls | grep -v "roc_nightly.*tar\.gz" | grep -v "^ci$")
|
2023-07-22 18:38:32 +03:00
|
|
|
|
|
|
|
for file_or_dir in $to_delete
|
|
|
|
do
|
2023-07-18 20:51:42 +03:00
|
|
|
echo "Removing: $file_or_dir"
|
|
|
|
rm -rf "$file_or_dir"
|
2023-07-22 18:38:32 +03:00
|
|
|
done
|
|
|
|
fi
|
2023-07-17 17:09:35 +03:00
|
|
|
|
|
|
|
# decompress the tar
|
|
|
|
ls | grep "roc_nightly.*tar\.gz" | xargs tar -xzvf
|
|
|
|
|
|
|
|
# delete tar
|
|
|
|
ls | grep "roc_nightly.*tar\.gz" | xargs rm -rf
|
|
|
|
|
|
|
|
# rename nightly folder
|
|
|
|
mv roc_nightly* roc_nightly
|
|
|
|
|
|
|
|
cd roc_nightly
|
|
|
|
|
|
|
|
# test roc hello world
|
2023-08-18 19:18:04 +03:00
|
|
|
./roc examples/helloWorld.roc
|
|
|
|
|
2023-07-17 17:09:35 +03:00
|
|
|
./roc examples/platform-switching/rocLovesRust.roc
|
|
|
|
|
2023-08-18 19:18:04 +03:00
|
|
|
run_zig_test=true
|
|
|
|
# Detect macOS version
|
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
macos_version=$(sw_vers -productVersion)
|
|
|
|
major_version=$(echo $macos_version | cut -d. -f1)
|
|
|
|
|
|
|
|
# If macOS 13, then set the flag to skip
|
2023-08-18 19:22:20 +03:00
|
|
|
if [[ $major_version -eq 13 ]]; then
|
2023-08-18 19:18:04 +03:00
|
|
|
echo "Skipping zig test on macOS 13 due to https://github.com/roc-lang/roc/issues/5590..."
|
|
|
|
run_zig_test=false
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $run_zig_test ; then
|
|
|
|
./roc examples/platform-switching/rocLovesZig.roc
|
|
|
|
fi
|
2023-07-17 17:09:35 +03:00
|
|
|
|
|
|
|
./roc examples/platform-switching/rocLovesC.roc
|
|
|
|
|
2023-07-18 11:56:17 +03:00
|
|
|
cd ..
|