mirror of
https://github.com/domcyrus/rustnet.git
synced 2026-05-01 17:29:44 -05:00
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
This commit is contained in:
@@ -1,27 +1,8 @@
|
||||
name: Docker Build and Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
- 'assets/services'
|
||||
- 'Dockerfile'
|
||||
- 'build.rs'
|
||||
- '.github/workflows/docker.yml'
|
||||
tags: [ "v*.*.*" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
- 'assets/services'
|
||||
- 'Dockerfile'
|
||||
- 'build.rs'
|
||||
- '.github/workflows/docker.yml'
|
||||
tags:
|
||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
name: Publish to crates.io
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Publish to crates.io
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
run: cargo publish
|
||||
@@ -86,9 +86,7 @@ jobs:
|
||||
|
||||
- name: Install cross
|
||||
if: matrix.cargo == 'cross'
|
||||
uses: taiki-e/cache-cargo-install-action@v2
|
||||
with:
|
||||
tool: cross@0.2.5
|
||||
run: cargo install cross@0.2.5
|
||||
|
||||
- name: Build release binary
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user