chore(deps): update dependency rules_cc to v0.1.0 #901
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 | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize, edited] | |
# Allows you to call this workflow from another workflow | |
workflow_call: | |
secrets: | |
BUILDBUDDY_API_KEY: | |
description: The BuildBuddy remote execution access token. | |
required: true | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
# Cancel previous actions from the same PR: https://stackoverflow.com/a/72408109 | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# matrix-prep-* steps generate JSON used to create a dynamic actions matrix. | |
# Insanely complex for how simple this requirement is inspired from | |
# https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional | |
matrix-prep-bazelversion: | |
# Prepares the 'bazelversion' axis of the test matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: versions_from_bazel_versions_bzl | |
run: echo "bazelversions=$(.github/workflows/bazel_versions.py)" >> $GITHUB_OUTPUT | |
outputs: | |
# Will look like ["<version from .bazelversion>","<version from bazel_versions.bzl>"] | |
bazelversions: ${{ steps.versions_from_bazel_versions_bzl.outputs.bazelversions }} | |
matrix-prep-zigversion: | |
# Prepares the 'zigversion' axis of the test matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: versions_from_zig_versions_json | |
run: | | |
# https://stackoverflow.com/a/75770668/841562 by tlwhitec | |
# license https://creativecommons.org/licenses/by-sa/4.0/ | |
jq_semver_cmp=' | |
def opt(f): | |
. as $in | try f catch $in; | |
def semver_cmp: | |
sub("\\+.*$"; "") | |
| capture("^(?<v>[^-]+)(?:-(?<p>.*))?$") | [.v, .p // empty] | |
| map(split(".") | map(opt(tonumber))) | |
| .[1] |= (. // {});' | |
echo "zigversions=$(jq -c "$jq_semver_cmp"'keys|sort_by(semver_cmp)|reverse' zig/private/versions.json)" >> $GITHUB_OUTPUT | |
outputs: | |
# Sorted in descending semver order. | |
zigversions: ${{ steps.versions_from_zig_versions_json.outputs.zigversions }} | |
test-bazel-versions: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
needs: | |
- matrix-prep-bazelversion | |
- matrix-prep-zigversion | |
# Run bazel test in each workspace with each version of Bazel supported | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
bazelVersion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }} | |
zigVersion: | |
- ${{ fromJSON(needs.matrix-prep-zigversion.outputs.zigversions)[0] }} | |
bzlmodEnabled: [true, false] | |
folder: | |
- "." | |
- "e2e/workspace" | |
targetPattern: ["//..."] | |
# Configure a human readable name for each job | |
name: Test ${{ matrix.targetPattern }} in ${{ matrix.folder }} with Zig ${{ matrix.zigVersion }}, Bazel ${{ matrix.bazelVersion }}, and bzlmod ${{ matrix.bzlmodEnabled }} on ${{ matrix.os }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test | |
with: | |
os: ${{ matrix.os }} | |
folder: ${{ matrix.folder }} | |
bazelVersion: ${{ matrix.bazelVersion }} | |
bzlmodEnabled: ${{ matrix.bzlmodEnabled }} | |
# Disable documentation generation for all but the first Bazel | |
# version, by setting --no@rules_zig//docs:build_docs in | |
# .bazelrc.user. The generated documentation can vary between Bazel | |
# versions. For example, Bazel version 7 changed the documentation of | |
# the implicit `repo_mapping` parameter to repository rules compared | |
# to Bazel version 6. | |
docsEnabled: ${{ matrix.bazelVersion == fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} | |
zigVersion: ${{ matrix.zigVersion }} | |
targetPattern: ${{ matrix.targetPattern }} | |
buildbuddyApiKey: ${{ secrets.BUILDBUDDY_API_KEY }} | |
test-zig-versions: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
needs: | |
- matrix-prep-bazelversion | |
- matrix-prep-zigversion | |
# Run bazel test in each workspace with each version of Bazel supported | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
bazelVersion: | |
- ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} | |
zigVersion: ${{ fromJSON(needs.matrix-prep-zigversion.outputs.zigversions) }} | |
bzlmodEnabled: [true, false] | |
folder: | |
- "." | |
- "e2e/workspace" | |
targetPattern: ["//..."] | |
exclude: | |
# This combination is already tested in test-bazel-versions | |
- bazelVersion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} | |
zigVersion: ${{ fromJSON(needs.matrix-prep-zigversion.outputs.zigversions)[0] }} | |
# Configure a human readable name for each job | |
name: Test ${{ matrix.targetPattern }} in ${{ matrix.folder }} with Zig ${{ matrix.zigVersion }}, Bazel ${{ matrix.bazelVersion }}, and bzlmod ${{ matrix.bzlmodEnabled }} on ${{ matrix.os }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test | |
with: | |
os: ${{ matrix.os }} | |
folder: ${{ matrix.folder }} | |
bazelVersion: ${{ matrix.bazelVersion }} | |
bzlmodEnabled: ${{ matrix.bzlmodEnabled }} | |
# Disable documentation generation for all but the first Bazel | |
# version, by setting --no@rules_zig//docs:build_docs in | |
# .bazelrc.user. The generated documentation can vary between Bazel | |
# versions. For example, Bazel version 7 changed the documentation of | |
# the implicit `repo_mapping` parameter to repository rules compared | |
# to Bazel version 6. | |
docsEnabled: ${{ matrix.bazelVersion == fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} | |
zigVersion: ${{ matrix.zigVersion }} | |
targetPattern: ${{ matrix.targetPattern }} | |
buildbuddyApiKey: ${{ secrets.BUILDBUDDY_API_KEY }} | |
integration-tests: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
needs: | |
- matrix-prep-bazelversion | |
- matrix-prep-zigversion | |
# Run bazel test in each workspace with each version of Bazel supported | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
bazelVersion: | |
- ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} | |
zigVersion: | |
- ${{ fromJSON(needs.matrix-prep-zigversion.outputs.zigversions)[0] }} | |
bzlmodEnabled: [true, false] | |
folder: ["."] | |
targetPattern: ["//zig/tests/integration_tests"] | |
# Configure a human readable name for each job | |
name: Test ${{ matrix.targetPattern }} in ${{ matrix.folder }} with Zig ${{ matrix.zigVersion }}, Bazel ${{ matrix.bazelVersion }}, and bzlmod ${{ matrix.bzlmodEnabled }} on ${{ matrix.os }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/test | |
with: | |
os: ${{ matrix.os }} | |
folder: ${{ matrix.folder }} | |
bazelVersion: ${{ matrix.bazelVersion }} | |
bzlmodEnabled: ${{ matrix.bzlmodEnabled }} | |
# Disable documentation generation for all but the first Bazel | |
# version, by setting --no@rules_zig//docs:build_docs in | |
# .bazelrc.user. The generated documentation can vary between Bazel | |
# versions. For example, Bazel version 7 changed the documentation of | |
# the implicit `repo_mapping` parameter to repository rules compared | |
# to Bazel version 6. | |
docsEnabled: ${{ matrix.bazelVersion == fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions)[0] }} | |
zigVersion: ${{ matrix.zigVersion }} | |
targetPattern: ${{ matrix.targetPattern }} | |
buildbuddyApiKey: ${{ secrets.BUILDBUDDY_API_KEY }} | |
all_tests: | |
runs-on: ubuntu-latest | |
needs: | |
- matrix-prep-bazelversion | |
- matrix-prep-zigversion | |
- test-bazel-versions | |
- test-zig-versions | |
- integration-tests | |
if: ${{ always() }} | |
steps: | |
- uses: cgrindel/[email protected] | |
# Skip on release flows when invoked through the release workflow. | |
# Otherwise gha_join_jobs discovers its own job in the job list and | |
# fails since it is not yet succeeded, but still in progress. | |
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |