google / cpu_features

A cross platform C99 library to get cpu features at runtime.
Apache License 2.0
2.44k stars 258 forks source link

Add CI MacOS Arm64 support #356

Closed toor1245 closed 2 weeks ago

toor1245 commented 3 weeks ago

https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners

Proof of success: macos-arm64 cmake: https://github.com/toor1245/cpu_features/actions/runs/10551510281

We don't have mock compilation definitions for bazel, so our tests will get real CPU information and the tests will fail: https://github.com/toor1245/cpu_features/actions/runs/10551510292/job/29229039421#step:6:23

toor1245 commented 3 weeks ago

@gchatelet, @Mizux, this PR is ready to review please take a look.

Mizux commented 2 weeks ago

Requested change: aarch64 -> arm64

Context for ARCH naming I usually use what Docker use: see: https://github.com/docker-library/official-images Which is based on the "indexes" in the OCI image specification Which is based on Golang GOARCH naming: https://go.dev/doc/install/source#environment i.e. arm64

For OS we prefer to use macos (as now) following the github runner convention ref: https://github.com/actions/runner-images note: github also tend to use arm for M1 based runners...

So could you rename file as arm64_macos_[bazel/cmake].yml and use Arm64 MacOS ... in name: (first line) ?

toor1245 commented 2 weeks ago

Requested change: aarch64 -> arm64

Context for ARCH naming I usually use what Docker use: see: https://github.com/docker-library/official-images Which is based on the "indexes" in the OCI image specification Which is based on Golang GOARCH naming: https://go.dev/doc/install/source#environment i.e. arm64

For OS we prefer to use macos (as now) following the github runner convention ref: https://github.com/actions/runner-images note: github also tend to use arm for M1 based runners...

So could you rename file as arm64_macos_[bazel/cmake].yml and use Arm64 MacOS ... in name: (first line) ?

Updated, should we rename aarch64_linux_[bazel/cmake].yml to arm64_linux_[bazel/cmake].yml for consistency?

Mizux commented 2 weeks ago

Updated, should we rename aarch64_linux_[bazel/cmake].yml to arm64_linux_[bazel/cmake].yml for consistency?

TLDR: Not yet.

Context: Currently our top README.md table mix native runner build (windows-latest, macos-13, ubuntu-latest...) and cross compilation using a CMake toolchain (aarch64, mips, powerpc) (+ QEMU for testing when possible).

I think we should split our CI matrix result in two tables:

Also to ease the work of @gchatelet to adapt his script to generate the badges, we are thinking to add a prefix cross_ or xxx_toolchain (idea welcome) to be able to automatically split .yml files in two categories then generate both tables (native build and cross compile ones) automatically with few lines change in the script.... ref: https://github.com/google/cpu_features/blob/main/scripts/generate_badges.d