perform build before test/add gen as a dependency for test
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Emil Lerch 2021-06-30 11:09:30 -07:00
parent b82dc3f50d
commit 487abc057f
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 16 additions and 15 deletions

View File

@ -18,8 +18,8 @@ steps:
- rm /usr/local/bin/zig - rm /usr/local/bin/zig
- ln -s /usr/local/zig-linux-x86_64-0.9.0-dev.321+15a030ef3/zig /usr/local/bin/zig - ln -s /usr/local/zig-linux-x86_64-0.9.0-dev.321+15a030ef3/zig /usr/local/bin/zig
- (cd codegen && zig build test) - (cd codegen && zig build test)
- zig build # implicitly does a codegen
- zig build test - zig build test
- zig build
- name: notify - name: notify
image: plugins/matrix image: plugins/matrix
when: when:

View File

@ -17,20 +17,6 @@ pub fn build(b: *Builder) !void {
// https://github.com/ziglang/zig/issues/855 // https://github.com/ziglang/zig/issues/855
exe.addPackagePath("smithy", "smithy/src/smithy.zig"); exe.addPackagePath("smithy", "smithy/src/smithy.zig");
// TODO: Support > linux
// TODO: Get a better cache in place
if (std.builtin.os.tag == .linux) {
const codegen = b.step("gen", "Generate zig service code from smithy models");
codegen.dependOn(&b.addSystemCommand(&.{ "/bin/sh", "-c", "cd codegen && zig build" }).step);
codegen.dependOn(&b.addSystemCommand(&.{
"/bin/sh", "-c",
\\ mkdir -p src/models/ && \
\\ [ -f src/models/service_manifest.zig ] || \
\\ ( cd codegen/models && ../codegen *.json && mv *.zig ../../src/models )
}).step);
b.getInstallStep().dependOn(codegen);
}
exe.addCSourceFile("src/bitfield-workaround.c", &[_][]const u8{"-std=c99"}); exe.addCSourceFile("src/bitfield-workaround.c", &[_][]const u8{"-std=c99"});
const c_include_dirs = .{ const c_include_dirs = .{
"./src/", "./src/",
@ -96,4 +82,19 @@ pub fn build(b: *Builder) !void {
test_step.dependOn(&t.step); test_step.dependOn(&t.step);
} }
} }
// TODO: Support > linux
// TODO: Get a better cache in place
if (std.builtin.os.tag == .linux) {
const codegen = b.step("gen", "Generate zig service code from smithy models");
codegen.dependOn(&b.addSystemCommand(&.{ "/bin/sh", "-c", "cd codegen && zig build" }).step);
codegen.dependOn(&b.addSystemCommand(&.{
"/bin/sh", "-c",
\\ mkdir -p src/models/ && \
\\ [ -f src/models/service_manifest.zig ] || \
\\ ( cd codegen/models && ../codegen *.json && mv *.zig ../../src/models )
}).step);
b.getInstallStep().dependOn(codegen);
test_step.dependOn(codegen);
}
} }