Skip to content
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
34 changes: 34 additions & 0 deletions .github/workflows/job_bazel-cross-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Bazel Cross-Compilation Build
run-name: ${{ github.actor }} is cross-compiling with bazel
on:
workflow_call:
inputs:
runner:
description: 'Which runner to use'
required: false
default: 'ubuntu-24.04'
type: string
platform:
description: 'Human-readable platform name for display'
required: true
type: string
jobs:
bazel-cross-build:
name: Cross-compile (${{ inputs.platform }})
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.0
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: ${{ runner.os }}-bazel-cross-${{ inputs.platform }}-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel', 'third-party/bazel/*') }}
restore-keys: |
${{ runner.os }}-bazel-cross-${{ inputs.platform }}-
${{ runner.os }}-bazel-
- name: Build all
run: >
bazelisk build //...
--platforms=//third-party/bazel/toolchains:${{ inputs.platform }}
--@bazel_tools//tools/test:incompatible_use_default_test_toolchain=false
16 changes: 16 additions & 0 deletions .github/workflows/on_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,19 @@ jobs:
uses: ./.github/workflows/job_bazel-build-test.yaml
with:
runner: ${{ inputs.runner || 'ubuntu-24.04' }}


bazel-cross-build:
name: Bazel Cross-Build (${{ matrix.platform }})
strategy:
fail-fast: false
matrix:
platform:
- aarch64-linux-gnu
- aarch64-linux-musl
- armv7-linux-gnueabihf
- armv7-linux-musleabihf
uses: ./.github/workflows/job_bazel-cross-build.yaml
with:
runner: ${{ inputs.runner || 'ubuntu-24.04' }}
platform: ${{ matrix.platform }}
102 changes: 86 additions & 16 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ module(

bazel_dep(name = "bazel_features", version = "1.21.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")

BOOST_VERSION = "1.87.0"

bazel_dep(name = "boost.asio", version = BOOST_VERSION)
bazel_dep(name = "boost.process", version = BOOST_VERSION)
bazel_dep(name = "boost.uuid", version = BOOST_VERSION)
Expand All @@ -22,7 +24,7 @@ bazel_dep(name = "fast_float", version = "6.1.6")
bazel_dep(name = "fmt", version = "12.1.0", repo_name = "com_github_fmtlib_fmt")
bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.1", repo_name = "com_github_nlohmann_json")
bazel_dep(name = "libcap", version = "2.27.bcr.1")
bazel_dep(name = "openssl", version = "3.3.1.bcr.6")
bazel_dep(name = "openssl", version = "3.3.1.bcr.9")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "pugixml", version = "1.15")
bazel_dep(name = "rapidyaml", version = "0.10.0")
Expand All @@ -35,19 +37,47 @@ bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "pybind11_bazel", version = "3.0.0")
bazel_dep(name = "sqlite3", version = "3.51.2")

single_version_override(
module_name = "boost.context",
patches = ["//third-party/bazel/patches:boost.context.patch"],
)

###############################################################################
# C R O S S - C O M P I L A T I O N T O O L C H A I N S
###############################################################################

# Module extension for cross-compilation toolchain repositories
cross_toolchains = use_extension("//third-party/bazel/toolchains:extensions.bzl", "toolchains")
use_repo(
cross_toolchains,
"cc_toolchain_aarch64-linux-gnu-x86_64-linux",
"cc_toolchain_aarch64-linux-musl-x86_64-linux",
"cc_toolchain_armv7-linux-gnu-x86_64-linux",
"cc_toolchain_armv7-linux-musl-x86_64-linux",
)

register_toolchains("@cc_toolchain_aarch64-linux-gnu-x86_64-linux//:aarch64-linux-glibc_toolchain_toolchain")

register_toolchains("@cc_toolchain_aarch64-linux-musl-x86_64-linux//:aarch64-linux-musl_toolchain_toolchain")

register_toolchains("@cc_toolchain_armv7-linux-musl-x86_64-linux//:armv7-linux-musl_toolchain_toolchain")

register_toolchains("@cc_toolchain_armv7-linux-gnu-x86_64-linux//:armv7-linux-gnu_toolchain_toolchain")

###############################################################################
# N O N M O D U L E
###############################################################################

deps = use_extension("//third-party/bazel:extension.bzl", "deps")
use_repo(
deps,
"sigslot",
"com_github_HowardHinnant_date",
"com_github_LiamBindle_mqtt-c",
"com_github_pboettch_json-schema-validator",
"com_github_warmcatt_libwebsockets",
"com_github_LiamBindle_mqtt-c",
"openssl_source",
"pybind11_json",
"sigslot",
)

###############################################################################
Expand All @@ -56,19 +86,17 @@ use_repo(

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.10",
is_default = True,
python_version = "3.10",
)

use_repo(python, "python_3_10")

pip_deps = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip_deps.parse(
python_version = "3.10",
hub_name = "everest-testing_pip_deps",
python_version = "3.10",
requirements_lock = "//applications/utils:requirements-bazel.txt",
)

use_repo(pip_deps, "everest-testing_pip_deps")

###############################################################################
Expand All @@ -79,15 +107,50 @@ RUST_EDITION = "2021"

RUST_VERSION = "1.86.0"

RUST_EXTRA_TARGET_TRIPLES = {
"armv7-unknown-linux-musleabihf": [
"@platforms//os:linux",
"@platforms//cpu:armv7",
"@everest-core//third-party/bazel/toolchains:musl",
],
"armv7-unknown-linux-gnueabihf": [
"@platforms//os:linux",
"@platforms//cpu:armv7",
"@everest-core//third-party/bazel/toolchains:gnu",
],
"aarch64-unknown-linux-musl": [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
"@everest-core//third-party/bazel/toolchains:musl",
],
"aarch64-unknown-linux-gnu": [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
"@everest-core//third-party/bazel/toolchains:gnu",
],
}

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = RUST_EDITION,
extra_target_triples = [
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
versions = [
RUST_VERSION,
"nightly/2026-02-09",
],
versions = [RUST_VERSION],
)

[
rust.repository_set(
name = "rust_{}_repository_set_x86_64-unknown-linux-gnu".format(target_triple.replace("-", "_")),
edition = RUST_EDITION,
exec_triple = "x86_64-unknown-linux-gnu",
target_compatible_with = target_compatible_with,
target_triple = target_triple,
versions = [RUST_VERSION],
)
for (target_triple, target_compatible_with) in RUST_EXTRA_TARGET_TRIPLES.items()
]

use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")
Expand All @@ -103,17 +166,21 @@ everest_core_crate_index.from_cargo(
"@everest-core//modules/Examples/RustExamples/RsExample:Cargo.toml",
"@everest-core//modules/Examples/RustExamples/RsExampleUser:Cargo.toml",
],
supported_platform_triples = [
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
],
)
everest_core_crate_index.annotation(
crate = "everestrs",
repositories = ["everest_core_crate_index"],
crate_features = ["build_bazel"],
repositories = ["everest_core_crate_index"],
deps = [
"//lib/everest/framework/everestrs/everestrs-build",
"//lib/everest/framework/everestrs/everestrs",
"//lib/everest/framework/everestrs/everestrs-build",
],
)

use_repo(
everest_core_crate_index,
"everest_core_crate_index",
Expand All @@ -132,8 +199,12 @@ everest_framework_crate_index.from_cargo(
"//lib/everest/framework/everestrs/everestrs:Cargo.toml",
"//lib/everest/framework/everestrs/everestrs-build:Cargo.toml",
],
supported_platform_triples = [
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"armv7-unknown-linux-gnueabihf",
],
)

use_repo(
everest_framework_crate_index,
"everest_framework_crate_index",
Expand All @@ -147,7 +218,6 @@ everest_framework_validate_crate_index.from_cargo(
"//lib/everest/framework/bazel/validate:Cargo.toml",
],
)

use_repo(
everest_framework_validate_crate_index,
"everest_framework_validate_crate_index",
Expand Down
2 changes: 2 additions & 0 deletions applications/utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
load("//third-party/bazel/toolchains:defs.bzl", "CROSS_PYTHON_INCOMPATIBLE")

write_file(
name = "gen_update",
Expand All @@ -23,4 +24,5 @@ diff_test(
failure_message = "Please run `bazel run //:vendor_requirements` to update the vendored requirements.bzl file.",
file1 = "@everest-testing_pip_deps//:requirements.bzl",
file2 = ":requirements.bzl",
target_compatible_with = CROSS_PYTHON_INCOMPATIBLE,
)
3 changes: 3 additions & 0 deletions applications/utils/ev-dev-tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("//applications/utils:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("//third-party/bazel/toolchains:defs.bzl", "CROSS_PYTHON_INCOMPATIBLE")

exports_files(
["BUILD.bazel"],
Expand All @@ -9,6 +10,7 @@ py_library(
name = "lib",
srcs = glob(["src/ev_cli/*.py"]),
imports = ["src"],
target_compatible_with = CROSS_PYTHON_INCOMPATIBLE,
deps = [
requirement("jinja2"),
requirement("jsonschema"),
Expand All @@ -24,5 +26,6 @@ py_binary(
legacy_create_init = False,
main = "src/ev_cli/ev.py",
visibility = ["//visibility:public"],
target_compatible_with = CROSS_PYTHON_INCOMPATIBLE,
deps = [":lib"],
)
2 changes: 2 additions & 0 deletions applications/utils/everest-testing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("//applications/utils:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_library")
load("//third-party/bazel/toolchains:defs.bzl", "CROSS_PYTHON_INCOMPATIBLE")

exports_files(
["BUILD.bazel"],
Expand All @@ -10,6 +11,7 @@ py_library(
srcs = glob(["src/**/*.py"]),
imports = ["src"],
visibility = ["//visibility:public"],
target_compatible_with = CROSS_PYTHON_INCOMPATIBLE,
deps = [
requirement("pytest"),
requirement("pytest-asyncio"),
Expand Down
4 changes: 2 additions & 2 deletions lib/everest/evse_security/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cc_library(
":cert_rehash",
"//lib/everest/framework:framework",
"//lib/everest/timer:libtimer",
"@openssl//:crypto",
"@openssl//:ssl",
"//third-party/bazel/openssl:crypto",
"//third-party/bazel/openssl:ssl",
],
)
Loading
Loading