From 95b0829d528627d817205ac0e056b2fad36a44a7 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:43:51 +0200 Subject: [PATCH 1/9] Enable musl target build for ARM architecture --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca630bc..11ae540 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,8 +78,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu-') run: | if [[ "${{ matrix.os }}" == *"-arm" ]]; then - # TODO debug this: CARGO_BUILD_TARGET=aarch64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc - echo "no-op" + CARGO_BUILD_TARGET=aarch64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc else CARGO_BUILD_TARGET=x86_64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc fi From 9ffcbb95852f8cabe94fa4a85325eb8d1d11655b Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:46:07 +0200 Subject: [PATCH 2/9] handle all TODO --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11ae540..712b7e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,8 +68,7 @@ jobs: sudo apt-get install -y musl-tools if [[ "${{ matrix.os }}" == *"-arm" ]]; then - # TODO re-enable once TODOs below are gone: rustup target add aarch64-unknown-linux-musl - echo "no-op" + rustup target add aarch64-unknown-linux-musl else rustup target add x86_64-unknown-linux-musl fi @@ -87,10 +86,7 @@ jobs: - name: Test using musl build if: startsWith(matrix.os, 'ubuntu-') run: | - # TODO remove `if` when above TODOs are done - if [[ "${{ matrix.os }}" != *"-arm" ]]; then # no need to build platform anymore NO_BUILD=1 IS_MUSL=1 ./ci/all_tests.sh - fi # TODO clippy, rustfmt, roc fmt check From ff1c087cde8c9ff850ef75cd7e5bc804c3d7d285 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:26:36 +0200 Subject: [PATCH 3/9] try Claude's fix --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 712b7e5..58b232b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,7 @@ jobs: sudo apt-get install -y musl-tools if [[ "${{ matrix.os }}" == *"-arm" ]]; then + sudo apt-get install -y gcc-aarch64-linux-gnu rustup target add aarch64-unknown-linux-musl else rustup target add x86_64-unknown-linux-musl @@ -77,7 +78,10 @@ jobs: if: startsWith(matrix.os, 'ubuntu-') run: | if [[ "${{ matrix.os }}" == *"-arm" ]]; then - CARGO_BUILD_TARGET=aarch64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc + export CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc + export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc + export CARGO_BUILD_TARGET=aarch64-unknown-linux-musl + ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc else CARGO_BUILD_TARGET=x86_64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc fi From e7554bb9f15a224ad618882f46216e38e39ffade Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:39:31 +0200 Subject: [PATCH 4/9] same exports as roc/ci/build_basic_webserver.sh --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58b232b..e87652e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: brew install ripgrep # ripgrep for ci/check_all_exposed_funs_tested.roc # Run all tests - - run: ./ci/all_tests.sh + # TODO re-enable - run: ./ci/all_tests.sh - name: Install dependencies for musl build if: startsWith(matrix.os, 'ubuntu-') @@ -78,9 +78,10 @@ jobs: if: startsWith(matrix.os, 'ubuntu-') run: | if [[ "${{ matrix.os }}" == *"-arm" ]]; then - export CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc - export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc export CARGO_BUILD_TARGET=aarch64-unknown-linux-musl + export CC_aarch64_unknown_linux_musl=clang-18 + export AR_aarch64_unknown_linux_musl=llvm-ar-18 + export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc else CARGO_BUILD_TARGET=x86_64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc From ad1a47b981cbded29e17c446409741638297e5bc Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:03:44 +0200 Subject: [PATCH 5/9] try with docker --- .github/workflows/ci.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e87652e..7c22f6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,11 +16,25 @@ env: EXAMPLES_DIR: ./examples/ jobs: + get-rust-version: + runs-on: ubuntu-latest + outputs: + rust-version: ${{ steps.get-version.outputs.rust-version }} + steps: + - uses: actions/checkout@v4 + - name: Get Rust version from toolchain file + id: get-version + run: | + RUST_VERSION=$(grep 'channel = ' rust-toolchain.toml | sed 's/channel = "\(.*\)"/\1/') + echo "rust-version=$RUST_VERSION" >> $GITHUB_OUTPUT + build-and-test: runs-on: ${{ matrix.os }} + container: ${{ matrix.os == 'ubuntu-24.04-arm' && format('rust:{0}-bookworm', needs.get-rust-version.outputs.rust-version) || null }} strategy: matrix: os: [ubuntu-24.04, ubuntu-24.04-arm, macos-15] + needs: get-rust-version steps: - uses: actions/checkout@v4 @@ -65,12 +79,10 @@ jobs: - name: Install dependencies for musl build if: startsWith(matrix.os, 'ubuntu-') run: | - sudo apt-get install -y musl-tools - if [[ "${{ matrix.os }}" == *"-arm" ]]; then - sudo apt-get install -y gcc-aarch64-linux-gnu rustup target add aarch64-unknown-linux-musl else + sudo apt-get install -y musl-tools rustup target add x86_64-unknown-linux-musl fi @@ -78,11 +90,7 @@ jobs: if: startsWith(matrix.os, 'ubuntu-') run: | if [[ "${{ matrix.os }}" == *"-arm" ]]; then - export CARGO_BUILD_TARGET=aarch64-unknown-linux-musl - export CC_aarch64_unknown_linux_musl=clang-18 - export AR_aarch64_unknown_linux_musl=llvm-ar-18 - export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" - ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc + CARGO_BUILD_TARGET=aarch64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc else CARGO_BUILD_TARGET=x86_64-unknown-linux-musl ./roc_nightly/roc build.roc -- --roc ./roc_nightly/roc fi From f4575e1f4eefe31071610638fbae4bc1714f0a27 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:10:39 +0200 Subject: [PATCH 6/9] better nightly detection --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c22f6e..634ce79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,8 +44,11 @@ jobs: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz elif [[ "${{ runner.os }}" == "macOS" ]]; then curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz - else + elif [[ "${{ runner.os }}-${{ runner.arch }}" == "Linux-X64" ]]; then curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz + else + echo "Unrecognized OS/arch combination: ${{ runner.os }}-${{ runner.arch }}" + exit 1 fi - name: rename nightly tar From d00af54c7b8845cd40c21bf9acfc8e828a31a6ff Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:17:38 +0200 Subject: [PATCH 7/9] use bash shell --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 634ce79..0c0a795 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,10 @@ concurrency: # Do not add permissions here! Configure them at the job level! permissions: {} +defaults: + run: + shell: bash # need to specify this when using `container:` below + env: JUMP_START: 1 ROC: ./roc_nightly/roc From db0a76137b18e255ac5b393847c7e1c1b1d4ba7e Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:22:52 +0200 Subject: [PATCH 8/9] install sudo --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c0a795..e4bf93c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,11 @@ jobs: - run: ./roc_nightly/roc version + - name: Install sudo if in container + if: matrix.os == 'ubuntu-24.04-arm' + run: | + apt update && apt install -y sudo + - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu-') run: | From d258aabd49c9aea47b6f36833fb0ec19f6b2e6d4 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Wed, 3 Sep 2025 17:26:43 +0200 Subject: [PATCH 9/9] install gcc-aarch64-linux-gnu --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4bf93c..f22517a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: - name: Install sudo if in container if: matrix.os == 'ubuntu-24.04-arm' run: | - apt update && apt install -y sudo + apt update && apt install -y sudo gcc-aarch64-linux-gnu - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu-')