-
Notifications
You must be signed in to change notification settings - Fork 5
111 lines (97 loc) · 3.06 KB
/
build.yml
File metadata and controls
111 lines (97 loc) · 3.06 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
name: Release Binaries
on:
push:
tags:
- 'v*'
workflow_dispatch: # Allows manual testing
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: linux-x64
os: ubuntu-20.04
output_name: bbfmux
cmake_target: bbfmux
# Make Static
cmake_flags: >-
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc"
- target: windows-x64
os: windows-latest
output_name: bbfmux.exe
cmake_target: bbfmux
# Static (#3)
cmake_flags: >-
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
- target: wasm
os: ubuntu-latest
output_name: libbbf_wasm.js
cmake_target: libbbf_wasm
is_wasm: true
cmake_flags: -DCMAKE_BUILD_TYPE=Release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Emscripten
if: matrix.is_wasm
uses: mymindstorm/setup-emsdk@v14
- name: Configure CMake
run: >
${{ matrix.is_wasm && 'emcmake' || '' }} cmake -B build
${{ matrix.cmake_flags }}
-DPROJECT_VERSION="${{ github.ref_name || '0.0.1' }}"
- name: Build
# We use the specific target from the matrix (bbfmux OR libbbf_wasm)
run: cmake --build build --config Release --target ${{ matrix.cmake_target }}
- name: Prepare Artifact
shell: bash
run: |
mkdir -p out/
if [ "${{ matrix.is_wasm }}" = "true" ]; then
cp bin/libbbf_wasm.js out/
cp bin/libbbf_wasm.wasm out/
else
if [ -f "bin/Release/${{ matrix.output_name }}" ]; then
cp "bin/Release/${{ matrix.output_name }}" out/
elif [ -f "bin/${{ matrix.output_name }}" ]; then
cp "bin/${{ matrix.output_name }}" out/
else
echo "::error::Could not find binary ${{ matrix.output_name }} in bin/ or bin/Release/"
ls -R bin/
exit 1
fi
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-binary
path: out/*
create_release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: bin-temp
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
bin-temp/bbfmux
bin-temp/bbfmux.exe
bin-temp/libbbf_wasm.js
bin-temp/libbbf_wasm.wasm
generate_release_notes: true