Skip to content

Conversation

inge4pres
Copy link

@inge4pres inge4pres commented Oct 8, 2025

Reason for this PR

Relates to:

Details

  • add build.zig and build.zig.zon
  • add a zig.yml workflow to build on Github actions

Additional context

The build scripts is derived from what CMake does; it compiles a static library and an executable that links to it for testing.

The Github workflow simply ensure compilation via build.zig succeeds and runs the executable on 4 Linux targets.

Further work

build.zig could also be extended to include a test step that runs the c++ tests in the test folder.

Add the necessary files to build a static library with Zig.
The build also includes producing execuable that can be cross-compiled

Signed-off-by: inge4pres <fgualazzi@gmail.com>
Signed-off-by: inge4pres <fgualazzi@gmail.com>
@inge4pres inge4pres marked this pull request as ready for review October 9, 2025 20:37
Copy link
Collaborator

@gchatelet gchatelet left a comment

Choose a reason for hiding this comment

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

@Mizux can you have a look as well?

@@ -0,0 +1,12 @@
.{
.name = .cpu_features,
.version = "0.0.1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not using the cpu version instead ?

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: mlugg/setup-zig@v2
Copy link
Collaborator

Choose a reason for hiding this comment

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

why specifying the version and a mirror ?
For a CI I would be happy to target the default/last release pointed by the actions than fixing it a lagging behind in few months...
same for mirror not sure it is needed according to the doc in
https://github.com/mlugg/setup-zig/blob/8d6198c65fb0feaa111df26e6b467fea8345e46f/README.md?plain=1#L45-L48

Copy link
Collaborator

@Mizux Mizux Oct 10, 2025

Choose a reason for hiding this comment

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

I would split this in 3 files;

  • zig.yml following the clang_format.yml Check but for Zig Check

Currently seems we have two CI workflows:

  • amd64_linux_zig.yml
  • aarch64_linux_zig.yml
    note: ubuntu-20.04-arm64 are thid party runner maybe using a regular ubuntu-latest+QEMU to cross compile et run should be more robust against the gh runner infra

Maybe to extend to Macos (brew?) and windows too later ?

thus, adding Zig to BuildSystem and a svg logo (e.g. https://github.com/ziglang/logo/blob/master/zig-mark.svg) and we should be able to generate badges too to update the README.md CI table...
ref: https://github.com/google/cpu_features/blob/main/scripts/generate_badges.d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants