Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,58 @@ jobs:

- name: Build
run: zig build ${{ matrix.build-options }} --summary all

bsd:
name: ${{ matrix.os }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
zig-version: [0.16.0]
os: [freebsd, openbsd]
include:
- os: freebsd
packages: pkg install -y curl
- os: openbsd
packages: pkg_add -I curl xz # OpenBSD tar cannot decompress .tar.xz

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE:
It turns out that tar in OpenBSD has no -J option and cannot extract .tar.xz files.
Unlike OpenBSD (base tar is pax), FreeBSD (base tar is bsdtar) can extract .tar.xz well.

Ref:
https://github.com/openbsd/src/blob/dfaf7899c030e92af72bff3730d9aa52f6059072/bin/pax/Makefile#L9
https://github.com/openbsd/src/blob/dfaf7899c030e92af72bff3730d9aa52f6059072/bin/pax/options.c#L1790-L1798
https://www.mail-archive.com/tech@openbsd.org/msg08996.html

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unsurprising. I think using xzcat so the two BSD targets have the same job definition is fine.

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Build (FreeBSD)
if: matrix.os == 'freebsd'
uses: vmactions/freebsd-vm@v1.5.9
with: &bsd_build
Comment thread
torque marked this conversation as resolved.
cache-after-prepare: true
copyback: false
prepare: |
${{ matrix.packages }}
mkdir -p /usr/local/zig
curl -fsSL https://ziglang.org/download/${{ matrix.zig-version }}/zig-x86_64-${{ matrix.os }}-${{ matrix.zig-version }}.tar.xz -o /usr/local/zig/zig.tar.xz

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll see if I can upstream a feature to override the mlugg/setup-zig auto host machine detection since I'd rather not have a CI job directly pulling from ziglang.org if we can avoid it. That's not a blocker for merging this, though.

run: |
set -e
xzcat /usr/local/zig/zig.tar.xz | tar -xf - -C /usr/local/zig/
export PATH="/usr/local/zig/zig-x86_64-${{ matrix.os }}-${{ matrix.zig-version }}:$PATH"

cat > ./uv_test.c <<'EOF'
#include <uv.h>
int main(void) {
uv_loop_t* loop = uv_default_loop();
uv_interface_address_t* addrs;
int count;
if (uv_interface_addresses(&addrs, &count) == 0)
uv_free_interface_addresses(addrs, count);
return uv_run(loop, UV_RUN_DEFAULT);
}
EOF

zig build --summary all

zig cc -o ./uv_test ./uv_test.c -I zig-out/include -L zig-out/lib -luv
./uv_test
Comment thread
torque marked this conversation as resolved.

- name: Build (OpenBSD)
if: matrix.os == 'openbsd'
uses: vmactions/openbsd-vm@v1.4.8
with: *bsd_build
6 changes: 6 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,23 @@ const freebsd_sources: []const []const u8 = &.{
"unix/freebsd.c",
"unix/posix-hrtime.c",
"unix/bsd-proctitle.c",
"unix/bsd-ifaddrs.c",
"unix/kqueue.c",
"unix/random-getrandom.c",
};
const netbsd_sources: []const []const u8 = &.{
"unix/posix-hrtime.c",
"unix/bsd-proctitle.c",
"unix/bsd-ifaddrs.c",
"unix/kqueue.c",
"unix/netbsd.c",
};
const openbsd_sources: []const []const u8 = &.{
"unix/posix-hrtime.c",
"unix/bsd-proctitle.c",
"unix/random-getentropy.c",
"unix/bsd-ifaddrs.c",
"unix/kqueue.c",
"unix/openbsd.c",
};

Expand Down
Loading