Skip to content

Commit 9ea4b10

Browse files
authored
Merge pull request #7568 from roc-lang/release-tests-changes
release testing improvements
2 parents 670d255 + 9635063 commit 9ea4b10

4 files changed

+89
-118
lines changed

.github/workflows/test_nightly_macos_apple_silicon.yml

-46
This file was deleted.
+12-22
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
on:
2-
# pull_request:
32
workflow_dispatch:
3+
# pull_request:
44

5-
name: Test latest nightly releases for macOS and Linux x86_64
5+
name: Test latest nightly releases for macOS and Linux
66

77
jobs:
88
test-nightly:
9-
name: test nightly macos 13 (x64), ubuntu 20.04/22.04
9+
name: test nightly macos 13 (x64), macos 14 (aarch64), ubuntu 20.04-24.04 (x64), ubuntu 22.04-24.04 (aarch64)
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [macos-13, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
13+
os: [macos-13, macos-14, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm]
1414
runs-on: ${{ matrix.os }}
1515
timeout-minutes: 90
1616
steps:
@@ -19,28 +19,18 @@ jobs:
1919
with:
2020
version: 0.13.0
2121

22-
- name: Install z3 on macOS-13
23-
if: matrix.os == 'macos-13'
24-
run: brew install z3
25-
26-
- name: get the latest release archive for linux (x86_64)
27-
if: startsWith(matrix.os, 'ubuntu')
28-
run: |
29-
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
22+
- name: Delete everything except ci folder to test the release like a real user would
23+
run: find . -maxdepth 1 ! -name ci ! -name '.' -exec rm -rf {} +
3024

31-
- name: get the latest release archive for macos (x86_64)
25+
- name: install z3 on macOS
3226
if: startsWith(matrix.os, 'macos')
33-
run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
27+
run: brew install z3
3428

3529
- run: zig version
3630

37-
- name: prep and run basic tests
38-
run: |
39-
./ci/basic_nightly_test.sh
31+
- name: Run basic tests
32+
run: ./ci/basic_release_test.sh ${{ matrix.os }}
4033

41-
- name: clean up, get old linux release (x86_64), run tests
34+
- name: Run basic tests with old release
4235
if: startsWith(matrix.os, 'ubuntu')
43-
run: |
44-
rm -rf roc_nightly
45-
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-old_linux_x86_64-latest.tar.gz
46-
./ci/basic_nightly_test.sh
36+
run: ./ci/basic_release_test.sh ${{ matrix.os }} old

ci/basic_nightly_test.sh

-50
This file was deleted.

ci/basic_release_test.sh

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
3+
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
4+
set -euxo pipefail
5+
6+
# Check if argument is provided
7+
if [ $# -lt 1 ]; then
8+
echo "Usage: $0 <os> [old]"
9+
exit 1
10+
fi
11+
12+
OS="$1"
13+
IS_OLD="${2:-}"
14+
15+
function download_release() {
16+
local os="$1"
17+
local is_old="$2"
18+
local old_prefix=""
19+
20+
if [ "$is_old" = "old" ]; then
21+
old_prefix="old_"
22+
fi
23+
24+
case "$os" in
25+
"macos-13")
26+
curl -fL "https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz" -o roc_release.tar.gz
27+
;;
28+
"macos-14")
29+
curl -fL "https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz" -o roc_release.tar.gz
30+
;;
31+
ubuntu-*-arm)
32+
curl -fL "https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-${old_prefix}linux_arm64-latest.tar.gz" -o roc_release.tar.gz
33+
;;
34+
ubuntu-*)
35+
curl -fL "https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-${old_prefix}linux_x86_64-latest.tar.gz" -o roc_release.tar.gz
36+
;;
37+
*)
38+
echo "Unsupported OS: $os"
39+
exit 1
40+
;;
41+
esac
42+
}
43+
44+
# Download the appropriate release
45+
download_release "$OS" "$IS_OLD"
46+
47+
mkdir -p roc_release
48+
49+
# decompress the tar
50+
tar -xzvf roc_release.tar.gz -C roc_release
51+
52+
# delete tar
53+
rm -rf roc_release.tar.gz
54+
55+
cd roc_release/*/
56+
57+
# test rust platform (first prebuild the host)
58+
# temp disabled
59+
# examples/platform-switching/rust-platform/build.sh
60+
# ./roc examples/platform-switching/rocLovesRust.roc
61+
62+
# test zig platform
63+
./roc --build-host --suppress-build-host-warning examples/platform-switching/rocLovesZig.roc
64+
65+
# test C platform
66+
./roc --build-host --suppress-build-host-warning examples/platform-switching/rocLovesC.roc
67+
68+
# test repl
69+
cd ../../ci/repl_basic_test
70+
cargo build --release
71+
cp target/release/repl_basic_test ../../roc_release/*/
72+
cd ../../roc_release/*/
73+
./repl_basic_test
74+
75+
cd ../..
76+
#cleanup
77+
rm -rf roc_release

0 commit comments

Comments
 (0)