diff --git a/.github/workflows/ci_zig.yml b/.github/workflows/ci_zig.yml index 80374a0891..ff97f11d7b 100644 --- a/.github/workflows/ci_zig.yml +++ b/.github/workflows/ci_zig.yml @@ -85,18 +85,25 @@ jobs: include: - os: macos-15-intel cpu_flag: -Dcpu=x86_64_v3 + target_flag: '' - os: macos-15 cpu_flag: '' + target_flag: '' - os: ubuntu-22.04 cpu_flag: -Dcpu=x86_64_v3 + target_flag: -Dtarget=x86_64-linux-musl - os: ubuntu-24.04-arm cpu_flag: '' + target_flag: -Dtarget=aarch64-linux-musl - os: windows-2022 cpu_flag: -Dcpu=x86_64_v3 + target_flag: '' - os: windows-2025 cpu_flag: -Dcpu=x86_64_v3 + target_flag: '' - os: windows-11-arm cpu_flag: '' + target_flag: '' steps: - name: Checkout @@ -119,7 +126,7 @@ jobs: - name: build roc + repro executables uses: ./.github/actions/flaky-retry with: - command: "zig build -Dfuzz -Dsystem-afl=false -Doptimize=ReleaseFast ${{ matrix.cpu_flag }}" + command: "zig build -Dfuzz -Dsystem-afl=false -Doptimize=ReleaseFast ${{ matrix.cpu_flag }} ${{ matrix.target_flag }}" error_string_contains: "EndOfStream" retry_count: 3 @@ -136,7 +143,7 @@ jobs: - name: Run Test Platforms (Unix) if: runner.os != 'Windows' run: | - zig build test-cli + zig build test-cli ${{ matrix.target_flag }} - name: Setup MSVC (Windows) if: runner.os == 'Windows' @@ -165,13 +172,13 @@ jobs: zig-out\bin\roc.exe check ./src/PROFILING/bench_repeated_check.roc - name: zig snapshot tests - run: zig build snapshot -- --debug + run: zig build snapshot ${{ matrix.target_flag }} -- --debug # 1) in debug mode - name: build and execute tests, build repro executables uses: ./.github/actions/flaky-retry with: - command: "zig build test -Dfuzz -Dsystem-afl=false" + command: "zig build test -Dfuzz -Dsystem-afl=false ${{ matrix.target_flag }}" error_string_contains: "double roundtrip bundle" retry_count: 3 @@ -179,7 +186,7 @@ jobs: - name: Build and execute tests, build repro executables. All in release mode. uses: ./.github/actions/flaky-retry with: - command: "zig build test -Doptimize=ReleaseFast -Dfuzz -Dsystem-afl=false ${{ matrix.cpu_flag }}" + command: "zig build test -Doptimize=ReleaseFast -Dfuzz -Dsystem-afl=false ${{ matrix.cpu_flag }} ${{ matrix.target_flag }}" error_string_contains: "double roundtrip bundle" retry_count: 3 @@ -250,7 +257,7 @@ jobs: run: | git clean -fdx git reset --hard HEAD - nix develop ./src/ -c zig build && zig build snapshot && zig build test + nix develop ./src/ -c zig build ${{ matrix.target_flag }} && zig build snapshot ${{ matrix.target_flag }} && zig build test ${{ matrix.target_flag }} zig-cross-compile: needs: check-once diff --git a/build.zig b/build.zig index 505589aca8..7b66bdecef 100644 --- a/build.zig +++ b/build.zig @@ -1650,7 +1650,7 @@ pub fn build(b: *std.Build) void { } // Ensure host library is copied before running the test run_fx_platform_test.step.dependOn(©_test_fx_host.step); - // Ensure roc binary is built before running the test + // Ensure roc binary is built before running the test (tests invoke roc CLI) run_fx_platform_test.step.dependOn(roc_step); tests_summary.addRun(&run_fx_platform_test.step); } @@ -2206,9 +2206,8 @@ fn addStaticLlvmOptionsToModule(mod: *std.Build.Module) !void { mod.linkSystemLibrary("z", link_static); if (mod.resolved_target.?.result.os.tag != .windows or mod.resolved_target.?.result.abi != .msvc) { - // TODO: Can this just be `mod.link_libcpp = true`? Does that make a difference? - // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries. - mod.linkSystemLibrary("c++", .{}); + // Use Zig's bundled static libc++ to keep the binary statically linked + mod.link_libcpp = true; } if (mod.resolved_target.?.result.os.tag == .windows) { diff --git a/src/cli/test/fx_platform_test.zig b/src/cli/test/fx_platform_test.zig index 14fc5a4b2c..63e92e1708 100644 --- a/src/cli/test/fx_platform_test.zig +++ b/src/cli/test/fx_platform_test.zig @@ -734,7 +734,6 @@ test "fx platform expect with toplevel numeric" { // TODO: Fix test7.roc - currently fails with "UNRECOGNIZED SYNTAX" for `_ = x` pattern // test "fx platform test7" { // const allocator = testing.allocator; - // // const run_result = try std.process.Child.run(.{ // .allocator = allocator, @@ -769,7 +768,6 @@ test "fx platform expect with toplevel numeric" { // TODO: Fix test8.roc - currently fails with "UNRECOGNIZED SYNTAX" for `_ = x` pattern // test "fx platform test8" { // const allocator = testing.allocator; - // // const run_result = try std.process.Child.run(.{ // .allocator = allocator, @@ -804,7 +802,6 @@ test "fx platform expect with toplevel numeric" { // TODO: Fix test9.roc - currently fails with "UNRECOGNIZED SYNTAX" for `_ = y` pattern // test "fx platform test9" { // const allocator = testing.allocator; - // // const run_result = try std.process.Child.run(.{ // .allocator = allocator,