Skip to content
Open
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
4 changes: 2 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[net]
git-fetch-with-cli = true

# https://github.com/rust-lang/cargo/issues/3946#issuecomment-973132993
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }
# Used in tests/src/dload.rs to dynamically load sidecar_lite.
LIBSIDECAR_LITE_DIR = { value = "target/debug", relative = true }
30 changes: 30 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Bazel CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
bazel-build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v5
- uses: bazel-contrib/setup-bazel@0.15.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ matrix.os }}
repository-cache: true
- if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y lld
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld 100
- name: Build with Bazel
run: bazel build --test_output=errors //...
- name: Test with Bazel
run: bazel test --test_output=errors //...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.sw*
out.rs
tags
bazel*
MODULE.bazel.lock
Empty file added BUILD.bazel
Empty file.
148 changes: 48 additions & 100 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ serde = "1.0"
serde_tokenstream = "0.2"
syn = "2.0"
tempfile = "3.3"
usdt = "0.5.0"
usdt = "0.6"
xfr = { git = "https://github.com/oxidecomputer/xfr" }

# TODO: Remove once https://github.com/oxidecomputer/usdt/pull/486 is released.
[patch.crates-io]
usdt = { git = "https://github.com/oxidecomputer/usdt" }
24 changes: 24 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module(
name = "x4c",
# Set to version number for releases, only.
version = "HEAD",
)

bazel_dep(name = "rules_rust", version = "0.67.0")

# Pick Rust toolchain version.
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
versions = ["1.90.0"],
)
use_repo(rust, "rust_toolchains")

# Make all crates declared in Cargo.toml available as @crates//:... to Bazel.
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "crates",
cargo_lockfile = "//:Cargo.lock",
manifests = ["//:Cargo.toml"],
)
use_repo(crate, "crates")
Loading