Enable MacOS CI
This commit is contained in:
parent
651fa8cde0
commit
88ce420b00
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@ -9,7 +9,7 @@ on:
|
|||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
linux-gnu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
@ -20,4 +20,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: master
|
version: master
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: sh ci/github_ubuntu_runner.sh
|
run: sh ci/linux_gnu_runner.sh
|
||||||
|
macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Zig
|
||||||
|
uses: davidgm94/setup-zig@foo
|
||||||
|
with:
|
||||||
|
version: master
|
||||||
|
- name: Build and test
|
||||||
|
run: sh ci/macos_runner.sh
|
||||||
|
@ -30,7 +30,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const static = b.option(bool, "static", "This option enables the compiler to be built statically") orelse switch (@import("builtin").os.tag) {
|
const static = b.option(bool, "static", "This option enables the compiler to be built statically") orelse switch (@import("builtin").os.tag) {
|
||||||
else => use_debug,
|
else => use_debug,
|
||||||
.windows => true,
|
.windows => true,
|
||||||
.macos => true,
|
// .macos => true,
|
||||||
};
|
};
|
||||||
const compiler_options = b.addOptions();
|
const compiler_options = b.addOptions();
|
||||||
compiler_options.addOption(bool, "print_stack_trace", print_stack_trace);
|
compiler_options.addOption(bool, "print_stack_trace", print_stack_trace);
|
||||||
@ -481,7 +481,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.macos => {
|
.macos => {
|
||||||
compiler.linkLibCpp();
|
compiler.linkLibCpp();
|
||||||
|
|
||||||
if (discover_brew_prefix(b, "llvm")) |llvm_prefix| {
|
if (discover_brew_prefix(b, "llvm@17")) |llvm_prefix| {
|
||||||
const llvm_include_path = try std.mem.concat(b.allocator, u8, &.{ llvm_prefix, "/include" });
|
const llvm_include_path = try std.mem.concat(b.allocator, u8, &.{ llvm_prefix, "/include" });
|
||||||
const llvm_lib_path = try std.mem.concat(b.allocator, u8, &.{ llvm_prefix, "/lib" });
|
const llvm_lib_path = try std.mem.concat(b.allocator, u8, &.{ llvm_prefix, "/lib" });
|
||||||
compiler.addIncludePath(.{ .cwd_relative = llvm_include_path });
|
compiler.addIncludePath(.{ .cwd_relative = llvm_include_path });
|
||||||
|
@ -523,7 +523,12 @@ fn run_test_suite(allocator: Allocator, args: struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
switch (@import("builtin").os.tag) {
|
switch (@import("builtin").os.tag) {
|
||||||
.macos => {},
|
.macos => runCmakeTests(allocator, .{
|
||||||
|
.dir_path = "test/cc_macos",
|
||||||
|
.compiler_path = args.compiler_path,
|
||||||
|
}) catch {
|
||||||
|
errors = true;
|
||||||
|
},
|
||||||
.windows => {},
|
.windows => {},
|
||||||
.linux => switch (@import("builtin").abi) {
|
.linux => switch (@import("builtin").abi) {
|
||||||
.gnu => runCmakeTests(allocator, .{
|
.gnu => runCmakeTests(allocator, .{
|
||||||
|
5
ci/macos_runner.sh
Normal file
5
ci/macos_runner.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -ex
|
||||||
|
brew update
|
||||||
|
brew install llvm@17 ninja
|
||||||
|
zig build test -Dthird_party_ci
|
2
test/cc_macos/c_asm/.gitignore
vendored
Normal file
2
test/cc_macos/c_asm/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.o
|
||||||
|
build/
|
3
test/cc_macos/c_asm/CMakeLists.txt
Normal file
3
test/cc_macos/c_asm/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
project(c_asm C ASM)
|
||||||
|
add_executable(c_asm main.c assembly.S)
|
4
test/cc_macos/c_asm/assembly.S
Normal file
4
test/cc_macos/c_asm/assembly.S
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.global _foo
|
||||||
|
_foo:
|
||||||
|
mov w0, #42
|
||||||
|
ret
|
7
test/cc_macos/c_asm/main.c
Normal file
7
test/cc_macos/c_asm/main.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
extern int foo();
|
||||||
|
#include <assert.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
assert(foo() == 42);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user