Skip to content

Commit

Permalink
Re-organize into a single workspace
Browse files Browse the repository at this point in the history
This commit moves the aya-log projects from the subtree and adds them to
the main cargo workspace. It also brings the BPF crates into the
workspace and moves the macro crates up a level since they aren't BPF
code.

Miri was disabled for aya-bpf as the previous config wasn't actually
checking anything.

CI, clippy, fmt and release configurations have all been adjusted
appropriately.

CI was not properly running for other supported arches which was also
ixed here.

Signed-off-by: Dave Tucker <[email protected]>
  • Loading branch information
dave-tucker committed Jul 28, 2022
1 parent 28abaec commit dc31e11
Show file tree
Hide file tree
Showing 48 changed files with 131 additions and 548 deletions.
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[alias]
xtask = "run --package xtask --"
build-bpfel = "build -Zbuild-std=core --target=bpfel-unknown-none"
build-bpfeb = "build -Zbuild-std=core --target=bpfeb-unknown-none"

[target.armv7-unknown-linux-gnueabi]
linker = "arm-linux-gnueabi-gcc"
Expand Down
52 changes: 6 additions & 46 deletions .github/workflows/build-aya-bpf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,19 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rust-src
override: true

- uses: Swatinem/rust-cache@v1

- name: Prereqs
run: cargo install cross --git https://github.com/cross-rs/cross
run: cargo install bpf-linker

- name: Build
env:
CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
run: |
pushd bpf
cargo build --workspace --exclude aya-bpf-macros --verbose
popd
- name: Run tests
env:
CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }}
run: |
pushd bpf
cargo test --workspace --exclude aya-bpf-macros --verbose
popd
build-macros:
strategy:
matrix:
arch:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabi
- riscv64gc-unknown-none-elf
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- uses: Swatinem/rust-cache@v1

- name: Prereqs
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Build bpf macros
run: |
pushd bpf
cross build -p aya-bpf-macros --verbose
popd
- name: Test bpf macros
run: |
pushd bpf
RUST_BACKTRACE=full cross test -p aya-bpf-macros --verbose
popd
cargo build-bpfel -p aya-bpf --verbose
cargo build-bpfeb -p aya-bpf --verbose
cargo build-bpfel -p aya-log-ebpf --verbose
cargo build-bpfeb -p aya-log-ebpf --verbose
27 changes: 22 additions & 5 deletions .github/workflows/build-aya.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,38 @@ jobs:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabi
- riscv64gc-unknown-none-elf
- riscv64gc-unknown-linux-gnu
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: false

- uses: Swatinem/rust-cache@v1
- name: Prereqs
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Build
run: cross build --verbose
run: cross build --verbose --target ${{matrix.arch}}

- name: Run test
run: RUST_BACKTRACE=full cross test --verbose
env:
RUST_BACKTRACE: full
run: |
cross test --verbose -p aya --target ${{matrix.arch}}
cross test --verbose -p aya-gen --target ${{matrix.arch}}
cross test --verbose -p aya-log --target ${{matrix.arch}}
cross test --verbose -p aya-log-ebpf-macros --target ${{matrix.arch}}
# aya-bpf-macros can only be tested on nightly since its tests depend on aya-bpf, which requires the never type
cross +nightly test --verbose -p aya-bpf-macros --target ${{matrix.arch}}
test:
runs-on: ubuntu-20.04
Expand All @@ -60,12 +79,10 @@ jobs:
sudo apt-get -qy install linux-tools-common qemu-system-x86 cloud-image-utils openssh-client libelf-dev gcc-multilib
cargo install bpf-linker
- name: Lint integration tests
run: |
cargo xtask build-integration-test-ebpf --libbpf-dir ./libbpf
cargo clippy -p integration-test -- --deny warnings
cargo clippy -p integration-test-macros -- --deny warnings
- name: Run integration tests
run: |
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,11 @@ jobs:
- name: Check formatting
run: |
cargo fmt --all -- --check
(cd bpf && cargo fmt --all -- --check)
(cd test/integration-ebpf && cargo fmt --all -- --check)
- name: Run clippy
run: |
cargo clippy -p aya -- --deny warnings
cargo clippy -p aya-gen -- --deny warnings
cargo clippy -p xtask -- --deny warnings
(cd bpf && cargo clippy -p aya-bpf -- --deny warnings)
(cd test/integration-ebpf && cargo clippy -- --deny warnings)
cargo clippy --workspace --exclude integration-test -- --deny warnings
- name: Run miri
env:
MIRIFLAGS: -Zmiri-disable-stacked-borrows
run: |
cargo miri test --all-targets
pushd bpf
cargo miri test
popd
cargo miri test --all-targets
4 changes: 2 additions & 2 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rust-analyzer.linkedProjects": ["Cargo.toml", "bpf/Cargo.toml", "test/integration-ebpf/Cargo.toml"],
"rust-analyzer.checkOnSave.allTargets": false
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.command": "clippy"
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"rust-analyzer.linkedProjects": ["Cargo.toml", "bpf/Cargo.toml", "test/integration-ebpf/Cargo.toml"],
"rust-analyzer.checkOnSave.allTargets": false
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.command": "clippy"
}
23 changes: 21 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
[workspace]
members = ["aya", "aya-gen", "test/integration-test", "test/integration-test-macros", "xtask"]
default-members = ["aya", "aya-gen"]
members = [
"aya", "aya-gen", "aya-log", "aya-log-common", "test/integration-test", "test/integration-test-macros", "xtask",
# macros
"aya-bpf-macros", "aya-log-ebpf-macros",
# ebpf crates
"bpf/aya-bpf", "bpf/aya-bpf-bindings", "bpf/aya-log-ebpf", "test/integration-ebpf"
]
default-members = ["aya", "aya-gen", "aya-log", "aya-bpf-macros", "aya-log-ebpf-macros"]

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"

[profile.dev.package.integration-ebpf]
opt-level = 2
overflow-checks = false

[profile.release.package.integration-ebpf]
debug = 2
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ quote = "1.0"
syn = {version = "1.0", features = ["full"]}

[dev-dependencies]
aya-bpf = { path = "../aya-bpf" }
aya-bpf = { path = "../bpf/aya-bpf" }
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default = []
userspace = [ "aya" ]

[dependencies]
aya = { version = "0.11.0", optional=true }
aya = { path = "../aya", version = "0.11.0", optional=true }

[lib]
path = "src/lib.rs"
1 change: 1 addition & 0 deletions aya-log-common/release.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shared-version = true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions aya-log/.cargo/config.toml

This file was deleted.

9 changes: 0 additions & 9 deletions aya-log/.github/dependabot.yml

This file was deleted.

37 changes: 0 additions & 37 deletions aya-log/.github/workflows/build-bpf.yml

This file was deleted.

26 changes: 0 additions & 26 deletions aya-log/.github/workflows/build.yml

This file was deleted.

41 changes: 0 additions & 41 deletions aya-log/.github/workflows/lint.yml

This file was deleted.

13 changes: 0 additions & 13 deletions aya-log/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions aya-log/.vim/coc-settings.json

This file was deleted.

3 changes: 0 additions & 3 deletions aya-log/.vscode/settings.json

This file was deleted.

29 changes: 27 additions & 2 deletions aya-log/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
[workspace]
members = ["aya-log", "aya-log-common", "xtask"]
[package]
name = "aya-log"
version = "0.1.11-dev.0"
description = "A logging library for eBPF programs."
keywords = ["ebpf", "bpf", "log", "logging"]
license = "MIT OR Apache-2.0"
authors = ["The Aya Contributors"]
repository = "https://github.com/aya-rs/aya-log"
readme = "README.md"
documentation = "https://docs.rs/aya-log"
edition = "2018"

[dependencies]
aya = { path = "../aya", version = "0.11.0", features=["async_tokio"] }
aya-log-common = { path = "../aya-log-common", version = "0.1.11-dev.0", features=["userspace"] }
dyn-fmt = "0.3.0"
thiserror = "1"
log = "0.4"
bytes = "1.1"
tokio = { version = "1.2.0" }

[dev-dependencies]
simplelog = "0.12"
testing_logger = "0.1.1"

[lib]
path = "src/lib.rs"
Loading

0 comments on commit dc31e11

Please sign in to comment.