Skip to content

Commit bafc871

Browse files
committed
fix(ci): No need for homebrew
1 parent 9b924cb commit bafc871

3 files changed

Lines changed: 161 additions & 162 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ jobs:
2424
- "-Djit_always_on"
2525

2626
steps:
27-
- name: Install homebrew
28-
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2927
- name: Checkout project
3028
uses: actions/checkout@v3.0.0
3129
- name: Checkout submodules
3230
run: git submodule update --init --recursive
33-
- name: Setup nightly Zig
31+
- name: Setup Zig
3432
uses: mlugg/setup-zig@v2
3533
with:
3634
version: ${{ matrix.zig-version }}
@@ -64,7 +62,7 @@ jobs:
6462
runs-on: macos-latest
6563
steps:
6664
- uses: actions/checkout@v3.0.0
67-
- name: Setup nightly Zig
65+
- name: Setup Zig
6866
uses: mlugg/setup-zig@v2
6967
with:
7068
version: master

build.zig

Lines changed: 158 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -6,168 +6,17 @@ pub fn build(b: *Build) !void {
66
var envMap = try std.process.getEnvMap(b.allocator);
77
defer envMap.deinit();
88

9-
// Check minimum zig version
10-
const current_zig = builtin.zig_version;
11-
const min_zig = std.SemanticVersion.parse("0.16.0-dev.732+2f3234c76") catch return;
12-
if (current_zig.order(min_zig).compare(.lt)) {
13-
@panic(b.fmt("Your Zig version v{f} does not meet the minimum build requirement of v{f}", .{ current_zig, min_zig }));
14-
}
15-
169
const build_mode = b.standardOptimizeOption(.{});
1710
const target = b.standardTargetOptions(.{});
1811
const is_wasm = target.result.cpu.arch.isWasm();
1912
const install_step = b.getInstallStep();
2013

21-
var build_options = BuildOptions{
22-
.target = target,
23-
.version = std.SemanticVersion{ .major = 0, .minor = 6, .patch = 0 },
24-
// Current commit sha
25-
.sha = envMap.get("GIT_SHA") orelse
26-
envMap.get("GITHUB_SHA") orelse std.mem.trim(
27-
u8,
28-
b.run(
29-
&.{
30-
"git",
31-
"rev-parse",
32-
"--short",
33-
"HEAD",
34-
},
35-
),
36-
"\n \t",
37-
),
38-
.cycle_limit = b.option(
39-
usize,
40-
"cycle_limit",
41-
"Amount of bytecode (x 1000) the script is allowed to run (WARNING: this disables JIT compilation)",
42-
) orelse null,
43-
.recursive_call_limit = b.option(
44-
u32,
45-
"recursive_call_limit",
46-
"Maximum depth for recursive calls",
47-
),
48-
.stack_size = b.option(
49-
usize,
50-
"stack_size",
51-
"Stack maximum size",
52-
) orelse 100_000,
53-
.mimalloc = !is_wasm and b.option(
54-
bool,
55-
"mimalloc",
56-
"Use mimalloc allocator",
57-
) orelse true,
58-
.debug = .{
59-
.debug = b.option(
60-
bool,
61-
"debug",
62-
"Show debug information (AST, generated bytecode and more)",
63-
) orelse false,
64-
.stack = b.option(
65-
bool,
66-
"debug_stack",
67-
"Dump stack after each bytecode",
68-
) orelse false,
69-
.current_instruction = b.option(
70-
bool,
71-
"debug_current_instruction",
72-
"Dump stack after each bytecode",
73-
) orelse false,
74-
.perf = !is_wasm and b.option(
75-
bool,
76-
"show_perf",
77-
"Show performance information",
78-
) orelse false,
79-
.stop_on_report = b.option(
80-
bool,
81-
"stop_on_report",
82-
"Stop compilation whenever an error is encountered",
83-
) orelse false,
84-
.placeholders = b.option(
85-
bool,
86-
"debug_placeholders",
87-
"Debug placeholders resolution",
88-
) orelse false,
89-
.type_registry = b.option(
90-
bool,
91-
"debug_type_registry",
92-
"Debug type_registry",
93-
) orelse false,
94-
},
95-
.gc = .{
96-
.debug = b.option(
97-
bool,
98-
"gc_debug",
99-
"Show debug information for the garbage collector",
100-
) orelse false,
101-
.debug_light = b.option(
102-
bool,
103-
"gc_debug_light",
104-
"Show lighter debug information for the garbage collector",
105-
) orelse false,
106-
.debug_access = b.option(
107-
bool,
108-
"gc_debug_access",
109-
"Track objects access",
110-
) orelse false,
111-
.on = b.option(
112-
bool,
113-
"gc",
114-
"Turn on garbage collector",
115-
) orelse true,
116-
.initial_gc = b.option(
117-
usize,
118-
"initial_gc",
119-
"In Kb, threshold at which the first garbage collector pass will occur",
120-
) orelse 40_960, // 40Mb
121-
.next_gc_ratio = b.option(
122-
usize,
123-
"next_gc_ratio",
124-
"Ratio applied to get the next GC threshold",
125-
) orelse 2,
126-
.next_full_gc_ratio = b.option(
127-
usize,
128-
"next_full_gc_ratio",
129-
"Ratio applied to get the next full GC threshold",
130-
) orelse 4,
131-
.memory_limit = b.option(
132-
usize,
133-
"memory_limit",
134-
"Memory limit in bytes",
135-
) orelse null,
136-
},
137-
.jit = .{
138-
.debug = b.option(
139-
bool,
140-
"jit_debug",
141-
"Show debug information for the JIT engine",
142-
) orelse false,
143-
.always_on = !is_wasm and b.option(
144-
bool,
145-
"jit_always_on",
146-
"JIT engine will compile any function encountered",
147-
) orelse false,
148-
.hotspot_always_on = !is_wasm and b.option(
149-
bool,
150-
"jit_hotspot_always_on",
151-
"JIT engine will compile any hotspot encountered",
152-
) orelse false,
153-
.hotspot_on = !is_wasm and b.option(
154-
bool,
155-
"jit_hotspot_on",
156-
"JIT engine will compile hotspot when threshold reached",
157-
) orelse true,
158-
.on = !is_wasm and b.option(
159-
bool,
160-
"jit",
161-
"Turn on JIT engine",
162-
) orelse true,
163-
.prof_threshold = b.option(
164-
f128,
165-
"jit_prof_threshold",
166-
"Threshold to determine if a function is hot. If the numbers of calls to it makes this percentage of all calls, it's considered hot and will be JIT compiled.",
167-
) orelse 0.05,
168-
},
169-
};
170-
14+
const build_options = BuildOptions.init(
15+
b,
16+
is_wasm,
17+
target,
18+
envMap,
19+
);
17120
const build_option_module = build_options.step(b);
17221

17322
// Build non-zig dependencies
@@ -809,6 +658,158 @@ const BuildOptions = struct {
809658
recursive_call_limit: ?u32,
810659
stack_size: usize = 100_000,
811660

661+
pub fn init(b: *Build, is_wasm: bool, target: Build.ResolvedTarget, envMap: std.process.EnvMap) BuildOptions {
662+
return BuildOptions{
663+
.target = target,
664+
.version = std.SemanticVersion{ .major = 0, .minor = 6, .patch = 0 },
665+
// Current commit sha
666+
.sha = envMap.get("GIT_SHA") orelse
667+
envMap.get("GITHUB_SHA") orelse std.mem.trim(
668+
u8,
669+
b.run(
670+
&.{
671+
"git",
672+
"rev-parse",
673+
"--short",
674+
"HEAD",
675+
},
676+
),
677+
"\n \t",
678+
),
679+
.cycle_limit = b.option(
680+
usize,
681+
"cycle_limit",
682+
"Amount of bytecode (x 1000) the script is allowed to run (WARNING: this disables JIT compilation)",
683+
) orelse null,
684+
.recursive_call_limit = b.option(
685+
u32,
686+
"recursive_call_limit",
687+
"Maximum depth for recursive calls",
688+
),
689+
.stack_size = b.option(
690+
usize,
691+
"stack_size",
692+
"Stack maximum size",
693+
) orelse 100_000,
694+
.mimalloc = !is_wasm and b.option(
695+
bool,
696+
"mimalloc",
697+
"Use mimalloc allocator",
698+
) orelse true,
699+
.debug = .{
700+
.debug = b.option(
701+
bool,
702+
"debug",
703+
"Show debug information (AST, generated bytecode and more)",
704+
) orelse false,
705+
.stack = b.option(
706+
bool,
707+
"debug_stack",
708+
"Dump stack after each bytecode",
709+
) orelse false,
710+
.current_instruction = b.option(
711+
bool,
712+
"debug_current_instruction",
713+
"Dump stack after each bytecode",
714+
) orelse false,
715+
.perf = !is_wasm and b.option(
716+
bool,
717+
"show_perf",
718+
"Show performance information",
719+
) orelse false,
720+
.stop_on_report = b.option(
721+
bool,
722+
"stop_on_report",
723+
"Stop compilation whenever an error is encountered",
724+
) orelse false,
725+
.placeholders = b.option(
726+
bool,
727+
"debug_placeholders",
728+
"Debug placeholders resolution",
729+
) orelse false,
730+
.type_registry = b.option(
731+
bool,
732+
"debug_type_registry",
733+
"Debug type_registry",
734+
) orelse false,
735+
},
736+
.gc = .{
737+
.debug = b.option(
738+
bool,
739+
"gc_debug",
740+
"Show debug information for the garbage collector",
741+
) orelse false,
742+
.debug_light = b.option(
743+
bool,
744+
"gc_debug_light",
745+
"Show lighter debug information for the garbage collector",
746+
) orelse false,
747+
.debug_access = b.option(
748+
bool,
749+
"gc_debug_access",
750+
"Track objects access",
751+
) orelse false,
752+
.on = b.option(
753+
bool,
754+
"gc",
755+
"Turn on garbage collector",
756+
) orelse true,
757+
.initial_gc = b.option(
758+
usize,
759+
"initial_gc",
760+
"In Kb, threshold at which the first garbage collector pass will occur",
761+
) orelse 40_960, // 40Mb
762+
.next_gc_ratio = b.option(
763+
usize,
764+
"next_gc_ratio",
765+
"Ratio applied to get the next GC threshold",
766+
) orelse 2,
767+
.next_full_gc_ratio = b.option(
768+
usize,
769+
"next_full_gc_ratio",
770+
"Ratio applied to get the next full GC threshold",
771+
) orelse 4,
772+
.memory_limit = b.option(
773+
usize,
774+
"memory_limit",
775+
"Memory limit in bytes",
776+
) orelse null,
777+
},
778+
.jit = .{
779+
.debug = b.option(
780+
bool,
781+
"jit_debug",
782+
"Show debug information for the JIT engine",
783+
) orelse false,
784+
.always_on = !is_wasm and b.option(
785+
bool,
786+
"jit_always_on",
787+
"JIT engine will compile any function encountered",
788+
) orelse false,
789+
.hotspot_always_on = !is_wasm and b.option(
790+
bool,
791+
"jit_hotspot_always_on",
792+
"JIT engine will compile any hotspot encountered",
793+
) orelse false,
794+
.hotspot_on = !is_wasm and b.option(
795+
bool,
796+
"jit_hotspot_on",
797+
"JIT engine will compile hotspot when threshold reached",
798+
) orelse true,
799+
.on = !is_wasm and b.option(
800+
bool,
801+
"jit",
802+
"Turn on JIT engine",
803+
) orelse true,
804+
.prof_threshold = b.option(
805+
f128,
806+
"jit_prof_threshold",
807+
"Threshold to determine if a function is hot. If the numbers of calls to it makes this percentage of all calls, it's considered hot and will be JIT compiled.",
808+
) orelse 0.05,
809+
},
810+
};
811+
}
812+
812813
pub fn step(self: @This(), b: *Build) *Build.Module {
813814
var options = b.addOptions();
814815
options.addOption(@TypeOf(self.version), "version", self.version);

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.name = .buzz,
33
.fingerprint = 0x87514371589e863a,
44
.version = "0.6.0",
5-
.minimum_zig_version = "0.15.0-dev.190+bfbf4badd",
5+
.minimum_zig_version = "0.16.0-dev.747+493ad58ff",
66
.dependencies = .{
77
.clap = .{
88
.url = "git+https://github.com/Hejsil/zig-clap.git#5289e0753cd274d65344bef1c114284c633536ea",

0 commit comments

Comments
 (0)