diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2f01fc9c..33c7464b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,14 +43,18 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] # TODO[AH] Support MacOS: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest] bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }} folder: - "." - "e2e/workspace" target: ["//..."] include: - - os: ubuntu-latest # TODO[AH] Support MacOS: macos-latest + - os: ubuntu-latest + bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} + folder: "." + target: "//zig/tests/integration_tests" + - os: macos-latest bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} folder: "." target: "//zig/tests/integration_tests" diff --git a/zig/private/toolchains_repo.bzl b/zig/private/toolchains_repo.bzl index 6bf11c88..48e81e48 100644 --- a/zig/private/toolchains_repo.bzl +++ b/zig/private/toolchains_repo.bzl @@ -20,12 +20,18 @@ with only the toolchain attribute pointing into the platform-specific repositori # Add more platforms as needed to mirror all the binaries # published by the upstream project. PLATFORMS = { - "x86_64-linux": struct( + "linux-x86_64": struct( compatible_with = [ "@platforms//os:linux", "@platforms//cpu:x86_64", ], ), + "macos-x86_64": struct( + compatible_with = [ + "@platforms//os:macos", + "@platforms//cpu:x86_64", + ], + ), } def _toolchains_repo_impl(repository_ctx): diff --git a/zig/private/versions.bzl b/zig/private/versions.bzl index 8c658fda..1d8a193e 100644 --- a/zig/private/versions.bzl +++ b/zig/private/versions.bzl @@ -4,8 +4,11 @@ TODO[AH]: generate this file from https://ziglang.org/download/index.json""" # The integrity hashes can be computed with # shasum -b -a 384 [downloaded file] | awk '{ print $1 }' | xxd -r -p | base64 +# Or using the sha256 hashes from ziglang.org converted with Python: +# "sha256-" + base64.b64encode(bytes.fromhex("SHA256")).decode() TOOL_VERSIONS = { "0.10.1": { - "x86_64-linux": "sha256-Zpnw5ykwgbQkKPMsnZyYOFQJS9Ff7lSJ8SxM9FGMw4A=", + "linux-x86_64": "sha256-Zpnw5ykwgbQkKPMsnZyYOFQJS9Ff7lSJ8SxM9FGMw4A=", + "macos-x86_64": "sha256-Akg1ULidKjBwwu0AM1f9bmowWXB7juP7wMZ/g8qJhDc=", }, } diff --git a/zig/repositories.bzl b/zig/repositories.bzl index 4b3d1489..1af34882 100644 --- a/zig/repositories.bzl +++ b/zig/repositories.bzl @@ -41,12 +41,18 @@ _ATTRS = { def _zig_repo_impl(repository_ctx): # TODO[AH] read URLs from https://ziglang.org/download/index.json - url = "https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz" - strip_prefix = "zig-linux-x86_64-0.10.1" + basename = "zig-{}-{}".format( + repository_ctx.attr.platform, + repository_ctx.attr.zig_version, + ) + url = "https://ziglang.org/download/{}/{}.tar.xz".format( + repository_ctx.attr.zig_version, + basename, + ) repository_ctx.download_and_extract( url = url, integrity = TOOL_VERSIONS[repository_ctx.attr.zig_version][repository_ctx.attr.platform], - stripPrefix = strip_prefix, + stripPrefix = basename, ) # TODO[AH] compiler and lib files