Skip to content

Commit e470818

Browse files
committed
CI: separate tools job from the build job
fix `error: 'resolv.h' file not found`
1 parent 9a30f84 commit e470818

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,31 @@ jobs:
3636
- name: Run `build`
3737
run: zig build ${{ matrix.build-options }} -Doptimize=${{ matrix.optimize }} --summary all
3838

39-
# Test allyourcodebase/lmdb#3
39+
# CI test for allyourcodebase/lmdb#3
40+
tools:
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
zig-version: ["master", "0.13.0"]
45+
os: [ubuntu-latest]
46+
47+
runs-on: ${{ matrix.os }}
48+
49+
steps:
50+
- name: Check out repository
51+
uses: actions/checkout@v4
52+
with:
53+
submodules: false
54+
55+
- name: Set up Zig
56+
uses: mlugg/setup-zig@v1
57+
with:
58+
version: ${{ matrix.zig-version }}
59+
use-cache: false
60+
4061
- name: Run `build tools on macos`
4162
run: zig build tools -Dtarget=x86_64-macos-none --summary all
4263

43-
- name: Run `build tools on windows`
44-
run: zig build tools -Dtarget=x86_64-windows-gnu --summary all
45-
4664
test:
4765
strategy:
4866
fail-fast: false

build.zig

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ pub fn build(b: *Build) void {
2020
const strip = b.option(bool, "strip", "Strip debug information") orelse false;
2121
const lto = b.option(bool, "lto", "Enable link time optimization") orelse false;
2222

23-
const is_macos = builtin.os.tag == .macos or target.result.os.tag == .macos;
24-
const is_windows = builtin.os.tag == .windows or target.result.os.tag == .windows;
25-
23+
const is_macos = builtin.os.tag == .macos;
24+
const need_resolve_h = is_macos or target.result.os.tag == .macos;
25+
const is_windows = builtin.os.tag == .windows;
26+
2627
// writing WritingLibFiles in zld isn't implemented on windows
27-
// and zld is the only linker suppored on macos
28+
// and zld is the only linker supported on macos
2829
const use_lld = if (is_macos) false else if (is_windows) true else switch (optimize) {
2930
.Debug => false,
3031
else => true,
@@ -66,7 +67,7 @@ pub fn build(b: *Build) void {
6667
});
6768
liblmdb.addIncludePath(lmdb_upstream.path(lmdb_root));
6869
liblmdb.root_module.addCMacro("_XOPEN_SOURCE", "600");
69-
if (is_macos) {
70+
if (need_resolve_h) {
7071
liblmdb.root_module.addCMacro("_DARWIN_C_SOURCE", "");
7172
}
7273

@@ -112,7 +113,7 @@ pub fn build(b: *Build) void {
112113
});
113114
tool.addIncludePath(lmdb_upstream.path(lmdb_root));
114115
tool.root_module.addCMacro("_XOPEN_SOURCE", "600");
115-
if (is_macos) {
116+
if (need_resolve_h) {
116117
tool.root_module.addCMacro("_DARWIN_C_SOURCE", "");
117118
}
118119
tool.linkLibrary(liblmdb);

0 commit comments

Comments
 (0)