File tree Expand file tree Collapse file tree 3 files changed +123
-1
lines changed Expand file tree Collapse file tree 3 files changed +123
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Build
2+
3+ on :
4+ push : {}
5+ pull_request : {}
6+
7+ jobs :
8+ build :
9+ runs-on : ubuntu-22.04
10+ steps :
11+ - name : Checkout code
12+ uses : actions/checkout@v4
13+
14+ - name : Set up Go
15+ uses : actions/setup-go@v4
16+ with :
17+ go-version : ' 1.23.x'
18+
19+ - name : Install cross-compilation dependencies
20+ run : |
21+ sudo apt-get update
22+ sudo apt-get install -y \
23+ gcc \
24+ clang \
25+ clang-tools \
26+ g++-mingw-w64-x86-64 \
27+ gcc-mingw-w64-x86-64 \
28+ gcc-riscv64-linux-gnu \
29+ g++-riscv64-linux-gnu \
30+ gcc-aarch64-linux-gnu \
31+ g++-aarch64-linux-gnu \
32+ wget \
33+ tar \
34+ xz-utils \
35+ software-properties-common \
36+ aria2
37+
38+ - name : Install FreeBSD sysroot
39+ run : |
40+ sudo mkdir -p /usr/local/freebsd-sysroot
41+ aria2c -x 4 https://download.freebsd.org/ftp/releases/amd64/13.4-RELEASE/base.txz
42+ sudo tar -xJf base.txz -C /usr/local/freebsd-sysroot
43+ rm base.txz
44+
45+ - name : Install osxcross for Darwin builds
46+ run : |
47+ sudo apt-get install -y \
48+ clang \
49+ cmake \
50+ libxml2-dev \
51+ uuid-dev \
52+ libssl-dev \
53+ zlib1g-dev \
54+ libbz2-dev \
55+ liblzma-dev
56+
57+ git clone https://github.com/tpoechtrager/osxcross.git
58+ cd osxcross
59+ wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz
60+ mv MacOSX11.3.sdk.tar.xz tarballs/
61+ UNATTENDED=1 ./build.sh
62+ echo "$(pwd)/target/bin" >> $GITHUB_PATH
63+
64+ - name : Run make
65+ run : make
66+
67+ - name : Upload artifacts
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : built-binaries
71+ path : bin/
72+ retention-days : 5
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' *'
7+
8+ jobs :
9+ prepare :
10+ runs-on : ubuntu-22.04
11+ outputs :
12+ tag_version : ${{ steps.get_version.outputs.tag_version }}
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v4
16+ with :
17+ fetch-depth : 0
18+
19+ - name : Get tag version
20+ id : get_version
21+ run : |
22+ TAG_VERSION=${GITHUB_REF#refs/tags/}
23+ echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
24+ echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
25+
26+ release :
27+ runs-on : ubuntu-22.04
28+ needs : [prepare]
29+ steps :
30+ - name : Download build artifacts
31+ uses : actions/download-artifact@v3
32+ with :
33+ name : built-binaries
34+ path : bin
35+
36+ - name : Create GitHub Release
37+ uses : softprops/action-gh-release@v2
38+ with :
39+ tag_name : ${{ needs.prepare.outputs.tag_version }}
40+ name : Release ${{ needs.prepare.outputs.tag_version }}
41+ body : |
42+ ## Pre-built binaries
43+ - Static libraries (.a files)
44+ - Header files (.h files)
45+ files : |
46+ bin/*.a
47+ bin/*.h
48+ generate_release_notes : true
49+ draft : false
50+ prerelease : false
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ build_$(1)_$(2):
4646 GOOS=$(1 ) \
4747 GOARCH=$(2 ) \
4848 CC=$(call GET_CC,$(1 ) ,$(2 ) ) \
49- go build -buildmode=c-archive -o $(BIN_DIR ) /${LIB_NAME}-$(1 ) -$(2 ) .a $(SRC )
49+ go build -buildmode=c-archive -ldflags="-s -w" -trimpath - o $(BIN_DIR ) /${LIB_NAME}-$(1 ) -$(2 ) .a $(SRC )
5050.PHONY: build_$(1 ) _$(2 )
5151endef
5252
You can’t perform that action at this time.
0 commit comments