diff --git a/.bazelrc b/.bazelrc index 086cf24..c90ef21 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,5 @@ # Import Aspect bazelrc presets -try-import %workspace%/.aspect/bazelrc/local/bazel7.bazelrc # will only work in bazel7+ +try-import %workspace%/.aspect/bazelrc/bazel7.bazelrc # will only work in bazel7+ import %workspace%/.aspect/bazelrc/bazel6.bazelrc # will only work in bazel6+ import %workspace%/.aspect/bazelrc/convenience.bazelrc import %workspace%/.aspect/bazelrc/correctness.bazelrc diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index cd9044e..4ffe2f7 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -6,40 +6,91 @@ on: pull_request: branches: [ main ] +concurrency: + # Cancel previous actions from the same PR or branch except 'main' branch. + # See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. + group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} + cancel-in-progress: ${{ github.ref_name != 'main' }} + + jobs: build-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: bazelbuild/setup-bazelisk@v1 - - run: bazel build --config=built-toolchain //... && bazel test --config=built-toolchain //... + - uses: actions/checkout@v4 + + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: | + import %workspace%/.github/workflows/ci.bazelrc + common --config=built-toolchain + + - run: bazel build //... && bazel test //... # TODO: deprecate by Jan 2025 https://bazel.build/release build-e2e-bazel-5: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: bazelbuild/setup-bazelisk@v1 + - uses: actions/checkout@v4 + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: import %workspace%/../../.github/workflows/ci.bazelrc - run: cd e2e/bazel-5 && bazel build //... build-e2e-bazel-6-nobzlmod: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: bazelbuild/setup-bazelisk@v1 + - uses: actions/checkout@v4 + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: import %workspace%/../../.github/workflows/ci.bazelrc - run: cd e2e/bazel-6 && bazel build //... build-e2e-bazel-6-bzlmod: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: bazelbuild/setup-bazelisk@v1 + - uses: actions/checkout@v4 + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: import %workspace%/../../.github/workflows/ci.bazelrc - run: cd e2e/bazel-6-bzlmod && bazel build //... build-e2e-bazel-7-nobzlmod: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: bazelbuild/setup-bazelisk@v1 + - uses: actions/checkout@v4 + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: import %workspace%/../../.github/workflows/ci-e2e.bazelrc - run: cd e2e/bazel-7 && bazel build //... diff --git a/.github/workflows/buildifier.yaml b/.github/workflows/buildifier.yaml index 4cbae96..bdefc3e 100644 --- a/.github/workflows/buildifier.yaml +++ b/.github/workflows/buildifier.yaml @@ -10,11 +10,27 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +concurrency: + # Cancel previous actions from the same PR or branch except 'main' branch. + # See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. + group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} + cancel-in-progress: ${{ github.ref_name != 'main' }} + + jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: bazelbuild/setup-bazelisk@v1 + + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: import %workspace%/.github/workflows/ci.bazelrc - name: buildifier run: bazel run //:buildifier.check diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc new file mode 100644 index 0000000..e1e5476 --- /dev/null +++ b/.github/workflows/ci.bazelrc @@ -0,0 +1,8 @@ +try-import %workspace%/.aspect/bazelrc/ci.bazelrc +try-import %workspace%/../../.aspect/bazelrc/ci.bazelrc + +# Debug where options came from +common --announce_rc + +# Allows tests to run bazelisk-in-bazel, since this is the cache folder used +common --test_env=XDG_CACHE_HOME diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2fc5140..bce9bfa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,10 +14,19 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: bazel-contrib/setup-bazel@0.8.5 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + bazelrc: import %workspace%/.github/workflows/ci.bazelrc + + - name: Build Binaries - run: | - bazel --bazelrc=.aspect/bazelrc/ci.bazelrc \ - build --config=release //tools/release + run: bazel build --config=release //tools/release - uses: actions/upload-artifact@v4 with: