authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-07-10 03:51:00+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-07-12 03:24:28+02:00
logbd97b66186dabb3533df1ea9eb650d7574496a59
treec254a8e28c867590194805a0f870bc074377424b
parent681d324c49e7cdc773cc891ea49ed69dd03c23c7

ci: Add riscv64-linux-debug and riscv64-linux-release


3 files changed, 160 insertions(+), 0 deletions(-)

.github/workflows/ci.yaml+16
...@@ -50,6 +50,22 @@ jobs:...@@ -50,6 +50,22 @@ jobs:
50 uses: actions/checkout@v450 uses: actions/checkout@v4
51 - name: Build and Test51 - name: Build and Test
52 run: sh ci/aarch64-linux-release.sh52 run: sh ci/aarch64-linux-release.sh
53 riscv64-linux-debug:
54 timeout-minutes: 900
55 runs-on: [self-hosted, Linux, riscv64]
56 steps:
57 - name: Checkout
58 uses: actions/checkout@v4
59 - name: Build and Test
60 run: sh ci/riscv64-linux-debug.sh
61 riscv64-linux-release:
62 timeout-minutes: 780
63 runs-on: [self-hosted, Linux, riscv64]
64 steps:
65 - name: Checkout
66 uses: actions/checkout@v4
67 - name: Build and Test
68 run: sh ci/riscv64-linux-release.sh
53 x86_64-macos-release:69 x86_64-macos-release:
54 runs-on: "macos-13"70 runs-on: "macos-13"
55 env:71 env:
ci/riscv64-linux-debug.sh created+69
...@@ -0,0 +1,69 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="spacemit_x60"
11CACHE_BASENAME="zig+llvm+lld+clang-riscv64-linux-musl-0.15.0-dev.929+31e46be74"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/local/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git fetch --unshallow || true
20git fetch --tags
21
22# Override the cache directories because they won't actually help other CI runs
23# which will be testing alternate versions of zig, and ultimately would just
24# fill up space on the hard drive for no reason.
25export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
26export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
27
28mkdir build-debug
29cd build-debug
30
31export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
32export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
33
34cmake .. \
35 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
36 -DCMAKE_PREFIX_PATH="$PREFIX" \
37 -DCMAKE_BUILD_TYPE=Debug \
38 -DZIG_TARGET_TRIPLE="$TARGET" \
39 -DZIG_TARGET_MCPU="$MCPU" \
40 -DZIG_STATIC=ON \
41 -DZIG_NO_LIB=ON \
42 -GNinja
43
44# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
45# so that installation and testing do not get affected by them.
46unset CC
47unset CXX
48
49ninja install
50
51# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
52stage3-debug/bin/zig build test docs \
53 --maxrss 68719476736 \
54 -Dstatic-llvm \
55 -Dskip-non-native \
56 -Dtarget=native-native-musl \
57 --search-prefix "$PREFIX" \
58 --zig-lib-dir "$PWD/../lib"
59
60stage3-debug/bin/zig build \
61 --prefix stage4-debug \
62 -Denable-llvm \
63 -Dno-lib \
64 -Dtarget=$TARGET \
65 -Dcpu=$MCPU \
66 -Duse-zig-libcxx \
67 -Dversion-string="$(stage3-debug/bin/zig version)"
68
69stage4-debug/bin/zig test ../test/behavior.zig
ci/riscv64-linux-release.sh created+75
...@@ -0,0 +1,75 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="spacemit_x60"
11CACHE_BASENAME="zig+llvm+lld+clang-riscv64-linux-musl-0.15.0-dev.929+31e46be74"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/local/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git fetch --unshallow || true
20git fetch --tags
21
22# Override the cache directories because they won't actually help other CI runs
23# which will be testing alternate versions of zig, and ultimately would just
24# fill up space on the hard drive for no reason.
25export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache"
26export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache"
27
28mkdir build-release
29cd build-release
30
31export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
32export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
33
34cmake .. \
35 -DCMAKE_INSTALL_PREFIX="stage3-release" \
36 -DCMAKE_PREFIX_PATH="$PREFIX" \
37 -DCMAKE_BUILD_TYPE=Release \
38 -DZIG_TARGET_TRIPLE="$TARGET" \
39 -DZIG_TARGET_MCPU="$MCPU" \
40 -DZIG_STATIC=ON \
41 -DZIG_NO_LIB=ON \
42 -GNinja
43
44# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
45# so that installation and testing do not get affected by them.
46unset CC
47unset CXX
48
49ninja install
50
51# No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts.
52stage3-release/bin/zig build test docs \
53 --maxrss 68719476736 \
54 -Dstatic-llvm \
55 -Dskip-non-native \
56 -Dtarget=native-native-musl \
57 --search-prefix "$PREFIX" \
58 --zig-lib-dir "$PWD/../lib"
59
60# Ensure that stage3 and stage4 are byte-for-byte identical.
61stage3-release/bin/zig build \
62 --prefix stage4-release \
63 -Denable-llvm \
64 -Dno-lib \
65 -Doptimize=ReleaseFast \
66 -Dstrip \
67 -Dtarget=$TARGET \
68 -Dcpu=$MCPU \
69 -Duse-zig-libcxx \
70 -Dversion-string="$(stage3-release/bin/zig version)"
71
72# diff returns an error code if the files differ.
73echo "If the following command fails, it means nondeterminism has been"
74echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
75diff stage3-release/bin/zig stage4-release/bin/zig