Skip to content

Commit

Permalink
Run tests on M1 runner.
Browse files Browse the repository at this point in the history
  • Loading branch information
fubark committed Feb 12, 2024
1 parent 516156a commit 8d31034
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/latest-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
target: x86_64-macos-none
mode: release
cmd: cli
- host: macos-12
- host: macos-14
target: aarch64-macos-none
mode: release
cmd: cli
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
target: x86_64-macos-none
mode: release
cmd: lib
- host: macos-12
- host: macos-14
target: aarch64-macos-none
mode: release
cmd: lib
Expand Down Expand Up @@ -138,6 +138,12 @@ jobs:
wget -c https://ziglang.org/builds/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin
xcode-select --print-path
- name: Install zig.
if: env.BUILD_HOST == 'macos-14'
run: |
wget -c https://ziglang.org/builds/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin
xcode-select --print-path
- name: Install zig.
if: env.BUILD_HOST == 'windows-2022'
run: |
Expand Down Expand Up @@ -189,11 +195,11 @@ jobs:
build-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-1

- name: Run tests.
if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli'
if: env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli'
run: zig build test ${{ env.ZIG_TARGET_FLAG }}

- name: Run tests.
if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib'
if: env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib'
run: zig build test-lib ${{ env.ZIG_TARGET_FLAG }}

- name: Run tests.
Expand Down Expand Up @@ -232,7 +238,7 @@ jobs:
# zig-out/${{ env.BUILD_TARGET }}/main/cosmic${{ env.BIN_EXT }}

- name: Zip. (linux/macos)
if: (env.BUILD_HOST == 'ubuntu-22.04' || env.BUILD_HOST == 'macos-12') && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli'
if: (env.BUILD_HOST == 'ubuntu-22.04' || env.BUILD_HOST == 'macos-12' || env.BUILD_HOST == 'macos-14') && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli'
run: |
tar -C zig-out/bin -czvf ${{ env.BIN_ZIP }} cyber
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
target: x86_64-macos-none
mode: release
cmd: cli
- host: macos-12
- host: macos-14
target: aarch64-macos-none
mode: release
cmd: cli
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
target: x86_64-macos-none
mode: release
cmd: lib
- host: macos-12
- host: macos-14
target: aarch64-macos-none
mode: release
cmd: lib
Expand Down Expand Up @@ -120,6 +120,12 @@ jobs:
wget -c https://ziglang.org/builds/zig-macos-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin
xcode-select --print-path
- name: Install zig.
if: env.BUILD_HOST == 'macos-14'
run: |
wget -c https://ziglang.org/builds/zig-macos-aarch64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin
xcode-select --print-path
- name: Install zig.
if: env.BUILD_HOST == 'windows-2022'
run: |
Expand All @@ -141,11 +147,11 @@ jobs:
pr-build-${{ env.BUILD_TARGET }}-${{ env.BUILD_MODE }}-1

- name: Run tests.
if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli'
if: env.BUILD_TARGET != 'wasm32-wasi' && env.BUILD_CMD == 'cli'
run: zig build test ${{ env.ZIG_TARGET_FLAG }}

- name: Run tests.
if: env.BUILD_TARGET != 'aarch64-macos-none' && env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib'
if: env.BUILD_TARGET != 'wasm32-freestanding' && env.BUILD_CMD == 'lib'
run: zig build test-lib ${{ env.ZIG_TARGET_FLAG }}

- name: Run tests.
Expand Down
3 changes: 3 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ pub fn buildAndLinkDeps(step: *std.build.Step.Compile, opts: Options) !void {

if (vmEngine == .c) {
const lib = try buildCVM(b, opts);
if (opts.target.getCpuArch().isWasm()) {
step.stack_protector = false;
}
step.linkLibrary(lib);
}

Expand Down
8 changes: 6 additions & 2 deletions lib/mimalloc/lib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ pub fn buildAndLink(b: *std.Build, step: *std.build.CompileStep, opts: BuildOpti
// c_flags.append("-D_GNU_SOURCE=1") catch @panic("error");
if (lib.target.getOsTag() == .windows) {
} else if (lib.target.getOsTag() == .macos) {
// Github macos-12 runner (https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md).
lib.addSystemIncludePath(.{ .path = "/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" });
if (lib.target.getCpuArch() == .aarch64) {
lib.addSystemIncludePath(.{ .path = "/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" });
} else {
// Github macos-12 runner (https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md).
lib.addSystemIncludePath(.{ .path = "/Applications/Xcode_14.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" });
}
lib.addSystemIncludePath(.{ .path = "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include" });
lib.addSystemIncludePath(.{ .path = "/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include" });
}
Expand Down
5 changes: 3 additions & 2 deletions src/bc_gen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ const SetLocalOptions = struct {

fn setLocal(c: *Chunk, data: ir.Local, rightIdx: u32, right_t: cy.TypeId, nodeId: cy.NodeId, opts: SetLocalOptions) !void {
const reg = toLocalReg(c, data.id);
const local = getLocalInfoPtr(c, reg);
var local = getLocalInfoPtr(c, reg);

var dst: Cstr = undefined;
if (local.some.lifted) {
Expand All @@ -1944,7 +1944,8 @@ fn setLocal(c: *Chunk, data: ir.Local, rightIdx: u32, right_t: cy.TypeId, nodeId
rightv = try genExpr(c, rightIdx, dst);
}

// Update retained state.
// Update retained state. Refetch local.
local = getLocalInfoPtr(c, reg);
local.some.rcCandidate = rightv.retained;
if (local.some.isDynamic) {
local.some.type = right_t;
Expand Down

0 comments on commit 8d31034

Please sign in to comment.