Fix CI test stage
continuous-integration/drone/push Build is failing Details

This commit is contained in:
kayomn 2023-05-28 01:26:41 +00:00
parent 5642f399b9
commit fe8e98e753
2 changed files with 27 additions and 8 deletions

View File

@ -1,9 +1,9 @@
const std = @import("std"); const std = @import("std");
pub fn build(builder: *std.Build) void { pub fn build(b: *std.Build) void {
const coral_module = builder.createModule(.{.source_file = .{.path = "./source/coral/coral.zig"}}); const coral_module = b.createModule(.{.source_file = .{.path = "./source/coral/coral.zig"}});
const ona_module = builder.createModule(.{ const ona_module = b.createModule(.{
.source_file = .{.path = "./source/ona/ona.zig"}, .source_file = .{.path = "./source/ona/ona.zig"},
.dependencies = &.{ .dependencies = &.{
@ -14,13 +14,16 @@ pub fn build(builder: *std.Build) void {
}, },
}); });
// Ona Runner. const cross_target = b.standardTargetOptions(.{});
const optimize_mode = std.builtin.Mode.Debug;
// Ona runner.
{ {
const ona_exe = builder.addExecutable(.{ const ona_exe = b.addExecutable(.{
.name = "ona-runner", .name = "ona-runner",
.root_source_file = .{.path = "./source/runner.zig"}, .root_source_file = .{.path = "./source/runner.zig"},
.target = builder.standardTargetOptions(.{}), .target = cross_target,
.optimize = .Debug, .optimize = optimize_mode,
}); });
ona_exe.addModule("coral", coral_module); ona_exe.addModule("coral", coral_module);
@ -29,6 +32,19 @@ pub fn build(builder: *std.Build) void {
// ona_exe.addIncludeDir("./ext"); // ona_exe.addIncludeDir("./ext");
ona_exe.linkSystemLibrary("SDL2"); ona_exe.linkSystemLibrary("SDL2");
ona_exe.linkLibC(); ona_exe.linkLibC();
builder.installArtifact(ona_exe); b.installArtifact(ona_exe);
}
// Test step.
{
const exe_tests = b.addTest(.{
.root_source_file = .{.path = "source/test.zig"},
.target = cross_target,
.optimize = optimize_mode,
});
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&exe_tests.step);
} }
} }

3
source/test.zig Normal file
View File

@ -0,0 +1,3 @@
const _coral = @import("coral");
const _ona = @import("ona");