diff --git a/.github/workflows/tests-dev.yml b/.github/workflows/tests-dev.yml deleted file mode 100644 index 5515c71..0000000 --- a/.github/workflows/tests-dev.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Tests dev - -on: - # Triggers the workflow on push or pull request events but only for the "master" branch - push: - branches: ["master"] - pull_request: - branches: ["master"] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: goto-bus-stop/setup-zig@v2 - - run: zig build test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ae74fc..7eb7fbc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,5 +14,5 @@ jobs: - uses: actions/checkout@v3 - uses: goto-bus-stop/setup-zig@v2 with: - version: 0.10.1 - - run: zig build test + version: 0.11.0 + - run: zig test src/tests.zig diff --git a/build.zig b/build.zig index 90c640b..2591e0e 100644 --- a/build.zig +++ b/build.zig @@ -70,16 +70,22 @@ fn build_v11(b: *std.Build) void { // Docs const docs = b.addStaticLibrary(.{ .name = "zig-rc", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = std.build.LazyPath.relative("src/main.zig"), .target = target, .optimize = optimize, }); - docs.emit_docs = .emit; + + _ = b.addInstallDirectory(.{ + .source_dir = docs.getEmittedDocs(), + .install_dir = .prefix, + .install_subdir = "docs", + }); + b.installArtifact(docs); // Tests const main_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/tests.zig" }, + .root_source_file = std.build.LazyPath.relative("src/tests.zig"), }); const run_main_tests = b.addRunArtifact(main_tests); @@ -97,7 +103,7 @@ fn build_v11(b: *std.Build) void { // Examples const example = b.addTest(.{ - .root_source_file = .{ .path = "src/example.zig" }, + .root_source_file = std.build.LazyPath.relative("src/example.zig"), }); const run_example = b.addRunArtifact(example); const example_step = b.step("example", "Run library example"); diff --git a/src/example.zig b/src/example.zig index 87fafe1..d5dfba3 100644 --- a/src/example.zig +++ b/src/example.zig @@ -51,7 +51,7 @@ test "example" { fn thread_exec(data: Arc) !void { defer data.releaseWithFn(Data.deinit); - var rng = std.rand.DefaultPrng.init(@bitCast(u64, @truncate(i64, std.time.nanoTimestamp()))); + var rng = std.rand.DefaultPrng.init(@as(u64, @bitCast(@as(i64, @truncate(std.time.nanoTimestamp()))))); data.value.mutex.lock(); defer data.value.mutex.unlock(); diff --git a/src/main.zig b/src/main.zig index 896d866..c87d95b 100644 --- a/src/main.zig +++ b/src/main.zig @@ -240,7 +240,7 @@ pub fn Rc(comptime T: type) type { } inline fn innerPtr(self: *const Weak) ?*Inner { - return @ptrCast(?*Inner, self.inner); + return @as(?*Inner, @ptrCast(self.inner)); } }; }; @@ -480,7 +480,7 @@ pub fn Arc(comptime T: type) type { } inline fn innerPtr(self: *const Weak) ?*Inner { - return @ptrCast(?*Inner, self.inner); + return @as(?*Inner, @ptrCast(self.inner)); } }; };