Skip to content

Commit e22c95f

Browse files
authored
fix: remove vmlinux crate dep (#28)
* fix: remove vmlinux crate dep * fix: download architecture-specific vmlinux.h at build time Instead of using a git dependency (not allowed on crates.io), download the architecture-specific vmlinux.h header at build time from the libbpf/vmlinux.h repository. This approach: - Removes git dependency from Cargo.toml (crates.io compatible) - Downloads correct arch-specific header (x86, aarch64, arm) - Caches downloaded headers in OUT_DIR (reuses between builds) - Works with cargo install - Supports cross-compilation for all architectures The vmlinux.h file (~3-4MB per arch) is downloaded once per architecture and cached, so subsequent builds are fast. * fix: use ureq with rustls instead of http_req http_req depends on native-tls/openssl-sys which requires OpenSSL to be installed in the cross-compilation containers. Switch to ureq with the rustls backend which has no system dependencies and works in all cross-compilation environments. * fix: follow symlink when downloading vmlinux.h The vmlinux.h files in the libbpf/vmlinux.h repository are symlinks to versioned files (e.g. vmlinux_6.14.h). When downloading via raw.githubusercontent.com, we get the symlink content (just the target filename) instead of the actual file. Solution: Download the symlink first to get the target filename, then download the actual versioned file. This ensures we get the full header content instead of just the symlink text. * add crate publish workflow
1 parent df38754 commit e22c95f

6 files changed

Lines changed: 440 additions & 39 deletions

File tree

.github/workflows/docker.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
11
name: Docker Build and Publish
2-
32
on:
43
push:
5-
branches: [ "main" ]
6-
paths:
7-
- 'src/**'
8-
- 'Cargo.toml'
9-
- 'Cargo.lock'
10-
- 'assets/services'
11-
- 'Dockerfile'
12-
- 'build.rs'
13-
- '.github/workflows/docker.yml'
14-
tags: [ "v*.*.*" ]
15-
pull_request:
16-
branches: [ "main" ]
17-
paths:
18-
- 'src/**'
19-
- 'Cargo.toml'
20-
- 'Cargo.lock'
21-
- 'assets/services'
22-
- 'Dockerfile'
23-
- 'build.rs'
24-
- '.github/workflows/docker.yml'
4+
tags:
5+
- "v[0-9]+.[0-9]+.[0-9]+"
256
workflow_dispatch:
267

278
env:

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Rust
18+
uses: dtolnay/rust-toolchain@stable
19+
20+
- name: Publish to crates.io
21+
env:
22+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
23+
run: cargo publish

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ jobs:
8686

8787
- name: Install cross
8888
if: matrix.cargo == 'cross'
89-
uses: taiki-e/cache-cargo-install-action@v2
90-
with:
91-
tool: cross@0.2.5
89+
run: cargo install cross@0.2.5
9290

9391
- name: Build release binary
9492
shell: bash

0 commit comments

Comments
 (0)