-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cross-build on CI
- Loading branch information
Showing
9 changed files
with
146 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Zig | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
targets: | ||
- x86_64-linux-gnu | ||
- x86_64-linux-musl | ||
- x86-linux-gnu | ||
- x86-linux-musl | ||
- aarch64-linux-gnu | ||
- aarch64-linux-musl | ||
- riscv64-linux-musl | ||
- powerpc64-linux-musl | ||
- x86_64-macos | ||
- aarch64-macos | ||
# - x86-windows | ||
# - x86_64-windows | ||
# - aarch64-windows | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Download & Extract packages | ||
run: | | ||
curl -LO https://github.com/kassane/zig-mos-bootstrap/releases/download/0.2/zig-mos-x86_64-linux-musl-baseline.tar.xz | ||
tar -xf zig-mos-x86_64-linux-musl-baseline.tar.xz | ||
echo "$PWD/zig-mos-x86_64-linux-musl-baseline" >> $GITHUB_PATH | ||
sudo apt update && sudo apt install -y qemu-user-binfmt | ||
- name: Build Summary ${{ matrix.targets }} | ||
run: zig build --build-file $PWD/tests/build.zig --summary all -freference-trace -Dtarget=${{ matrix.targets }} | ||
|
||
- name: Run ${{ matrix.targets }} | ||
run: zig build rtsan --build-file $PWD/tests/build.zig --summary all -freference-trace -Dtarget=${{ matrix.targets }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// Based on vec_test.cc | ||
|
||
extern "C" { | ||
void ffi_zigarray(); | ||
void ffi_zig_openfile(); | ||
} | ||
|
||
void zig_main() [[clang::nonblocking]] { | ||
ffi_zigarray(); | ||
ffi_zig_openfile(); | ||
} | ||
|
||
int main() { | ||
zig_main(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// Reference: | ||
/// https://github.com/CppCon/CppCon2024/blob/main/Presentations/LLVMs_Realtime_Safety_Revolution.pdf | ||
|
||
#include <vector> | ||
|
||
int process() [[clang::nonblocking]] { | ||
std::vector<int> v(16); | ||
return v[16]; | ||
} | ||
|
||
int main() { return process(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const std = @import("std"); | ||
const sanitizers = @import("sanitizers"); | ||
|
||
pub fn build(b: *std.Build) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
|
||
// FIXME | ||
// { | ||
// const exe = b.addExecutable(.{ | ||
// .name = "test-asan", | ||
// .target = target, | ||
// .optimize = optimize, | ||
// }); | ||
// exe.addCSourceFile(.{ | ||
// .file = b.path("app/test.cc"), | ||
// .flags = &.{"-fsanitize=address"}, | ||
// }); | ||
// sanitizers.buildASan(b, exe); | ||
// b.installArtifact(exe); | ||
// const run = b.addRunArtifact(exe); | ||
// const run_step = b.step("asan", "Run the test-asan test"); | ||
// run_step.dependOn(&run.step); | ||
// } | ||
// LLVM 20 | ||
{ | ||
const libzig = b.addStaticLibrary(.{ | ||
.name = "zig", | ||
.target = target, | ||
.optimize = optimize, | ||
.root_source_file = b.path("lib/array.zig"), | ||
}); | ||
libzig.linkLibC(); | ||
|
||
const exe = b.addExecutable(.{ | ||
.name = "test-rtsan", | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
exe.linkLibrary(libzig); | ||
exe.addCSourceFile(.{ | ||
.file = b.path("app/test.cc"), | ||
.flags = &.{"-fsanitize=realtime"}, | ||
}); | ||
sanitizers.buildRTSan(b, exe); | ||
b.installArtifact(exe); | ||
const run = b.addRunArtifact(exe); | ||
const run_step = b.step("rtsan", "Run the test-rtsan test"); | ||
run_step.dependOn(&run.step); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.{ | ||
.name = "tests", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.sanitizers = .{ | ||
.path = "..", | ||
}, | ||
.@"compiler-rt" = .{ | ||
.url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.0/compiler-rt-19.1.0.src.tar.xz", | ||
.hash = "1220c8a83cf97bac4d7c1515c95cf9108dfb2fe8f0633da29085146fccb510d76097", | ||
}, | ||
}, | ||
.paths = .{""}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.