mirror of
https://github.com/domcyrus/rustnet.git
synced 2026-05-02 01:40:25 -05:00
e22c95fec1
* 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
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Docker Build and Publish
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container Registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Build and push Docker image
|
|
id: build-and-push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Generate artifact attestation
|
|
if: github.event_name != 'pull_request'
|
|
uses: actions/attest-build-provenance@v1
|
|
with:
|
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
|
subject-digest: ${{ steps.build-and-push.outputs.digest }}
|
|
push-to-registry: true |