Skip to content

Commit d015176

Browse files
committed
Add a build binary action
1 parent 9b88db0 commit d015176

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

.github/workflows/binary.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: binary
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
binary:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install packages
18+
run: sudo apt-get install -q -y build-essential libolm-dev gcc git cmake
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v3
22+
with:
23+
go-version: "1.20.1"
24+
25+
- name: Build olm
26+
run: |
27+
echo `pwd`
28+
cd /tmp
29+
git clone https://gitlab.matrix.org/matrix-org/olm.git
30+
cd olm
31+
git checkout 3.2.14
32+
cmake . -Bbuild -DBUILD_SHARED_LIBS=NO
33+
cmake --build build
34+
sudo cmake --install build
35+
36+
- name: Build amd64 binary
37+
env:
38+
CGO_ENABLED: 1
39+
run: |
40+
mkdir build
41+
go build -ldflags '-linkmode external -extldflags "-static" -s -w' -o build/matrix-wechat-linux-amd64 main.go
42+
43+
- name: Build arm64 binary
44+
uses: uraimo/run-on-arch-action@v2
45+
with:
46+
arch: aarch64
47+
distro: ubuntu_latest
48+
49+
dockerRunArgs: |
50+
--volume "${PWD}:/src"
51+
52+
install: |
53+
apt-get update -q
54+
apt-get install -q -y wget build-essential libolm-dev gcc git cmake
55+
rm -rf /usr/local/go
56+
wget -q https://go.dev/dl/go1.20.1.linux-arm64.tar.gz
57+
tar -C /usr/local -xzf go1.20.1.linux-arm64.tar.gz
58+
cd /tmp
59+
git clone https://gitlab.matrix.org/matrix-org/olm.git
60+
cd olm
61+
git checkout 3.2.14
62+
cmake . -Bbuild -DBUILD_SHARED_LIBS=NO
63+
cmake --build build
64+
cmake --install build
65+
66+
env: |
67+
CGO_ENABLED: 1
68+
69+
run: |
70+
cd /src
71+
/usr/local/go/bin/go build -ldflags '-linkmode external -extldflags "-static" -s -w' -o build/matrix-wechat-linux-arm64 main.go
72+
73+
- name: Upload artifacts
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: arm64-artifact
77+
path: build
78+
79+
- name: Release
80+
uses: softprops/action-gh-release@v1
81+
with:
82+
tag_name: ${{ github.ref_name }}
83+
files: "build/*"

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: docker
22

33
on:
44
push:

0 commit comments

Comments
 (0)