Skip to content

Commit

Permalink
wip: Add native build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
adamws committed Nov 13, 2024
1 parent 890d03e commit 081b0e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,39 @@ on:
jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
zig_version:
- latest
#- master - not compatible yet
runs-on: ${{ matrix.os }}
steps:
- name: Prepare git to leave line endings alone
run: git config --global core.autocrlf input
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
with:
version: ${{ matrix.zig_version }}
- name: Install dependencies
- if: matrix.os == 'ubuntu-latest'
name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install libgl-dev libxi-dev \
libx11-dev xserver-xorg-dev xorg-dev
- name: Debug
shell: bash
run: |
xxd src/test_data/atreus-internal.json
- run: |
zig build
zig build test
- uses: actions/upload-artifact@v4
if: always()
with:
name: klawa
path: zig-out/bin/klawa
name: klawa-${{ matrix.os }}
path: zig-out/bin/klawa*
retention-days: 2
if-no-files-found: error

Expand All @@ -48,7 +56,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: klawa
name: klawa-ubuntu-latest
path: zig-out/bin
- name: Install dependencies
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions src/kle.zig
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub fn parseFromSlice(
};
}

const expect = @import("std").testing.expect;
const testing = @import("std").testing;

fn makeTestCase(comptime name: []const u8) type {
return struct {
Expand All @@ -327,7 +327,7 @@ fn makeTestCase(comptime name: []const u8) type {
try json.stringify(kle.value, .{ .whitespace = .indent_2 }, out.writer());

const reference = @embedFile(std.fmt.comptimePrint("test_data/{s}-internal.json", .{name}));
try std.testing.expect(std.mem.eql(u8, out.items, reference));
try testing.expectEqualStrings(reference, out.items);
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions src/spsc_queue.zig
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ test "producer consumer" {
while (i != std.math.maxInt(u16)) {
const data = ExampleType{ .field1 = @intCast(i), .field2 = .{1} ** 32 };
while (!queue.push(data)) : ({
std.debug.print("Consumer outpaced, try again\n", .{});
//std.debug.print("Consumer outpaced, try again\n", .{});
std.time.sleep(10 * std.time.ns_per_ms);
}) {}
std.debug.print("Pushed: {d}\n", .{i});
//std.debug.print("Pushed: {d}\n", .{i});
i = i +% 1;
}
}
Expand All @@ -100,7 +100,7 @@ test "producer consumer" {
pub fn run(queue: *TestQueue) !void {
while (true) {
if (queue.pop()) |e| {
std.debug.print("Consumed: {d}\n", .{e.field1});
//std.debug.print("Consumed: {d}\n", .{e.field1});
if (e.field1 + 1 == std.math.maxInt(u16)) {
break;
}
Expand Down

0 comments on commit 081b0e7

Please sign in to comment.