diff --git a/.bazelrc b/.bazelrc index cdc4a9f..5a940c3 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,4 +1,6 @@ try-import user.bazelrc +try-import .buildbuddy-auth.rc + import .bazelrc-cc import .bazelrc-java import .bazelrc-buildbuddy diff --git a/.bazelrc-buildbuddy b/.bazelrc-buildbuddy index 8407ec6..6f1cbe3 100644 --- a/.bazelrc-buildbuddy +++ b/.bazelrc-buildbuddy @@ -1,10 +1,19 @@ build:remote --bes_results_url=https://app.buildbuddy.io/invocation/ build:remote --bes_backend=grpcs://remote.buildbuddy.io build:remote --remote_cache=grpcs://remote.buildbuddy.io -build:remote --remote_download_toplevel # Helps remove network bottleneck if caching is enabled build:remote --remote_timeout=3600 +# Additional suggestions from buildbuddy for speed +build:remote --experimental_remote_cache_compression +build:remote --experimental_remote_cache_compression_threshold=100 +build:remote --noslim_profile +build:remote --experimental_profile_include_target_label +build:remote --experimental_profile_include_primary_output +build:remote --nolegacy_important_outputs + build --experimental_inmemory_jdeps_files build --experimental_inmemory_dotd_files +build:ci --config=remote build:ci --build_metadata=ROLE=CI +build:ci --remote_download_minimal diff --git a/.bazelrc-cc b/.bazelrc-cc index 12cbb14..7ca7094 100644 --- a/.bazelrc-cc +++ b/.bazelrc-cc @@ -7,6 +7,7 @@ build:windows --copt=/wd5105 build:windows --cxxopt=/wd4146 build:windows --cxxopt=/wd4267 build:windows --cxxopt=/wd4244 +build:windows --cxxopt=/utf-8 # Windows Arm build:windows_arm --copt=/W3 @@ -17,6 +18,7 @@ build:windows_arm --copt=/wd5105 build:windows_arm --cxxopt=/wd4146 build:windows_arm --cxxopt=/wd4267 build:windows_arm --cxxopt=/wd4244 +build:windows_arm --cxxopt=/utf-8 build:windows_arm --cpu=arm64_windows # Linux diff --git a/.bazelversion b/.bazelversion index 21c8c7b..643916c 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.1.1 +7.3.1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b5045a6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ + +# Generated files +MODULE.bazel.lock linguist-generated +maven_cpp_deps.bzl linguist-generated +maven_java_deps.bzl linguist-generated diff --git a/.github/workflows/auto_update.yml b/.github/workflows/auto_update.yml deleted file mode 100644 index 63503fc..0000000 --- a/.github/workflows/auto_update.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Auto Update -on: - workflow_dispatch: - schedule: - # Check everyday at 20:00 UTC - - cron: '0 20 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - auto_update_module: - name: "Auto Update Module" - runs-on: ubuntu-22.04 - steps: - - name: Set up Go 1.20.x - uses: actions/setup-go@v4 - with: - go-version: 1.20.x - id: go - - - uses: actions/checkout@v4 - - - name: Install Buildifier - run: | - cd $(mktemp -d) - GO111MODULE=on go install github.com/bazelbuild/buildtools/buildifier@latest - - # Checkout repository - - uses: actions/checkout@v4 - with: - path: rules/rules_bzlmodrio_jdk - - # Checkout gentool - - uses: actions/checkout@v4 - with: - repository: 'bzlmodRio/gentool.git' - fetch-depth: 0 - path: gentool - ref: refactor_dev - - - - - name: Setup Cache - uses: actions/cache@v3 - with: - path: | - ~/bzlmod_cache/*.sha256 - key: ${{ runner.os }}-${{ hashFiles('**/generate/**') }} - restore-keys: | - ${{ runner.os }}- - ${{ runner.os }} - - # Run update - - name: Run update - run: bazel run //:auto_update - working-directory: rules/rules_bzlmodrio_jdk/generate - - - name: Generate if changed - run: | - if [[ $(git --no-pager diff --exit-code HEAD) != '' ]]; then - echo "Something changed, need to re-generate" - bazel run //:generate - buildifier -warnings all --lint=fix -r .. - cd .. - bazel build //... --nobuild --enable_bzlmod --lockfile_mode=update - cd tests - bazel build //... --nobuild --enable_bzlmod --lockfile_mode=update - - # Pull requests won't be created if the github actions change. Since for this - # We mostly care about the actual code changes, we will just revert those files - git checkout ../.github/workflows - else - echo "No changes!" - fi; - working-directory: rules/rules_bzlmodrio_jdk/generate - - - name: Store new version - run: echo "NEW_VERSION=$(bazel run //:get_version)" >> $GITHUB_ENV - working-directory: rules/rules_bzlmodrio_jdk/generate - - # Create pull requests - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - env: - GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_KEY }} - with: - path: rules/rules_bzlmodrio_jdk - base: main - token: ${{ secrets.AUTO_UPDATE_KEY }} - reviewers: pjreiniger - branch: autoupdate_${{ env.NEW_VERSION }} - title: "Auto Update to '${{ env.NEW_VERSION }}'" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a5f510..dc2f7e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,20 +27,24 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: { python-version: '3.11' } - uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 17 architecture: ${{ matrix.java_arch }} - - run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --config=remote @rules_bzlmodrio_jdk//... + - id: setup_build_buddy + uses: ./.github/actions/setup-build-buddy + with: + token: ${{ secrets.BUILDBUDDY_API_KEY }} + - run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --config=ci @rules_bzlmodrio_jdk//... working-directory: tests - name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around - run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=remote //... || true + run: bazel ${{ matrix.bazel_options }} build -k ${{ matrix.config }} --verbose_failures --config=ci //... || true working-directory: tests - name: Build - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci working-directory: tests @@ -62,18 +66,22 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: { python-version: '3.11' } - uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 17 architecture: ${{ matrix.java_arch }} + - id: setup_build_buddy + uses: ./.github/actions/setup-build-buddy + with: + token: ${{ secrets.BUILDBUDDY_API_KEY }} - name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci || true working-directory: tests - name: Build - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci working-directory: tests build_bullseye32: @@ -94,18 +102,22 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: { python-version: '3.11' } - uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 17 architecture: ${{ matrix.java_arch }} + - id: setup_build_buddy + uses: ./.github/actions/setup-build-buddy + with: + token: ${{ secrets.BUILDBUDDY_API_KEY }} - name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci || true working-directory: tests - name: Build - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci working-directory: tests @@ -127,16 +139,20 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: { python-version: '3.11' } - uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 17 architecture: ${{ matrix.java_arch }} + - id: setup_build_buddy + uses: ./.github/actions/setup-build-buddy + with: + token: ${{ secrets.BUILDBUDDY_API_KEY }} - name: Build and allow failure # TODO Sometimes symlinks don't get created correctly the first time around - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote || true + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci || true working-directory: tests - name: Build - run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=remote + run: bazel ${{ matrix.bazel_options }} ${{ matrix.command }} //... -k ${{ matrix.config }} --verbose_failures --config=ci working-directory: tests diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1c8838a..39eff4a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: run: | git branch -f main origin/main if: github.ref != 'refs/heads/main' - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: { python-version: '3.11' } - name: Install clang-format run: | @@ -38,9 +38,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Set up Go 1.20.x - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: 1.20.x + cache: false id: go - uses: actions/checkout@v4 @@ -60,7 +61,7 @@ jobs: run: git diff HEAD > buildifier-fixes.patch if: ${{ failure() }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: buildifier fixes path: buildifier-fixes.patch diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index dc7ff42..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Publish Module -on: - workflow_dispatch: - push: - tags: - - '*' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - publish_module: - name: "Publish Module" - runs-on: ubuntu-22.04 - steps: - # Checkout repository - - uses: actions/checkout@v4 - with: - path: rules/rules_bzlmodrio_jdk - - - name: Create Archive - run: git archive HEAD --format=tar.gz --output="rules_bzlmodrio_jdk-${GITHUB_REF_NAME}.tar.gz" - working-directory: rules/rules_bzlmodrio_jdk - - - name: Setup archive name - run: echo "ARCHIVE_NAME=rules/rules_bzlmodrio_jdk/rules_bzlmodrio_jdk-${GITHUB_REF_NAME}.tar.gz" >> "$GITHUB_ENV" - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: "${{ env.ARCHIVE_NAME }}" - - - # Checkout gentool - - uses: actions/checkout@v4 - with: - repository: 'bzlmodRio/gentool.git' - fetch-depth: 0 - path: gentool - ref: refactor_dev - - # Checkout BCR - - uses: actions/checkout@v4 - with: - repository: 'bzlmodRio/bazel-central-registry.git' - fetch-depth: 0 - path: bazel-central-registry - ref: bzlmodrio - - # Run publishing - - run: bazel run //:publish - working-directory: rules/rules_bzlmodrio_jdk/generate - - - name: Store version - run: echo "NEW_VERSION=$(bazel run //:get_version)" >> $GITHUB_ENV - working-directory: rules/rules_bzlmodrio_jdk/generate - - - # Create pull requests - - name: Create Gentool Pull Request - uses: peter-evans/create-pull-request@v4 - env: - GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_KEY }} - with: - path: gentool - base: refactor_dev - token: ${{ secrets.AUTO_UPDATE_KEY }} - reviewers: pjreiniger - branch: autoupdate/rules_bzlmodrio_jdk_update_${{ env.NEW_VERSION }} - title: "Auto Update rules_bzlmodrio_jdk module to '${{ env.NEW_VERSION }}'" - - - name: Create BCR Pull Request - uses: peter-evans/create-pull-request@v4 - env: - GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_KEY }} - with: - path: bazel-central-registry - base: bzlmodrio - token: ${{ secrets.AUTO_UPDATE_KEY }} - reviewers: pjreiniger - branch: autoupdate/rules_bzlmodrio_jdk_update_${{ env.NEW_VERSION }} - title: "Auto Update latest rules_bzlmodrio_jdk to '${{ env.NEW_VERSION }}'" diff --git a/.gitignore b/.gitignore index e4fab7d..8e41b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ bazel-* *.pyc user.bazelrc +.buildbuddy-auth.rc .DS_Store diff --git a/MODULE.bazel b/MODULE.bazel index 78eb6b2..cbde9e7 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,7 +5,7 @@ module( ) bazel_dep(name = "platforms", version = "0.0.9") -bazel_dep(name = "rules_java", version = "7.5.0") +bazel_dep(name = "rules_java", version = "7.6.5") deps = use_extension("//:maven_deps.bzl", "deps") diff --git a/WORKSPACE b/WORKSPACE index 52703aa..5117347 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_java", - sha256 = "4da3761f6855ad916568e2bfe86213ba6d2637f56b8360538a7fb6125abf6518", - url = "https://github.com/bazelbuild/rules_java/releases/download/7.5.0/rules_java-7.5.0.tar.gz", + sha256 = "8afd053dd2a7b85a4f033584f30a7f1666c5492c56c76e04eec4428bdb2a86cf", + url = "https://github.com/bazelbuild/rules_java/releases/download/7.6.5/rules_java-7.6.5.tar.gz", ) load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") diff --git a/actions/setup-build-buddy/action.yml b/actions/setup-build-buddy/action.yml new file mode 100644 index 0000000..da33245 --- /dev/null +++ b/actions/setup-build-buddy/action.yml @@ -0,0 +1,29 @@ +name: 'Setup BuildBuddy acache' +description: 'Sets up the build buddy cache to be readonly / writing based on the presence of environment variables' + +inputs: + token: + description: 'Build Buddy API token' + +runs: + using: "composite" + steps: + - name: Setup without key + env: + API_KEY: ${{ inputs.token }} + if: ${{ env.API_KEY == '' }} + shell: bash + run: | + echo "No API key secret detected, will setup readonly cache" + echo "build:ci --config=build_buddy_readonly" > .buildbuddy-auth.rc + echo "build:ci --config=build_buddy_readonly"" > tests/.buildbuddy-auth.rc + + - name: Set with key + env: + API_KEY: ${{ inputs.token }} + if: ${{ env.API_KEY != '' }} + shell: bash + run: | + echo "API Key detected!" + echo "build:build_buddy --remote_header=x-buildbuddy-api-key=${{ env.API_KEY }}" > .buildbuddy-auth.rc + echo "build:ci --remote_header=x-buildbuddy-api-key=${{ env.API_KEY }}" > tests/.buildbuddy-auth.rc diff --git a/tests/.bazelrc b/tests/.bazelrc index cdc4a9f..5a940c3 100644 --- a/tests/.bazelrc +++ b/tests/.bazelrc @@ -1,4 +1,6 @@ try-import user.bazelrc +try-import .buildbuddy-auth.rc + import .bazelrc-cc import .bazelrc-java import .bazelrc-buildbuddy diff --git a/tests/.bazelrc-buildbuddy b/tests/.bazelrc-buildbuddy index 8407ec6..6f1cbe3 100644 --- a/tests/.bazelrc-buildbuddy +++ b/tests/.bazelrc-buildbuddy @@ -1,10 +1,19 @@ build:remote --bes_results_url=https://app.buildbuddy.io/invocation/ build:remote --bes_backend=grpcs://remote.buildbuddy.io build:remote --remote_cache=grpcs://remote.buildbuddy.io -build:remote --remote_download_toplevel # Helps remove network bottleneck if caching is enabled build:remote --remote_timeout=3600 +# Additional suggestions from buildbuddy for speed +build:remote --experimental_remote_cache_compression +build:remote --experimental_remote_cache_compression_threshold=100 +build:remote --noslim_profile +build:remote --experimental_profile_include_target_label +build:remote --experimental_profile_include_primary_output +build:remote --nolegacy_important_outputs + build --experimental_inmemory_jdeps_files build --experimental_inmemory_dotd_files +build:ci --config=remote build:ci --build_metadata=ROLE=CI +build:ci --remote_download_minimal diff --git a/tests/.bazelrc-cc b/tests/.bazelrc-cc index 12cbb14..7ca7094 100644 --- a/tests/.bazelrc-cc +++ b/tests/.bazelrc-cc @@ -7,6 +7,7 @@ build:windows --copt=/wd5105 build:windows --cxxopt=/wd4146 build:windows --cxxopt=/wd4267 build:windows --cxxopt=/wd4244 +build:windows --cxxopt=/utf-8 # Windows Arm build:windows_arm --copt=/W3 @@ -17,6 +18,7 @@ build:windows_arm --copt=/wd5105 build:windows_arm --cxxopt=/wd4146 build:windows_arm --cxxopt=/wd4267 build:windows_arm --cxxopt=/wd4244 +build:windows_arm --cxxopt=/utf-8 build:windows_arm --cpu=arm64_windows # Linux diff --git a/tests/.bazelversion b/tests/.bazelversion index 21c8c7b..643916c 100644 --- a/tests/.bazelversion +++ b/tests/.bazelversion @@ -1 +1 @@ -7.1.1 +7.3.1 diff --git a/tests/MODULE.bazel b/tests/MODULE.bazel index 4f4dcb6..d6c2dde 100644 --- a/tests/MODULE.bazel +++ b/tests/MODULE.bazel @@ -4,14 +4,14 @@ local_path_override( path = "..", ) -bazel_dep(name = "rules_java", version = "7.5.0") +bazel_dep(name = "rules_java", version = "7.6.5") bazel_dep(name = "rules_jvm_external", version = "6.1") bazel_dep(name = "rules_bzlmodrio_toolchains", version = "2024-1") -bazel_dep(name = "rules_checkstyle", version = "10.1") -bazel_dep(name = "rules_pmd", version = "6.43.0") -bazel_dep(name = "rules_spotless", version = "2.34.0") +bazel_dep(name = "rules_checkstyle", version = "10.12.2") +bazel_dep(name = "rules_pmd", version = "7.2.0") +bazel_dep(name = "rules_spotless", version = "2.40.0") bazel_dep(name = "rules_wpiformat", version = "2024.34") -bazel_dep(name = "rules_wpi_styleguide", version = "1.0.0") +bazel_dep(name = "rules_wpi_styleguide", version = "2024.06.22") maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") maven.install( diff --git a/tests/WORKSPACE b/tests/WORKSPACE index 0eac6e6..19670ca 100644 --- a/tests/WORKSPACE +++ b/tests/WORKSPACE @@ -22,8 +22,8 @@ rules_jvm_external_setup() http_archive( name = "rules_java", - sha256 = "4da3761f6855ad916568e2bfe86213ba6d2637f56b8360538a7fb6125abf6518", - url = "https://github.com/bazelbuild/rules_java/releases/download/7.5.0/rules_java-7.5.0.tar.gz", + sha256 = "8afd053dd2a7b85a4f033584f30a7f1666c5492c56c76e04eec4428bdb2a86cf", + url = "https://github.com/bazelbuild/rules_java/releases/download/7.6.5/rules_java-7.6.5.tar.gz", ) http_archive( @@ -59,8 +59,8 @@ setup_legacy_setup_jdk_dependencies() http_archive( name = "rules_wpi_styleguide", - sha256 = "c5c032e8e8b04cdd74d2a637c39e787156cd289d128cd9747b5c8c6d87d4f252", - url = "https://github.com/bzlmodRio/rules_wpi_styleguide/releases/download/1.0.0/rules_wpi_styleguide-1.0.0.tar.gz", + sha256 = "0359cc1772a715d958a2f5648f8254ad8c34af1e84d1a852f3bfa79040334b76", + url = "https://github.com/bzlmodRio/rules_wpi_styleguide/releases/download/2024.06.22/rules_wpi_styleguide-2024.06.22.tar.gz", ) load("@rules_wpi_styleguide//dependencies:load_rule_dependencies.bzl", "load_styleguide_rule_dependencies")