Skip to content

Commit

Permalink
Big update to new bazel version (#74)
Browse files Browse the repository at this point in the history
* Big update to new bazel version

* try github action for building

* small updates

* remove unneeded file

* no need for circleci
  • Loading branch information
jmeagher authored Feb 17, 2024
1 parent 6c70cb4 commit fd00f1b
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 281 deletions.
1 change: 1 addition & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=3.7.2
93 changes: 0 additions & 93 deletions .circleci/config.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on: push
name: Bazel Build and Test
jobs:
checks:
name: run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- name: Mount bazel cache # Optional
uses: actions/cache@v4
with:
path: "~/.cache/bazel"
key: bazel
- run: bazel build //...
- run: bazel test //...
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ filegroup(
".*", # mainly .git* files
],
) + [
".travis.yml",
],
visibility = ["//src/test/shell/bazel:__pkg__"],
)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Playing around with monorepo setup and tools to see how it works for my personal

[![Build Status](https://travis-ci.org/jmeagher/monorepo.svg?branch=master)](https://travis-ci.org/jmeagher/monorepo) [![Join the chat at https://gitter.im/jmeagher-monorepo/Lobby](https://badges.gitter.im/jmeagher-monorepo/Lobby.svg)](https://gitter.im/jmeagher-monorepo/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![CircleCI](https://circleci.com/gh/jmeagher/monorepo.svg?style=svg)](https://circleci.com/gh/jmeagher/monorepo)

This might be useful to someone out there of how to setup a monorepo using [Bazel](https://github.com/bazelbuild/bazel) and a variety of languages. To get started [install Bazel](https://docs.bazel.build/). `bazel build //...` will build everything. `bazel test //...` will run all the unit tests. [`./test_e2e.sh`](test_e2e.sh) will do a little extra validation of the compiled binaries. For more detail on the build setup see [the Travis-ci configuration](.travis.yml).
This might be useful to someone out there of how to setup a monorepo using [Bazel](https://github.com/bazelbuild/bazel) and a variety of languages. To get started [install Bazelisk](https://bazel.build/install/bazelisk). `bazel build //...` will build everything. `bazel test //...` will run all the unit tests.
104 changes: 52 additions & 52 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ load_build_rules(rules_to_load)
load("@rules_python//python:pip.bzl", "pip_repositories", "pip3_import")
pip_repositories()

pip3_import(
name = "my_python_deps",
requirements = "//3rdparty:requirements.txt",
)
# pip3_import(
# name = "my_python_deps",
# requirements = "//3rdparty:requirements.txt",
# )

load("@my_python_deps//:requirements.bzl", _python_3rd_party = "pip_install")
_python_3rd_party()
# load("@my_python_deps//:requirements.bzl", _python_3rd_party = "pip_install")
# # _python_3rd_party()
# pip_install()

# Scala setup
Expand Down Expand Up @@ -73,43 +73,43 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
# gazelle:repository_macro my-go-repositories.bzl%my_go_repositories
gazelle_dependencies()

# Setup docker support
load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)
container_repositories()
# # Setup docker support
# load(
# "@io_bazel_rules_docker//repositories:repositories.bzl",
# container_repositories = "repositories",
# )
# container_repositories()

# Docker testing images
load(
"@io_bazel_rules_docker//python:image.bzl",
_py_image_repos = "repositories",
)
# # Docker testing images
# load(
# "@io_bazel_rules_docker//python:image.bzl",
# _py_image_repos = "repositories",
# )

load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
# load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()
# container_deps()

load(
"@io_bazel_rules_docker//container:container.bzl",
"container_pull",
)
# load(
# "@io_bazel_rules_docker//container:container.bzl",
# "container_pull",
# )

_py_image_repos()
# _py_image_repos()

load(
"@io_bazel_rules_docker//scala:image.bzl",
_scala_image_repos = "repositories",
)
# load(
# "@io_bazel_rules_docker//scala:image.bzl",
# _scala_image_repos = "repositories",
# )

_scala_image_repos()
# _scala_image_repos()

load(
"@io_bazel_rules_docker//go:image.bzl",
_go_image_repos = "repositories",
)
# load(
# "@io_bazel_rules_docker//go:image.bzl",
# _go_image_repos = "repositories",
# )

_go_image_repos()
# _go_image_repos()

# Rust support
# Removed for now since it's been delicate to maintain and I'm not working with it now
Expand All @@ -120,24 +120,24 @@ _go_image_repos()

# Load external docker containers

container_pull(
name = "cassandra3",
registry = "index.docker.io",
repository = "library/cassandra",
# 'tag' is also supported, but digest is encouraged for reproducibility.
# note: couldn't get digest version to work
tag = "3.11.1",
digest = "sha256:18698b13866b5e805420718e22ad32e3b3227182d3143aaaa937c6154bb5d2bb",
)

container_pull(
name = "envoyproxy",
registry = "index.docker.io",
# Picked a recent build at random from https://hub.docker.com/r/envoyproxy/envoy-alpine/tags/
repository = "envoyproxy/envoy-alpine",
tag = "200b0e41641be46471c2ce3d230aae395fda7ded",
digest = "sha256:ae046d3c3b1ebcdbf02cd924edfb2fe5e328ab462c3e44961cb4aac9be208491",
)
# container_pull(
# name = "cassandra3",
# registry = "index.docker.io",
# repository = "library/cassandra",
# # 'tag' is also supported, but digest is encouraged for reproducibility.
# # note: couldn't get digest version to work
# tag = "3.11.1",
# digest = "sha256:18698b13866b5e805420718e22ad32e3b3227182d3143aaaa937c6154bb5d2bb",
# )

# container_pull(
# name = "envoyproxy",
# registry = "index.docker.io",
# # Picked a recent build at random from https://hub.docker.com/r/envoyproxy/envoy-alpine/tags/
# repository = "envoyproxy/envoy-alpine",
# tag = "200b0e41641be46471c2ce3d230aae395fda7ded",
# digest = "sha256:ae046d3c3b1ebcdbf02cd924edfb2fe5e328ab462c3e44961cb4aac9be208491",
# )

# Load external golang repos
# To add or update new external go dependencies edit go.mod and run ...
Expand Down
14 changes: 7 additions & 7 deletions examples/docker/cassandra/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# docker run --name mycassandra -d bazel/examples/docker/cassandra:cassandra_test
#
# For more help and options see https://hub.docker.com/_/cassandra/
container_image(
name = "cassandra_single_node",
base = "@cassandra3//image",
entrypoint = "/load_data_and_run.sh",
files = glob(["*.sh"]),
visibility = ["//visibility:public"],
)
# container_image(
# name = "cassandra_single_node",
# base = "@cassandra3//image",
# entrypoint = "/load_data_and_run.sh",
# files = glob(["*.sh"]),
# visibility = ["//visibility:public"],
# )
22 changes: 11 additions & 11 deletions examples/python/external_deps/BUILD
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
py_binary(
name = "main",
srcs = ["main.py"],
deps = ["//examples/python/external_deps/jpm:numerics"],
)
# py_binary(
# name = "main",
# srcs = ["main.py"],
# deps = ["//examples/python/external_deps/jpm:numerics"],
# )

py_image(
name = "main_docker",
srcs = ["main.py"],
main = "main.py",
deps = [":main"],
)
# py_image(
# name = "main_docker",
# srcs = ["main.py"],
# main = "main.py",
# deps = [":main"],
# )

filegroup(
name = "srcs",
Expand Down
Loading

0 comments on commit fd00f1b

Please sign in to comment.