Skip to content

wip: run presubmit CI in github actions #2694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

buildifier(
name = "buildifier.check",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
)
71 changes: 71 additions & 0 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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
5 changes: 5 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ bazel_dep(
dev_dependency = True,
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "buildifier_prebuilt",
version = "7.1.2",
Copy link
Contributor Author

@aaronsky aaronsky Apr 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentionally chose this version to keep us at buildifier 6.4.0. also chose not to put this in the WORKSPACE.

dev_dependency = True,
)

non_module_deps = use_extension("//apple:extensions.bzl", "non_module_deps")
use_repo(
Expand Down
10 changes: 1 addition & 9 deletions test/starlark_tests/resources/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading