@@ -3,58 +3,109 @@ name: Release Binaries
33on :
44 push :
55 tags :
6- - ' v*' # Trigger on vx.x.x
6+ - ' v*'
7+ workflow_dispatch : # Allows manual testing
78
89permissions :
9- contents : write # Required to create a release and upload assets
10+ contents : write
1011
1112jobs :
1213 build :
13- name : Build for ${{ matrix.os }}
14+ name : Build ${{ matrix.target }}
1415 runs-on : ${{ matrix.os }}
1516 strategy :
17+ fail-fast : false
1618 matrix :
1719 include :
18- - os : ubuntu-latest
19- binary_name : bbfmux
20- compile_cmd : g++ -std=c++17 src/bbfenc.cpp src/libbbf.cpp src/xxhash.c -o bbfmux -pthread
21- - os : windows-latest
22- binary_name : bbfmux.exe
23- compile_cmd : g++ -std=c++17 src/bbfenc.cpp src/libbbf.cpp src/xxhash.c -o bbfmux.exe -municode -static-libgcc -static-libstdc++ -static
20+ - target : linux-x64
21+ os : ubuntu-20.04
22+ output_name : bbfmux
23+ cmake_target : bbfmux
24+ # Make Static
25+ cmake_flags : >-
26+ -DCMAKE_BUILD_TYPE=Release
27+ -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc"
28+
29+ - target : windows-x64
30+ os : windows-latest
31+ output_name : bbfmux.exe
32+ cmake_target : bbfmux
33+ # Static (#3)
34+ cmake_flags : >-
35+ -DCMAKE_BUILD_TYPE=Release
36+ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
37+
38+ - target : wasm
39+ os : ubuntu-latest
40+ output_name : libbbf_wasm.js
41+ cmake_target : libbbf_wasm
42+ is_wasm : true
43+ cmake_flags : -DCMAKE_BUILD_TYPE=Release
2444
2545 steps :
2646 - name : Checkout code
2747 uses : actions/checkout@v4
48+ with :
49+ submodules : recursive
50+
51+ - name : Setup Emscripten
52+ if : matrix.is_wasm
53+ uses : mymindstorm/setup-emsdk@v14
54+
55+ - name : Configure CMake
56+ run : >
57+ ${{ matrix.is_wasm && 'emcmake' || '' }} cmake -B build
58+ ${{ matrix.cmake_flags }}
59+ -DPROJECT_VERSION="${{ github.ref_name || '0.0.1' }}"
60+
61+ - name : Build
62+ # We use the specific target from the matrix (bbfmux OR libbbf_wasm)
63+ run : cmake --build build --config Release --target ${{ matrix.cmake_target }}
2864
29- - name : Compile
30- run : ${{ matrix.compile_cmd }}
65+ - name : Prepare Artifact
66+ shell : bash
67+ run : |
68+ mkdir -p out/
3169
32- - name : Upload temporary artifact
70+ if [ "${{ matrix.is_wasm }}" = "true" ]; then
71+ cp bin/libbbf_wasm.js out/
72+ cp bin/libbbf_wasm.wasm out/
73+ else
74+ if [ -f "bin/Release/${{ matrix.output_name }}" ]; then
75+ cp "bin/Release/${{ matrix.output_name }}" out/
76+ elif [ -f "bin/${{ matrix.output_name }}" ]; then
77+ cp "bin/${{ matrix.output_name }}" out/
78+ else
79+ echo "::error::Could not find binary ${{ matrix.output_name }} in bin/ or bin/Release/"
80+ ls -R bin/
81+ exit 1
82+ fi
83+ fi
84+
85+ - name : Upload Artifact
3386 uses : actions/upload-artifact@v4
3487 with :
35- name : ${{ matrix.os }}-bin
36- path : ${{ matrix.binary_name }}
88+ name : ${{ matrix.target }}-binary
89+ path : out/*
3790
3891 create_release :
3992 name : Create GitHub Release
4093 needs : build
4194 runs-on : ubuntu-latest
95+ if : startsWith(github.ref, 'refs/tags/')
4296 steps :
43- - name : Checkout code
44- uses : actions/checkout@v4
45-
4697 - name : Download all artifacts
4798 uses : actions/download-artifact@v4
4899 with :
49100 path : bin-temp
50101 merge-multiple : true
51102
52- - name : Create Release and Upload Assets
103+ - name : Create Release
53104 uses : softprops/action-gh-release@v2
54105 with :
55106 files : |
56107 bin-temp/bbfmux
57108 bin-temp/bbfmux.exe
58- generate_release_notes : true # Automatically summarizes commits since last release
59- draft : false
60- prerelease : false
109+ bin-temp/libbbf_wasm.js
110+ bin-temp/libbbf_wasm.wasm
111+ generate_release_notes : true
0 commit comments