Skip to content

Commit

Permalink
[CI] switch to nativelink
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdae committed Feb 2, 2024
1 parent dccb9ad commit a713845
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 19 deletions.
9 changes: 5 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ common --enable_bzlmod
# Build using platforms by default
build --incompatible_enable_cc_toolchain_resolution

# Remote builds
build:remote --genrule_strategy=remote
build:remote --remote_download_minimal
build:remote --remote_executor=grpc://localhost:8980
# Remote builds (nativelink)
build:remote --remote_instance_name=main
build:remote --remote_cache=grpc://127.0.0.1:50051
build:remote --remote_executor=grpc://127.0.0.1:50051
build:remote --remote_default_exec_properties=cpu_count=1

# Linux host (used for remote builds)
build:linux --extra_execution_platforms=//platforms/host:linux
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.0
7.0.1
161 changes: 161 additions & 0 deletions .github/bre/basic_cas.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"stores": {
"AC_MAIN_STORE": {
"memory": {
"eviction_policy": {
// 100mb.
"max_bytes": 100000000,
}
}
},
"WORKER_FAST_SLOW_STORE": {
"fast_slow": {
// "fast" must be a "filesystem" store because the worker uses it to make
// hardlinks on disk to a directory where the jobs are running.
"fast": {
"filesystem": {
"content_path": "/tmp/nativelink/data-worker-test/content_path-cas",
"temp_path": "/tmp/nativelink/data-worker-test/tmp_path-cas",
"eviction_policy": {
// 10gb.
"max_bytes": 10000000000,
}
}
},
"slow": {
/// Discard data.
/// This example usage has the CAS and the Worker live in the same place,
/// so they share the same underlying CAS. Since workers require a fast_slow
/// store, we use the fast store as our primary data store, and the slow store
/// is just a noop, since there's no shared storage in this config.
"noop": {}
}
}
}
},
"schedulers": {
"MAIN_SCHEDULER": {
"simple": {
"supported_platform_properties": {
"cpu_count": "minimum",
"memory_kb": "minimum",
"network_kbps": "minimum",
"disk_read_iops": "minimum",
"disk_read_bps": "minimum",
"disk_write_iops": "minimum",
"disk_write_bps": "minimum",
"shm_size": "minimum",
"gpu_count": "minimum",
"gpu_model": "exact",
"cpu_vendor": "exact",
"cpu_arch": "exact",
"cpu_model": "exact",
"kernel_version": "exact",
"OSFamily": "priority",
"container-image": "priority",
// Example of how to set which docker images are available and set
// them in the platform properties.
// "docker_image": "priority",
}
}
}
},
"workers": [{
"local": {
"worker_api_endpoint": {
"uri": "grpc://127.0.0.1:50061",
},
"cas_fast_slow_store": "WORKER_FAST_SLOW_STORE",
"upload_action_result": {
"ac_store": "AC_MAIN_STORE",
},
"work_directory": "/tmp/nativelink/work",
"platform_properties": {
"cpu_count": {
"values": ["16"],
},
"memory_kb": {
"values": ["500000"],
},
"network_kbps": {
"values": ["100000"],
},
"cpu_arch": {
"values": ["x86_64"],
},
"OSFamily": {
"values": [""]
},
"container-image": {
"values": [""]
},
// Example of how to set which docker images are available and set
// them in the platform properties.
// "docker_image": {
// "query_cmd": "docker images --format {{.Repository}}:{{.Tag}}",
// }
}
}
}],
"servers": [{
"name": "public",
"listener": {
"http": {
"socket_address": "0.0.0.0:50051"
}
},
"services": {
"cas": {
"main": {
"cas_store": "WORKER_FAST_SLOW_STORE"
}
},
"ac": {
"main": {
"ac_store": "AC_MAIN_STORE"
}
},
"execution": {
"main": {
"cas_store": "WORKER_FAST_SLOW_STORE",
"scheduler": "MAIN_SCHEDULER",
}
},
"capabilities": {
"main": {
"remote_execution": {
"scheduler": "MAIN_SCHEDULER",
}
}
},
"bytestream": {
"cas_stores": {
"main": "WORKER_FAST_SLOW_STORE",
}
}
}
}, {
"name": "private_workers_servers",
"listener": {
"http": {
"socket_address": "0.0.0.0:50061"
}
},
"services": {
"experimental_prometheus": {
"path": "/metrics"
},
// Note: This should be served on a different port, because it has
// a different permission set than the other services.
// In other words, this service is a backend api. The ones above
// are a frontend api.
"worker_api": {
"scheduler": "MAIN_SCHEDULER",
},
"admin": {}
}
}],
"global": {
"max_open_files": 512
}
}
4 changes: 2 additions & 2 deletions .github/workflows/remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
- uses: actions/checkout@v2
- name: remote execution
run: |
git clone https://github.com/bazelbuild/bazel-buildfarm
cd bazel-buildfarm && ./examples/bf-run start && cd ..
cargo install --git https://github.com/TraceMachina/nativelink --tag v0.2.0
(nativelink .github/bre/basic_cas.json &)
bazelisk build --config=remote --config=linux //examples/...
73 changes: 62 additions & 11 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/simple/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# project/BUILD.bazel

load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

cc_library(
name = "arm_library",
Expand Down

0 comments on commit a713845

Please sign in to comment.