feat: create cc_toolchains for multiple exec platforms (#196) #138
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: ci | |
on: | |
push: | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
# Cancels pending runs when a PR gets updated. | |
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- uses: actions/cache@v4 | |
name: "Windows: cache bazelisk and zig-cache" | |
if: runner.os == 'Windows' | |
with: | |
key: cache-${{ matrix.os }}-${{ hashFiles('.bazelversion', 'toolchain/private/zig_sdk.bzl', '.github/workflows/ci.yaml') }} | |
path: | | |
C:\Temp\zig-cache | |
~\AppData\Local\bazelisk' | |
- uses: actions/cache@v4 | |
name: "MacOS: cache bazelisk and zig-cache" | |
if: runner.os == 'macOS' | |
with: | |
key: cache-${{ matrix.os }}-${{ hashFiles('.bazelversion', 'toolchain/private/zig_sdk.bzl', '.github/workflows/ci.yaml') }} | |
path: | | |
/var/tmp/zig-cache | |
~/Library/Caches/bazelisk | |
- uses: actions/cache@v4 | |
name: "Linux: cache bazelisk and zig-cache" | |
if: runner.os == 'Linux' | |
with: | |
key: cache-${{ matrix.os }}-${{ hashFiles('.bazelversion', 'toolchain/private/zig_sdk.bzl', '.github/workflows/ci.yaml') }} | |
path: | | |
/tmp/zig-cache | |
~/.cache/bazelisk | |
- run: echo "common --announce_rc" >> .bazelrc.ci | |
- run: brew install bash | |
if: runner.os == 'macOS' | |
# Linux, macOS and Windows | |
- run: ci/list_toolchains_platforms | |
- run: tools/bazel test //... | |
- run: ci/prepare_git && ci/test_example rules_cc override_repository | |
- run: ci/prepare_git && ci/test_example bzlmod override_module | |
- run: ci/zig-utils | |
# Test the Zig toolchain for Darwin on Darwin. | |
- run: tools/bazel test --config=macos_toolchains --@rules_go//go/config:static --@rules_go//go/config:pure //test/c/... | |
if: runner.os == 'macOS' | |
# Windows problems: | |
# protoc does not compile due to `-lpthread`. | |
- run: ci/lint | |
if: runner.os != 'Windows' | |
# Releaser emits different hashes | |
- run: ci/release | |
if: runner.os != 'Windows' |