-
Notifications
You must be signed in to change notification settings - Fork 56
167 lines (150 loc) · 5.6 KB
/
Copy pathrelease-driver.yaml
File metadata and controls
167 lines (150 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Hades-driver
on:
push:
tags:
- edriver-v*
jobs:
build:
name: "Release edriver / ${{ matrix.arch }}"
runs-on: ${{ matrix.runner }}
container:
image: ${{ matrix.container }}
env:
PLATFORM: ${{ matrix.arch }}
LIBBPF_SYS_LIBRARY_PATH: ${{ matrix.lib_path }}
LIBBPF_SYS_EXTRA_CFLAGS: ${{ matrix.extra_cflags }}
CC_x86_64_unknown_linux_musl: ${{ matrix.cc }}
CC_aarch64_unknown_linux_musl: ${{ matrix.cc }}
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: ${{ matrix.cc }}
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: ${{ matrix.cc }}
RUSTFLAGS: ${{ matrix.rustflags }}
CARGO_EXTRA_FEATURES: ${{ matrix.cargo_extra_features }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-latest
target: x86_64-unknown-linux-musl
container: ubuntu:24.04
cc: musl-gcc
lib_path: ""
extra_cflags: "-idirafter /usr/include -idirafter /usr/include/x86_64-linux-gnu"
cargo_extra_features: ",vendored-libelf"
rustflags: "-C target-feature=+crt-static"
- arch: aarch64
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
container: ubuntu:24.04
cc: musl-gcc
lib_path: ""
extra_cflags: "-idirafter /usr/include -idirafter /usr/include/aarch64-linux-gnu -mno-outline-atomics"
cargo_extra_features: ",vendored-libelf"
rustflags: "-C target-feature=+crt-static"
steps:
- name: Install build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update -qq
apt-get install -y --no-install-recommends \
bash curl git ca-certificates \
build-essential linux-headers-generic \
clang llvm \
libelf-dev zlib1g-dev \
musl-tools musl-dev \
protobuf-compiler \
pkg-config \
autoconf automake libtool autopoint gettext flex bison gawk
- name: Git checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Clone libbpf submodule
run: |
git clone --depth=1 --branch v1.2.2 \
https://github.com/libbpf/libbpf.git plugins/libs/libbpf
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.arch }}-cargo-edriver-v10-${{ hashFiles('plugins/edriver/Cargo.lock') }}
restore-keys: ${{ matrix.arch }}-cargo-edriver-v10-
- name: Build musl compat libs (argp / fts / obstack)
run: |
set -eux
ARCH=$(uname -m)
MUSL_LIB=/usr/lib/${ARCH}-linux-musl
MUSL_INC=/usr/include/${ARCH}-linux-musl
git clone --depth=1 https://github.com/ericonr/argp-standalone /tmp/argp-standalone
cd /tmp/argp-standalone
autoreconf -fiv
CC=musl-gcc ./configure --prefix=/usr
make -j$(nproc)
cp libargp.a ${MUSL_LIB}/
cp argp.h ${MUSL_INC}/
git clone --depth=1 https://github.com/void-linux/musl-fts /tmp/musl-fts
cd /tmp/musl-fts
./bootstrap.sh
CC=musl-gcc ./configure --enable-static --disable-shared \
--prefix=/usr --libdir=${MUSL_LIB} --includedir=${MUSL_INC}
make -j$(nproc) && make install
git clone --depth=1 https://github.com/void-linux/musl-obstack /tmp/musl-obstack
cd /tmp/musl-obstack
./bootstrap.sh
CC=musl-gcc ./configure --enable-static --disable-shared \
--prefix=/usr --libdir=${MUSL_LIB} --includedir=${MUSL_INC}
make -j$(nproc) && make install
- name: Build
run: |
export PROTOC=$(which protoc)
cd plugins/edriver && make build
- name: Strip & upload
run: |
BINARY=plugins/edriver/target/${{ matrix.target }}/release/edriver
strip "$BINARY"
cp "$BINARY" plugins/edriver/edriver-${{ matrix.arch }}
sha256sum plugins/edriver/edriver-${{ matrix.arch }} \
> plugins/edriver/edriver-${{ matrix.arch }}.sha256
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: edriver-${{ matrix.arch }}
path: |
plugins/edriver/edriver-${{ matrix.arch }}
plugins/edriver/edriver-${{ matrix.arch }}.sha256
retention-days: 7
release:
runs-on: ubuntu-latest
needs: build
permissions: write-all
steps:
- name: Extract version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/edriver
- name: Package
run: |
tar zcf /tmp/${{ env.RELEASE_VERSION }}-x86_64.tgz \
-C /tmp/edriver/edriver-x86_64 .
tar zcf /tmp/${{ env.RELEASE_VERSION }}-aarch64.tgz \
-C /tmp/edriver/edriver-aarch64 .
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: false
name: Release ${{ github.ref_name }}
files: |
/tmp/${{ env.RELEASE_VERSION }}-x86_64.tgz
/tmp/${{ env.RELEASE_VERSION }}-aarch64.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}