Skip to content

Commit

Permalink
chore: build fixes, buildbuddy, faster bazel builds
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Mar 18, 2024
1 parent 0d9a02c commit e1df68e
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

import tools/bazel.rc

29 changes: 29 additions & 0 deletions .github/bazel.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
common --announce_rc
common --enable_platform_specific_config
common --experimental_isolated_extension_usages

build:buildbuddy-ci --bes_results_url=https://skunkworks.buildbuddy.io/invocation/
build:buildbuddy-ci --bes_backend=grpcs://skunkworks.buildbuddy.io
build:buildbuddy-ci --remote_cache=grpcs://skunkworks.buildbuddy.io
build:buildbuddy-ci --remote_timeout=3600
build:buildbuddy-ci --remote_download_minimal
build:buildbuddy-ci --noslim_profile
build:buildbuddy-ci --nolegacy_important_outputs

build:buildbuddy-ci --experimental_remote_cache_compression
build:buildbuddy-ci --experimental_remote_build_event_upload=minimal
build:buildbuddy-ci --experimental_profile_include_target_label
build:buildbuddy-ci --experimental_profile_include_primary_output
build:buildbuddy-ci --experimental_inmemory_jdeps_files
build:buildbuddy-ci --experimental_inmemory_dotd_files

build:remote-exec --remote_executor=grpcs://skunkworks.buildbuddy.io

build --config=buildbuddy-ci

build:ci-metadata --build_metadata=ROLE=CI
build:ci-metadata --build_metadata=HOST=gha
build:ci-metadata --build_metadata=VISIBILITY=PUBLIC
build:ci-metadata --build_metadata=REPO_URL=https://github.com/elide-dev/jpms.git

build --config=ci-metadata
5 changes: 5 additions & 0 deletions .github/bazel.workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
http_archive(
name = "rbe_default",
sha256 = "cdffa3b0fbf72c361d10937c41f2ca2274efd234e3757b011b48ac0ced13be03",
url = "https://dl.less.build/toolchains/bazel/rbe/elidecloud-v4a-ubuntu23.10.tgz",
)
1 change: 1 addition & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ github_checks:
annotations: true

ignore:
- "jdk"
- "samples"
- "tools/processor"
- "tools/substrate/injekt"
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci.build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ name: "Build & Test"
CODECOV_TOKEN:
description: "Codecov Token"
required: false
BUILDBUDDY_APIKEY:
description: "BuildBuddy API Key"
required: false

workflow_dispatch: {}

Expand Down Expand Up @@ -62,6 +65,12 @@ jobs:
.m2
~/.cache/bazel
key: jpms-attic-v1-${{ runner.os }}
- name: "Setup: BuildBuddy"
run: echo "build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_KEY" >> ./.github/bazel.rc
env:
BUILDBUDDY_KEY: ${{ secrets.BUILDBUDDY_APIKEY }}
- name: "Setup: Bazel Configuration"
run: cp -fv ./.github/bazel.rc ./tools/bazel.rc
- name: "Build & Test Repository"
run: make TESTS=${{ inputs.tests && 'yes' || 'no' }} SIGNING=no JAVADOC=no SNAPSHOT=yes
- name: "Reporting: Code Coverage"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ jobs:
with:
name: ${{ needs.provenance.outputs.provenance-name }}
- name: "Publish to Registry"
if: !inputs.dry-run
run: cd packages/${{ inputs.package }} && pnpm run ${{ inputs.dry-run && 'publish:dry' || 'publish:live' }} --registry=${{ inputs.registry }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
25 changes: 11 additions & 14 deletions .github/workflows/ci.publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ permissions:
jobs:
publish-npm:
name: "Publish to NPM (${{ matrix.package }})"
runs-on: ubuntu-latest
uses: ./.github/workflows/ci.publish-package.yml
permissions:
actions: read
id-token: write
Expand All @@ -88,16 +88,13 @@ jobs:
fail-fast: false
matrix:
package: ["java", "gradle", "maven"]
steps:
- name: "Publish Package"
uses: ./.github/workflows/ci.publish-package.yml
with:
package: ${{ matrix.package }}
dry-run: ${{ inputs.dry-run }}
registry: ${{ inputs.registry }}
release: ${{ inputs.release }}
tag: ${{ inputs.tag }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
release-name: ${{ inputs.release-name }}
release-latest: ${{ inputs.release-latest }}
with:
package: ${{ matrix.package }}
dry-run: ${{ inputs.dry-run }}
registry: ${{ inputs.registry }}
release: ${{ inputs.release }}
tag: ${{ inputs.tag }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
release-name: ${{ inputs.release-name }}
release-latest: ${{ inputs.release-latest }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ vendor
node_modules/
web/
packages/*/*.tgz
local.bazelrc
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,18 @@ org.reactivestreams/api/build/libs:
publishAllPublicationsToMavenLocalRepository \
&& echo "Reactive Streams ready."


#
# Library: Protocol Buffers ----------------------------------------------------------------

protobuf: com.google.protobuf ## Build Protocol Buffers.
com.google.protobuf: com.google.protobuf/bazel-bin/java/core/amended_core_mvn-project.jar
com.google.protobuf/bazel-bin/java/core/amended_core_mvn-project.jar:
$(info Building Protocol Buffers...)
$(RULE)rm -f com.google.protobuf/.bazelrc
$(RULE)cd com.google.protobuf && $(GIT) checkout .bazelrc
$(RULE)$(CP) tools/project.bazelrc com.google.protobuf/project.bazelrc
$(RULE)$(CP) tools/bazel.rc com.google.protobuf/jpms.bazelrc
$(RULE)echo "import %workspace%/project.bazelrc" >> com.google.protobuf/.bazelrc
$(RULE)cd com.google.protobuf \
&& $(BAZEL) \
build \
Expand Down Expand Up @@ -484,6 +488,11 @@ dev: $(DEV_LOCAL) ## Setup local development tooling.
$(DEV_LOCAL):
@echo "Setting up local dev root..."
$(RULE)$(MKDIR) -p $(DEV_ROOT) $(DEV_BIN)
$(RULE)rm -f com.google.protobuf/.bazelrc
$(RULE)cd com.google.protobuf && $(GIT) checkout .bazelrc
$(RULE)$(CP) tools/project.bazelrc com.google.protobuf/project.bazelrc
$(RULE)$(CP) tools/bazel.rc com.google.protobuf/jpms.bazelrc
$(RULE)echo "import %workspace%/project.bazelrc" >> com.google.protobuf/.bazelrc
@echo "Building 'protoc'..."
$(RULE)cd com.google.protobuf && $(BAZEL) build //:protoc
@echo "Mounting 'protoc'..."
Expand Down
4 changes: 4 additions & 0 deletions local.bazelrc.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

## Add API keys below.
build --remote_header=

24 changes: 24 additions & 0 deletions tools/bazel.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
common --enable_platform_specific_config
common --experimental_isolated_extension_usages

build:buildbuddy --bes_results_url=https://skunkworks.buildbuddy.io/invocation/
build:buildbuddy --bes_backend=grpcs://skunkworks.buildbuddy.io
build:buildbuddy --remote_cache=grpcs://skunkworks.buildbuddy.io
build:buildbuddy --remote_timeout=3600
build:buildbuddy --remote_download_minimal

build:buildbuddy --experimental_remote_cache_compression
build:buildbuddy --experimental_remote_build_event_upload=minimal
build:buildbuddy --experimental_profile_include_target_label
build:buildbuddy --experimental_profile_include_primary_output
build:buildbuddy --experimental_inmemory_jdeps_files
build:buildbuddy --experimental_inmemory_dotd_files

build:remote-exec --remote_executor=grpcs://skunkworks.buildbuddy.io

build --config=buildbuddy
build --config=remote-exec

build:local-metadata --build_metadata=REPO_URL=https://github.com/elide-dev/jpms.git

build --config=local-metadata
2 changes: 2 additions & 0 deletions tools/project.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

import %workspace%/jpms.bazelrc

0 comments on commit e1df68e

Please sign in to comment.