fix: preserve path override behavior for old rules #1
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: "Build" | ||
"on": | ||
workflow_dispatch: | ||
inputs: | ||
## Runner to use | ||
runner: | ||
description: "Runner" | ||
type: string | ||
default: "ubuntu-latest" | ||
## Whether to build with bzlmod | ||
bzlmod: | ||
description: "Enable Bzlmod" | ||
type: boolean | ||
default: false | ||
## Whether to run tests | ||
tests: | ||
description: "Run Tests" | ||
type: boolean | ||
default: true | ||
## Whether we should run integration tests (main target) | ||
main: | ||
description: "Main target" | ||
type: boolean | ||
default: false | ||
## Bazel version to use | ||
bazel_version: | ||
description: "Bazel version" | ||
type: string | ||
default: "7.0.0-pre.20230724.1" | ||
## Configuration profile to use | ||
bazel_config: | ||
description: "Bazel profile" | ||
type: string | ||
default: "bazel7" | ||
workflow_call: | ||
inputs: | ||
runner: | ||
description: "Runner" | ||
type: string | ||
default: "ubuntu-latest" | ||
label: | ||
description: "Label" | ||
type: string | ||
default: "Ubuntu" | ||
bzlmod: | ||
description: "Enable Bzlmod" | ||
type: boolean | ||
default: false | ||
tests: | ||
description: "Run Tests" | ||
type: boolean | ||
default: true | ||
labs: | ||
description: "Skip Failures" | ||
type: boolean | ||
default: false | ||
bazel_version: | ||
description: "Bazel version" | ||
type: string | ||
default: "7.0.0-pre.20230724.1" | ||
bazel_config: | ||
description: "Bazel profile" | ||
type: string | ||
default: "bazel7" | ||
main: | ||
description: "Main target" | ||
type: boolean | ||
default: false | ||
secrets: | ||
## Secrets: BuildBuddy API key | ||
BUILDBUDDY_APIKEY: | ||
required: false | ||
## Secrets: Buildless API key | ||
BUILDLESS_APIKEY: | ||
required: false | ||
env: | ||
BUILDLESS_APIKEY: ${{ secrets.BUILDLESS_APIKEY }} | ||
BUILDBUDDY_APIKEY: ${{ secrets.BUILDBUDDY_APIKEY }} | ||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ${{ inputs.runner || 'ubuntu-latest' }} | ||
continue-on-error: ${{ inputs.labs }} | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
- name: "Setup: msbuild" | ||
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1 | ||
if: ${{ contains(inputs.runner, 'windows') }} | ||
- name: "Setup: Bazel" | ||
uses: bazelbuild/setup-bazelisk@95c9bf48d0c570bb3e28e57108f3450cd67c1a44 # v2.0.0 | ||
- name: "Setup: Cache" | ||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | ||
with: | ||
path: "~/.cache/bazel" | ||
key: bazel-v3 | ||
- name: "Configure: Bazel Services" | ||
shell: bash | ||
if: contains(env.BUILDLESS_APIKEY || '', 'user_') | ||
run: | | ||
echo "build --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_APIKEY }}" >> local.bazelrc | ||
echo "build --remote_header=x-api-key=${{ secrets.BUILDLESS_APIKEY }}" >> local.bazelrc | ||
- name: "Configure: Bzlmod" | ||
if: inputs.bzlmod | ||
run: | | ||
echo "build --config=bzlmod" >> local.bazelrc | ||
- name: "Build: Project" | ||
continue-on-error: ${{ inputs.labs }} | ||
shell: bash | ||
run: bazel build --config=ci "//example/native" | ||
integration-tests: | ||
name: "Tests / ${{ inputs.label }} / ${{ matrix.label }}" | ||
runs-on: ${{ inputs.runner || 'ubuntu-latest' }} | ||
continue-on-error: ${{ inputs.labs || matrix.labs }} | ||
if: inputs.main | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
label: ["BCR"] | ||
target: ["sample"] | ||
action: ["build"] | ||
directory: ["./example/integration_tests/bzlmod"] | ||
labs: [false] | ||
skip: [false] | ||
include: | ||
# Test: BCR Sample | ||
- label: BCR | ||
target: sample | ||
action: build | ||
directory: "./example/integration_tests/bzlmod" | ||
labs: false | ||
skip: false | ||
# Test: Workspace Sample | ||
- label: Workspace | ||
target: sample | ||
action: build | ||
directory: "./example/integration_tests/workspace" | ||
labs: false | ||
skip: false | ||
# Test: Bazel 4 | ||
- label: Bazel 4 | ||
target: sample | ||
action: build | ||
directory: "./example/integration_tests/bazel4" | ||
labs: false | ||
skip: ${{ contains(inputs.runner, "windows") }} | ||
# Test: Bazel 5 | ||
- label: Bazel 5 | ||
target: sample | ||
action: build | ||
directory: "./example/integration_tests/bazel5" | ||
labs: false | ||
skip: false | ||
# Test: Bazel 6 | ||
- label: Bazel 6 | ||
target: sample | ||
action: build | ||
directory: "./example/integration_tests/bazel6" | ||
labs: false | ||
skip: false | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 | ||
with: | ||
egress-policy: audit | ||
- name: "Setup: Checkout" | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
- name: "Setup: msbuild" | ||
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1 | ||
if: ${{ contains(inputs.runner, 'windows') }} | ||
- name: "Setup: Bazel" | ||
uses: bazelbuild/setup-bazelisk@95c9bf48d0c570bb3e28e57108f3450cd67c1a44 # v2.0.0 | ||
- name: "Configure: Bazel Version" | ||
shell: bash | ||
if: !matrix.skip && inputs.bazel_version != '' && inputs.bazel_config != '' | ||
run: | | ||
echo "${{ inputs.bazel_version }}" > .bazelversion | ||
echo "import %workspace%/tools/bazel/${{ inputs.bazel_config }}.bazelrc" > version.bazelrc | ||
- name: "Configure: Bazel Services" | ||
shell: bash | ||
if: contains(env.BUILDLESS_APIKEY || '', 'user_') | ||
run: | | ||
echo "build --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_APIKEY }}" >> local.bazelrc | ||
echo "build --remote_header=x-api-key=${{ secrets.BUILDLESS_APIKEY }}" >> local.bazelrc | ||
- name: "Test: ${{ matrix.label }}" | ||
if: matrix.skip == false | ||
continue-on-error: ${{ inputs.labs }} | ||
working-directory: ${{ matrix.directory }} | ||
shell: bash | ||
run: bazel ${{ matrix.action || 'build' }} "${{ matrix.target || '//...' }}" |