-
Notifications
You must be signed in to change notification settings - Fork 0
253 lines (194 loc) · 7.8 KB
/
energy-build-package_linux.yml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Energy Build and Package Linux
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
jobs:
Linux-32:
runs-on: ${{ matrix.operating-system }}
# 因 glib c限制, 最底支持ubuntu 18.04 - 不修改
strategy:
matrix:
operating-system: [ ubuntu-20.04 ]
include:
- arch: i386
distro: ubuntu:18.04
steps:
- uses: actions/checkout@v4
# 配置基础环境 - 不修改
- name: Config Base Environment
run: |
mkdir $RUNNER_WORKSPACE/install
mkdir $RUNNER_WORKSPACE/energy
mv ./.github/shell $RUNNER_WORKSPACE/shell
chmod -R +x $RUNNER_WORKSPACE/shell
# 在 docker 内构建 - 不修改
- name: Container Build and Package
uses: uraimo/run-on-arch-action@v2
id: build
with:
arch: none
distro: none
base_image: ${{ matrix.arch }}/${{ matrix.distro }}
githubToken: ${{ github.token }} # 不需要,但可加快构建速度
dockerRunArgs: | # 挂载目录 固定 /app
--volume "$RUNNER_WORKSPACE:/app"
env: | # 脚本安装 预配置 - Go版本
GoVer: go1.20.14.linux-386.tar.gz
ENERGY_FRAMEWORK: CEF-101_LINUX_32
CEFVer: 101.0.18
LibLCLVer: 2.5.1
shell: /bin/bash # 在容器中运行命令的shell
install: | #在容器中安装一些依赖项
apt-get update -q -y
apt-get install -q -y git wget curl p7zip-full
apt-get install -q -y make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libgtk-3-dev
run: | # run 在容器中运行的命令 - 根据情况修改
# 1. 预设置全局Go环境变量
export GOBIN=/app/go/bin
export PATH=$PATH:/app/go/bin
# 2. 安装当前系统架构的 Golang, https://golang.google.cn/dl/
/app/shell/install-go.sh $GoVer
# 3. 安装 energy cli
/app/shell/install-energy.sh
# 4. 安装 EnergyFramework, 该脚本 有3个参数, 1: CEF 版本, 2: liblcl 版本, 3: 可选 "" 或 gtk3
# CEF: https://sourceforge.net/projects/liblcl/files/CEF
# LibLCL: https://sourceforge.net/projects/liblcl/files
/app/shell/install-energy-framework.sh $CEFVer $LibLCLVer
# 5. 使用 energy cli 开发开发环境 .energy
energy env -w root:/app/
energy env -w framework:$ENERGY_FRAMEWORK
energy env
# 6. 开始构建和打包项目
cd /app/demo-actions
go env -w GOFLAGS=-buildvcs=false
go mod tidy
energy build -o demo
file demo
energy package -f demo -o demo-linux32.deb
# 7. 将安装包移动到 /app/install 目录
mv /app/demo-actions/build/linux/demo-linux32.deb /app/install
- name: Build and Package END
run: |
ls -l $RUNNER_WORKSPACE/install
- name: Release Dynamic library # 版本发布上传liblcl二进制
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ../install/**
Linux-64:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-20.04 ]
include:
- arch: amd64
distro: ubuntu:18.04
steps:
- uses: actions/checkout@v4
- name: Config Base Environment # 配置基础环境
run: |
mkdir $RUNNER_WORKSPACE/install
mv ./.github/shell $RUNNER_WORKSPACE/shell
chmod -R +x $RUNNER_WORKSPACE/shell
- name: Container Build and Package
uses: uraimo/run-on-arch-action@v2
id: build
with:
arch: none
distro: none
base_image: ${{ matrix.arch }}/${{ matrix.distro }}
githubToken: ${{ github.token }} # 不需要,但可加快构建速度
dockerRunArgs: | # 挂载目录 固定 /app
--volume "$RUNNER_WORKSPACE:/app"
env: | # 预配置
GoVer: go1.20.14.linux-amd64.tar.gz
shell: /bin/bash # 在容器中运行命令的shell
install: | #在容器中安装一些依赖项, 实际没全用上
apt-get update -q -y
apt-get install -q -y git wget p7zip-full
apt-get install -q -y make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libgtk-3-dev
run: | # run 在容器中运行的命令
# 注意 “demo-actions” 是实际的仓库(文件夹)名
# 1. 预设置全局Go环境变量
export GOBIN=/app/go/bin
export PATH=$PATH:/app/go/bin
# 2. 安装当前系统架构的 Golang, https://golang.google.cn/dl/
# 因为需要构建 energy cli
/app/shell/install-go.sh $GoVer
# 3. 安装 energy
/app/shell/install-energy.sh
# 4. 安装 开发环境 使用最新版本
energy install --all
energy env
# 5. 开始构建和打包项目
cd /app/demo-actions
# 要设置一下
go env -w GOFLAGS=-buildvcs=false
energy build -o demo
file demo
energy package -f demo -o demo-linux64.deb
# 6. 将安装包移动到 /app/install 目录
mv /app/demo-actions/build/linux/demo-linux64.deb /app/install
- name: Build and Package END
run: |
ls -l $RUNNER_WORKSPACE/install
- name: Release Dynamic library # 版本发布上传liblcl二进制
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ../install/**
Linux-arm64:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-20.04 ]
include:
- arch: arm64v8
distro: ubuntu:18.04
steps:
- uses: actions/checkout@v4
- name: Config Base Environment
run: |
mkdir $RUNNER_WORKSPACE/install
mv ./.github/shell $RUNNER_WORKSPACE/shell
chmod -R +x $RUNNER_WORKSPACE/shell
- name: Container Build and Package
uses: uraimo/run-on-arch-action@v2
id: build
with:
arch: none
distro: none
base_image: ${{ matrix.arch }}/${{ matrix.distro }}
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "$RUNNER_WORKSPACE:/app"
env: |
GoVer: go1.20.14.linux-arm64.tar.gz
shell: /bin/bash
install: |
apt-get update -q -y
apt-get install -q -y git wget p7zip-full
apt-get install -q -y make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libgtk-3-dev
run: |
export GOBIN=/app/go/bin
export PATH=$PATH:/app/go/bin
/app/shell/install-go.sh $GoVer
/app/shell/install-energy.sh
energy install --all
energy env
cd /app/demo-actions
go env -w GOFLAGS=-buildvcs=false
energy build -o demo
file demo
energy package -f demo -o demo-linuxarm64.deb
mv /app/demo-actions/build/linux/demo-linuxarm64.deb /app/install
- name: Build and Package END
run: |
ls -l $RUNNER_WORKSPACE/install
- name: Release Dynamic library
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ../install/**