chore: align ci patterns (#843)

This commit is contained in:
Greg Magolan 2024-05-13 23:51:10 -07:00 committed by GitHub
parent 155e3f250e
commit ffc5a7bfa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 387 additions and 200 deletions

1
.aspect/bazelrc/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
user.bazelrc

View File

@ -4,22 +4,7 @@ workspaces:
.: .:
tasks: tasks:
- test: - test:
e2e/smoke: e2e/copy_action:
icon: bazel
tasks:
- test:
queue: bazel-lib-small
- format:
without: true
- gazelle:
without: true
- configure:
without: true
- buildifier:
without: true
- delivery:
without: true
e2e/coreutils:
icon: bazel icon: bazel
tasks: tasks:
- test: - test:
@ -49,6 +34,21 @@ workspaces:
without: true without: true
- delivery: - delivery:
without: true without: true
e2e/coreutils:
icon: bazel
tasks:
- test:
queue: bazel-lib-small
- format:
without: true
- gazelle:
without: true
- configure:
without: true
- buildifier:
without: true
- delivery:
without: true
e2e/external_copy_to_directory: e2e/external_copy_to_directory:
icon: bazel icon: bazel
tasks: tasks:
@ -64,6 +64,21 @@ workspaces:
without: true without: true
- delivery: - delivery:
without: true without: true
e2e/smoke:
icon: bazel
tasks:
- test:
queue: bazel-lib-small
- format:
without: true
- gazelle:
without: true
- configure:
without: true
- buildifier:
without: true
- delivery:
without: true
tasks: tasks:
- test: - test:
hooks: hooks:

View File

@ -11,6 +11,7 @@ import %workspace%/.aspect/bazelrc/performance.bazelrc
# For testing our --stamp behavior. # For testing our --stamp behavior.
# Normally users would use a --workspace_status_command with a script that calls `git describe`. # Normally users would use a --workspace_status_command with a script that calls `git describe`.
build --embed_label=v1.2.3 build --embed_label=v1.2.3
# Mock versioning command to test the --stamp behavior # Mock versioning command to test the --stamp behavior
build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3" build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3"

View File

@ -35,6 +35,19 @@ workflows:
equal: equal:
- scheduled_pipeline - scheduled_pipeline
- << pipeline.trigger_source >> - << pipeline.trigger_source >>
aspect-workflows-e2e-copy_action:
jobs:
- aw-e2e_copy_action_test:
context: []
delivery_manifest: false
workspace: e2e/copy_action
when:
and:
- not: << pipeline.parameters.perform_delivery >>
- not:
equal:
- scheduled_pipeline
- << pipeline.trigger_source >>
aspect-workflows-e2e-copy_to_directory: aspect-workflows-e2e-copy_to_directory:
jobs: jobs:
- aw-e2e_copy_to_directory_test: - aw-e2e_copy_to_directory_test:
@ -321,6 +334,105 @@ jobs:
no_output_timeout: 10m no_output_timeout: 10m
when: always when: always
working_directory: /mnt/ephemeral/workdir working_directory: /mnt/ephemeral/workdir
aw-e2e_copy_action_test:
environment:
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >>
XDG_CACHE_HOME: /mnt/ephemeral/caches
machine: true
parameters:
delivery_manifest:
default: true
type: boolean
workspace:
type: string
resource_class: aspect-build/bazel-lib-small
steps:
- run:
command: /etc/aspect/workflows/bin/configure_workflows_env
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Configure Workflows
- checkout
- run:
command: rm -rf /workflows/artifacts /workflows/testlogs
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Prepare archive directories
- run:
command: /etc/aspect/workflows/bin/agent_health_check
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Agent health checks
no_output_timeout: 180m
- run:
command: rosetta run test --workspace << parameters.workspace >>
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Test
no_output_timeout: 180m
- store_test_results:
path: /workflows/testlogs
- when:
condition:
and:
- <<parameters.delivery_manifest>>
- or:
- matches:
pattern: ^main$
value: << pipeline.git.branch >>
steps:
- run:
command: rosetta run delivery_manifest --workspace << parameters.workspace
>> --data TARGETS_SOURCE=test
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Delivery Manifest
no_output_timeout: 180m
- store_artifacts:
path: /workflows/testlogs
- store_artifacts:
path: /workflows/artifacts
- store_artifacts:
path: vmstat.out
- run:
command: rosetta run finalization
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Finalization
no_output_timeout: 10m
when: always
working_directory: /mnt/ephemeral/workdir
aw-e2e_copy_to_directory_test: aw-e2e_copy_to_directory_test:
environment: environment:
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
@ -1041,6 +1153,17 @@ jobs:
XDG_CACHE_HOME: /mnt/ephemeral/caches XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Agent health checks name: Agent health checks
no_output_timeout: 180m no_output_timeout: 180m
- run:
command: rosetta run warming --workspace e2e/smoke
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Create warming archive for e2e/smoke
no_output_timeout: 180m
- run: - run:
command: rosetta run warming --workspace e2e/external_copy_to_directory command: rosetta run warming --workspace e2e/external_copy_to_directory
environment: environment:
@ -1052,17 +1175,6 @@ jobs:
XDG_CACHE_HOME: /mnt/ephemeral/caches XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Create warming archive for e2e/external_copy_to_directory name: Create warming archive for e2e/external_copy_to_directory
no_output_timeout: 180m no_output_timeout: 180m
- run:
command: rosetta run warming --workspace e2e/copy_to_directory
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Create warming archive for e2e/copy_to_directory
no_output_timeout: 180m
- run: - run:
command: rosetta run warming --workspace e2e/coreutils command: rosetta run warming --workspace e2e/coreutils
environment: environment:
@ -1075,7 +1187,7 @@ jobs:
name: Create warming archive for e2e/coreutils name: Create warming archive for e2e/coreutils
no_output_timeout: 180m no_output_timeout: 180m
- run: - run:
command: rosetta run warming --workspace e2e/smoke command: rosetta run warming --workspace e2e/copy_to_directory
environment: environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >> ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
@ -1083,7 +1195,18 @@ jobs:
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Create warming archive for e2e/smoke name: Create warming archive for e2e/copy_to_directory
no_output_timeout: 180m
- run:
command: rosetta run warming --workspace e2e/copy_action
environment:
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_NUMBER: << pipeline.number >>
ASPECT_WORKFLOWS_CIRCLE_PIPELINE_PROJECT_TYPE: << pipeline.project.type
>>
ASPECT_WORKFLOWS_CIRCLE_WORKFLOW_BASE_NAME: aspect-workflows
ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml
XDG_CACHE_HOME: /mnt/ephemeral/caches
name: Create warming archive for e2e/copy_action
no_output_timeout: 180m no_output_timeout: 180m
- run: - run:
command: rosetta run warming --workspace . command: rosetta run warming --workspace .

View File

@ -1,21 +1,20 @@
# Bazel options included on CI using the --bazelrc Bazel flag # Directories caches by GitHub actions
common:local --disk_cache=~/.cache/bazel-disk-cache
common --repository_cache=~/.cache/bazel-repository-cache
# CI specific caching options # Debug where options came from
build --repository_cache=~/.cache/bazel-repo common --announce_rc
test --test_env=XDG_CACHE_HOME
# When no remote cache, use a local one # Allows tests to run bazelisk-in-bazel, since this is the cache folder used
build:local --disk_cache=~/.cache/bazel common --test_env=XDG_CACHE_HOME
# Remote build execution # Remote build execution
build:rbe --extra_execution_platforms=@aspect_bazel_lib//platforms:x86_64_linux_remote build:rbe --extra_execution_platforms=@aspect_bazel_lib//platforms:x86_64_linux_remote
build:rbe --genrule_strategy=remote
build:rbe --host_platform=@aspect_bazel_lib//platforms:x86_64_linux_remote build:rbe --host_platform=@aspect_bazel_lib//platforms:x86_64_linux_remote
build:rbe --jobs=32 build:rbe --jobs=32
# BuildBuddy remote exec # BuildBuddy remote exec
build:rbe --bes_results_url=https://app.buildbuddy.io/invocation/ build:rbe --bes_results_url=https://app.buildbuddy.io/invocation/
build:rbe --bes_backend=grpcs://remote.buildbuddy.io build:rbe --bes_backend=grpcs://remote.buildbuddy.io
build:rbe --remote_timeout=3600
build:rbe --remote_executor=grpcs://remote.buildbuddy.io build:rbe --remote_executor=grpcs://remote.buildbuddy.io
test --test_output=errors

View File

@ -18,78 +18,66 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'main' }} cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs: jobs:
# matrix-prep-* steps dynamically generate a bit of JSON depending on whether our action has # Prepares dynamic test matrix values
# access to repository secrets. When running on a pull_request from a fork, the author is matrix-prep:
# untrusted so the secret will be absent. 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-config:
# Prepares the 'config' axis of the test matrix
runs-on: ubuntu-latest
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
steps:
- id: local
run: echo "config=local" >> $GITHUB_OUTPUT
- id: rbe
run: echo "config=rbe" >> $GITHUB_OUTPUT
# Don't run RBE if there is no API key which is the case on forks
if: ${{ env.BUILDBUDDY_API_KEY != '' }}
outputs:
# Will look like '["local", "rbe"]'
configs: ${{ toJSON(steps.*.outputs.config) }}
matrix-prep-bazelversion:
# Prepares the 'bazelversion' axis of the test matrix
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- id: bazel_7 - id: bazel-version
run: echo "bazelversion=$(head -n 1 .bazelversion)" >> $GITHUB_OUTPUT name: Prepare 'bazel-version' matrix axis
- id: bazel_6 run: |
run: echo "bazelversion=6.5.0" >> $GITHUB_OUTPUT v=$(head -n 1 .bazelversion)
outputs: m=${v::1}
# Will look like '["<version from .bazelversion>", ...]' a=(
bazelversions: ${{ toJSON(steps.*.outputs.bazelversion) }} "major:$m, version:\"$v\""
"major:6, version:\"6.5.0\""
matrix-prep-os: )
# Prepares the 'os' axis of the test matrix printf -v j '{%s},' "${a[@]}"
runs-on: ubuntu-latest echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
steps: - id: config
- uses: actions/checkout@v4 name: Prepare 'config' matrix axis
- id: linux # Don't run RBE if there is no API key which is the case on forks.
run: echo "os=ubuntu-latest" >> $GITHUB_OUTPUT run: |
- id: macos a=( local )
run: echo "os=macos-latest" >> $GITHUB_OUTPUT if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"rbe"* ]]; then
# Only run on main branch (or PR branches that contain 'macos') to minimize macOS minutes (billed at 10X) if [[ "${{ env.BUILDBUDDY_API_KEY }}" ]]; then
a+=( rbe )
fi
fi
printf -v j '"%s",' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
env:
BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }}
- id: os
name: Prepare 'os' matrix axis
# Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes # https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
if: ${{ github.ref == 'refs/heads/main' || contains(github.head_ref, 'macos') }} run: |
- id: windows a=( ubuntu )
run: echo "os=windows-latest" >> $GITHUB_OUTPUT if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"macos"* ]]; then
# Only run on main branch (or PR branches that contain 'windows') to minimize Windows minutes (billed at 2X) a+=( macos )
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes fi
if: ${{ github.ref == 'refs/heads/main' || contains(github.head_ref, 'windows') }} if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"windows"* ]]; then
a+=( windows )
fi
printf -v j '"%s",' "${a[@]}"
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
outputs: outputs:
# Will look like ["ubuntu-latest", "macos-latest", "windows-latest"] bazel-version: ${{ steps.bazel-version.outputs.res }}
os: ${{ toJSON(steps.*.outputs.os) }} config: ${{ steps.config.outputs.res }}
os: ${{ steps.os.outputs.res }}
test: test:
# The type of runner that the job will run on runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
needs: needs:
- matrix-prep-config - matrix-prep
- matrix-prep-bazelversion
- matrix-prep-os
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
config: ${{ fromJSON(needs.matrix-prep-config.outputs.configs) }} bazel-version: ${{ fromJSON(needs.matrix-prep.outputs.bazel-version) }}
bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }}
os: ${{ fromJSON(needs.matrix-prep-os.outputs.os) }}
bzlmod: [1, 0] bzlmod: [1, 0]
os: ${{ fromJSON(needs.matrix-prep.outputs.os) }}
config: ${{ fromJSON(needs.matrix-prep.outputs.config) }}
folder: folder:
- "." - "."
- "e2e/copy_action" - "e2e/copy_action"
@ -99,23 +87,33 @@ jobs:
- "e2e/smoke" - "e2e/smoke"
- "e2e/write_source_files" - "e2e/write_source_files"
exclude: exclude:
# Don't test MacOS with RBE to minimize MacOS minutes (billed at 10X) # Don't test MacOS and Windows against secondary bazel version to minimize minutes (billed at 10X and 2X respectively)
- config: rbe # https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
os: macos-latest - os: macos
# Don't test MacOS with Bazel 6 to minimize MacOS minutes (billed at 10X) bazel-version:
- bazelversion: 6.5.0 major: 6
os: macos-latest - os: windows
# Don't test Windows with RBE to minimize Windows minutes (billed at 2X) bazel-version:
- config: rbe major: 6
os: windows-latest # Don't run RBE tests with Bazel 6 to reduce the size of the test matrix
# Don't test Windows with Bazel 6 to minimize Windows minutes (billed at 2X) - bazel-version:
- bazelversion: 6.5.0 major: 6
os: windows-latest config: rbe
# Don't run bzlmod tests with Bazel 6 to reduce the size of the test matrix
- bazel-version:
major: 6
bzlmod: 1
# Don't test RBE with on MacOS (not configured)
- os: macos
config: rbe
# Don't test RBE with on Windows (not configured)
- os: windows
config: rbe
# TODO: green up root Workspace on MacOS & Windows # TODO: green up root Workspace on MacOS & Windows
- folder: . - folder: .
os: macos-latest os: macos
- folder: . - folder: .
os: windows-latest os: windows
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -124,10 +122,11 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: | path: |
~/.cache/bazel ~/.cache/bazel-disk-cache
~/.cache/bazel-repo ~/.cache/bazel-repository-cache
key: bazel-cache-${{ matrix.os }}-${{ matrix.bazelversion }}-${{ matrix.folder }}-${{ matrix.bzlmodEnabled }}-${{ matrix.config }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', 'MODULE.bazel.lock') }} ~/.cache/xdg-cache
restore-keys: bazel-cache-${{ matrix.os }}-${{ matrix.bazelversion }}-${{ matrix.folder }}-${{ matrix.bzlmodEnabled }}-${{ matrix.config }}- key: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }}
restore-keys: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
- name: Configure Bazel version - name: Configure Bazel version
working-directory: ${{ matrix.folder }} working-directory: ${{ matrix.folder }}
@ -136,7 +135,7 @@ jobs:
# Overwrite the .bazelversion instead of using USE_BAZEL_VERSION so that Bazelisk # Overwrite the .bazelversion instead of using USE_BAZEL_VERSION so that Bazelisk
# still bootstraps Aspect CLI from configuration in .bazeliskrc. Aspect CLI will # still bootstraps Aspect CLI from configuration in .bazeliskrc. Aspect CLI will
# then use .bazelversion to determine which Bazel version to use. # then use .bazelversion to determine which Bazel version to use.
echo "${{ matrix.bazelversion }}" > .bazelversion echo "${{ matrix.bazel-version.version }}" > .bazelversion
# Delete all the version specific bazelrc files that are used for local development # Delete all the version specific bazelrc files that are used for local development
# since the version we're testing against is dynamic. These are just symlinks and the # since the version we're testing against is dynamic. These are just symlinks and the
# root .bazelrc brings these in with try-imports. In this CI workflows, we explicitly # root .bazelrc brings these in with try-imports. In this CI workflows, we explicitly
@ -155,7 +154,7 @@ jobs:
# TODO: remove this block once we have Aspect CLI Windows releases # TODO: remove this block once we have Aspect CLI Windows releases
- name: Don't use Aspect CLI on Windows - name: Don't use Aspect CLI on Windows
if: matrix.os == 'windows-latest' if: matrix.os == 'windows'
working-directory: ${{ matrix.folder }} working-directory: ${{ matrix.folder }}
shell: bash shell: bash
run: rm -f .bazeliskrc run: rm -f .bazeliskrc
@ -164,26 +163,25 @@ jobs:
working-directory: ${{ matrix.folder }} working-directory: ${{ matrix.folder }}
shell: bash shell: bash
run: | run: |
BAZEL_VERSION=${{ matrix.bazelversion }}
bazel \ bazel \
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/bazel${BAZEL_VERSION::1}.bazelrc \ --bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/bazel${{ matrix.bazel-version.major }}.bazelrc \
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/ci.bazelrc \ --bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/ci.bazelrc \
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \ --bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \
test \ test \
--config=${{ matrix.config }} \ --config=${{ matrix.config }} \
--test_tag_filters=-skip-on-bazel${BAZEL_VERSION::1} \ --test_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \
--build_tag_filters=-skip-on-bazel${BAZEL_VERSION::1} \ --build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \
--enable_bzlmod=${{ matrix.bzlmod }} \ --enable_bzlmod=${{ matrix.bzlmod }} \
//... //...
env: env:
XDG_CACHE_HOME: ~/.cache/xdg-cache # bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/xdg-cache # bazelisk will download bazel to here
- name: integration tests - name: Integration tests
# Don't run integration tests on Windows since they are bash scripts and Windows runs Powershell # Don't run integration tests on Windows since they are bash scripts and Windows runs Powershell
if: matrix.folder == '.' && matrix.os != 'windows-latest' && matrix.bazelversion != '6.5.0' if: matrix.folder == '.' && matrix.os != 'windows' && matrix.bazel-version.major != '6'
# Find all shell scripts within e2e, echo the filename, execute, fail on error # Find all shell scripts within e2e, echo the filename, execute, fail on error
run: find e2e/*.sh -maxdepth 1 -type f -exec sh -c 'echo "\n\n------------------------------- $0 -------------------------------" && BZLMOD_FLAG=${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} "$0" || kill $PPID' \{\} \; run: find e2e/*.sh -maxdepth 1 -type f -exec sh -c 'echo "\n\n------------------------------- $0 -------------------------------" && BZLMOD_FLAG=${{ steps.set_bzlmod_flag.outputs.bzlmod_flag }} "$0" || kill $PPID' \{\} \;
- name: verify bcr patches - name: Verify bcr patches
if: matrix.bzlmod == '1' && matrix.os == 'ubuntu-latest' if: matrix.folder == '.' && matrix.bzlmod == '1' && matrix.os == 'ubuntu' && matrix.bazel-version.major != '6'
run: patch --dry-run -p1 < .bcr/patches/*.patch run: patch --dry-run -p1 < .bcr/patches/*.patch

View File

@ -20,7 +20,7 @@ jobs:
path: | path: |
~/.cache/bazel ~/.cache/bazel
~/.cache/bazel-repo ~/.cache/bazel-repo
key: bazel-cache-release-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', 'MODULE.bazel.lock') }} key: bazel-cache-release-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }}
restore-keys: bazel-cache-release- restore-keys: bazel-cache-release-
- name: bazel test //... (release) - name: bazel test //... (release)
env: env:

21
.gitignore vendored
View File

@ -1,13 +1,18 @@
bazel-* bazel-*
**/.terraform/* .bazelrc.user
test-out/ test-out/
.idea/
.ijwb/
.vscode
.DS_Store .DS_Store
# Don't commit lockfile for now as it is unstable. Do allow for it to be # Bazel's MODULE lockfile isn't ready to check in yet as of Bazel 7.1.
# created, however, since it gives a performance boost for local development. # Do allow for it to be created, however, since it gives a performance boost for local development.
# https://github.com/bazelbuild/bazel/issues/19026 # [Store resolved repository attributes in the Bzlmod lockfile](https://github.com/bazelbuild/bazel/issues/19026)
# https://github.com/bazelbuild/bazel/issues/19621 # [MODULE.bazel.lock file contains user specific paths](https://github.com/bazelbuild/bazel/issues/19621)
# https://github.com/bazelbuild/bazel/issues/19971 # [Consider skipping bazel_tools@_ from lockfile](https://github.com/bazelbuild/bazel/issues/19971)
# https://github.com/bazelbuild/bazel/issues/20272 # [MODULE.bazel.lock file "reads through" already-locked package manager](https://github.com/bazelbuild/bazel/issues/20272)
# https://github.com/bazelbuild/bazel/issues/20369 # [moduleFileHash in MODULE.bazel.lock causes frequent Git merge conflicts](https://github.com/bazelbuild/bazel/issues/20369)
MODULE.bazel.lock MODULE.bazel.lock

View File

@ -15,7 +15,7 @@ repos:
- id: buildifier-lint - id: buildifier-lint
# Enforce that commit messages allow for later changelog generation # Enforce that commit messages allow for later changelog generation
- repo: https://github.com/commitizen-tools/commitizen - repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0 rev: v3.24.0
hooks: hooks:
# Requires that commitizen is already installed # Requires that commitizen is already installed
- id: commitizen - id: commitizen

View File

@ -75,13 +75,10 @@ buildifier_prebuilt_register_toolchains()
load( load(
"@aspect_rules_lint//format:repositories.bzl", "@aspect_rules_lint//format:repositories.bzl",
"fetch_shfmt", "fetch_shfmt",
"fetch_terraform",
) )
fetch_shfmt() fetch_shfmt()
fetch_terraform()
load("//.aspect/workflows:deps.bzl", "fetch_workflows_deps") load("//.aspect/workflows:deps.bzl", "fetch_workflows_deps")
fetch_workflows_deps() fetch_workflows_deps()

View File

@ -0,0 +1,15 @@
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/local/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc

View File

@ -1,11 +1,7 @@
module( bazel_dep(name = "aspect_bazel_lib", version = "0.0.0", dev_dependency = True)
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
local_path_override( local_path_override(
module_name = "aspect_bazel_lib", module_name = "aspect_bazel_lib",
path = "../..", path = "../..",
) )
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

View File

@ -0,0 +1,15 @@
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/local/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc

View File

@ -1,12 +1,7 @@
module( bazel_dep(name = "aspect_bazel_lib", version = "0.0.0", dev_dependency = True)
name = "copy_to_directory",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
local_path_override( local_path_override(
module_name = "aspect_bazel_lib", module_name = "aspect_bazel_lib",
path = "../..", path = "../..",
) )
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

View File

@ -0,0 +1,15 @@
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/local/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc

View File

@ -1,14 +1,8 @@
module( bazel_dep(name = "aspect_bazel_lib", version = "0.0.0", dev_dependency = True)
name = "coreutils",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
local_path_override( local_path_override(
module_name = "aspect_bazel_lib", module_name = "aspect_bazel_lib",
path = "../..", path = "../..",
) )
bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains") bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains", dev_dependency = True)
use_repo(bazel_lib_toolchains, "coreutils_toolchains") use_repo(bazel_lib_toolchains, "coreutils_toolchains")

View File

@ -0,0 +1,15 @@
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/local/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc

View File

@ -1,12 +1,7 @@
module( bazel_dep(name = "aspect_bazel_lib", version = "0.0.0", dev_dependency = True)
name = "external_copy_to_directory",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
local_path_override( local_path_override(
module_name = "aspect_bazel_lib", module_name = "aspect_bazel_lib",
path = "../..", path = "../..",
) )
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

View File

@ -1,2 +1,18 @@
# for testing expand_template # Import Aspect bazelrc presets
build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3" try-import %workspace%/../../.aspect/bazelrc/local/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
# For testing expand_template
common --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3"
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc

View File

@ -1,12 +1,7 @@
module( bazel_dep(name = "aspect_bazel_lib", version = "0.0.0", dev_dependency = True)
name = "smoke",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
local_path_override( local_path_override(
module_name = "aspect_bazel_lib", module_name = "aspect_bazel_lib",
path = "../..", path = "../..",
) )
bazel_dep(name = "bazel_skylib", version = "1.5.0", dev_dependency = True)

View File

@ -0,0 +1,15 @@
# Import Aspect bazelrc presets
try-import %workspace%/../../.aspect/bazelrc/local/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/convenience.bazelrc
import %workspace%/../../.aspect/bazelrc/correctness.bazelrc
import %workspace%/../../.aspect/bazelrc/debug.bazelrc
import %workspace%/../../.aspect/bazelrc/javascript.bazelrc
import %workspace%/../../.aspect/bazelrc/performance.bazelrc
### YOUR PROJECT SPECIFIC OPTIONS GO HERE ###
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
try-import %workspace%/../../.aspect/bazelrc/user.bazelrc

View File

@ -1,14 +1,8 @@
module( bazel_dep(name = "aspect_bazel_lib", version = "0.0.0", dev_dependency = True)
name = "write_source_files",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
local_path_override( local_path_override(
module_name = "aspect_bazel_lib", module_name = "aspect_bazel_lib",
path = "../..", path = "../..",
) )
test_ext = use_extension("//:test_extension.bzl", "test_ext") test_ext = use_extension("//:test_extension.bzl", "test_ext", dev_dependency = True)
use_repo(test_ext, "test") use_repo(test_ext, "test")

View File

@ -17,23 +17,11 @@ alias(
visibility = ["//:__subpackages__"], visibility = ["//:__subpackages__"],
) )
alias(
name = "terraform",
actual = select({
"@bazel_tools//src/conditions:darwin_arm64": "@terraform_macos_aarch64//:terraform",
"@bazel_tools//src/conditions:darwin_x86_64": "@terraform_macos_x86_64//:terraform",
"@bazel_tools//src/conditions:linux": "@terraform_linux_x86_64//:terraform",
"//conditions:default": ":noop",
}),
visibility = ["//:__subpackages__"],
)
multi_formatter_binary( multi_formatter_binary(
name = "format", name = "format",
go = "@go_sdk//:bin/gofmt", go = "@go_sdk//:bin/gofmt",
sh = ":shfmt", sh = ":shfmt",
starlark = "@buildifier_prebuilt//:buildifier", starlark = "@buildifier_prebuilt//:buildifier",
tags = ["manual"], tags = ["manual"],
terraform = ":terraform",
visibility = ["//:__subpackages__"], visibility = ["//:__subpackages__"],
) )