diff --git a/.github/workflows/BUILD b/.github/workflows/BUILD new file mode 100644 index 0000000000..adecb144b2 --- /dev/null +++ b/.github/workflows/BUILD @@ -0,0 +1,8 @@ +load("@buildifier_prebuilt//:rules.bzl", "buildifier") + +buildifier( + name = "buildifier.check", + exclude_patterns = ["./.git/*"], + lint_mode = "warn", + mode = "diff", +) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml new file mode 100644 index 0000000000..7549665fe7 --- /dev/null +++ b/.github/workflows/presubmit.yml @@ -0,0 +1,71 @@ +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +# NOTE: To avoid listing the same things for build_flags/test_flags for each +# of these tasks, they are listed in the .bazelrc instead. +jobs: + macos: + runs-on: macos-15 + strategy: + matrix: + bazel: + - latest + - last_rc + - last_green + xcode: + - 16.2 + fail-fast: false + permissions: + contents: write + env: + USE_BAZEL_VERSION: ${{ matrix.bazel }} + steps: + - uses: actions/checkout@v4 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ${{ matrix.xcode }} + - uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + bazelrc: | + test --test_tag_filters=-skipci + - name: Bazel Info + run: | + bazel version + bazel info + - run: bazel build tools/... test/... + - run: bazel test tools/... test/... examples/... + doc_tests: + runs-on: ubuntu-latest + env: + # FIXME: Use last_green once we cherry-pick in changes needed by + # https://github.com/bazelbuild/bazel/commit/b59004dd17366b09b0758b833f98294fd0e89345 + # USE_BAZEL_VERSION: last_green + USE_BAZEL_VERSION: 21a12c72d84e9108142421d9a8526edf8dceb78c + steps: + - uses: actions/checkout@v4 + - uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + # TODO: Remove this once stardoc is updated to 0.7.1+ (https://github.com/bazelbuild/stardoc/pull/238) + bazelrc: | + test --noincompatible_disallow_empty_glob + - name: Bazel Info + run: | + bazel version + bazel info + - run: bazel test doc/... + buildifier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: buildifier + run: bazel run --enable_bzlmod //.github/workflows:buildifier.check diff --git a/MODULE.bazel b/MODULE.bazel index 92a0229844..93320036ee 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -28,6 +28,11 @@ bazel_dep( dev_dependency = True, repo_name = "com_google_protobuf", ) +bazel_dep( + name = "buildifier_prebuilt", + version = "7.1.2", + dev_dependency = True, +) non_module_deps = use_extension("//apple:extensions.bzl", "non_module_deps") use_repo( diff --git a/test/starlark_tests/resources/BUILD b/test/starlark_tests/resources/BUILD index 4843aface4..bef325e07f 100644 --- a/test/starlark_tests/resources/BUILD +++ b/test/starlark_tests/resources/BUILD @@ -1331,19 +1331,11 @@ cc_binary( linkshared = True, ) -# Set up the rpath of the .dylib using install_name_tool. Bazel should probably do this again when packaging -genrule( - name = "ccinfo_dylibs_mylib-shared-with-rpath", - srcs = [":ccinfo_dylibs_mylib-shared"], - outs = ["libmylib_with_rpath.dylib"], - cmd = "install_name_tool -id @rpath/libmylib_with_rpath.dylib $(location :ccinfo_dylibs_mylib-shared) && cp $(location :ccinfo_dylibs_mylib-shared) $@", -) - # Import our dynamically linked library. cc_import( name = "ccinfo_dylibs_mylib-import", hdrs = ["ccinfo_dylibs/mylib/lib.hpp"], - shared_library = ":ccinfo_dylibs_mylib-shared-with-rpath", + shared_library = ":ccinfo_dylibs_mylib-shared", ) # Wrap our dylib in a cc_library so we can add data[] to it. This is common practice for adding