-
Notifications
You must be signed in to change notification settings - Fork 0
295 lines (260 loc) · 10.4 KB
/
docker-image.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: Build and Release
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
create-tag:
name: Create Tag and Release
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.generate_tag.outputs.tag_name }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Generate Tag Name
id: generate_tag
run: |
timestamp=$(date +%Y%m%d%H%M%S)
tag=JukaGUI-$timestamp
echo "tag_name=$tag" >> $GITHUB_OUTPUT
- name: Set Tag using GitHub Script
id: set_tag
uses: actions/github-script@v5
with:
script: |
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${{ steps.generate_tag.outputs.tag_name }}`,
sha: context.sha,
})
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.generate_tag.outputs.tag_name }}
release_name: ${{ steps.generate_tag.outputs.tag_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-publish-ubuntu:
runs-on: ubuntu-latest
needs: create-tag
container:
image: anibaldeboni/trimui-smart-pro-toolchain:latest
env:
TAG_NAME: ${{ needs.create-tag.outputs.tag_name }}
UPLOAD_URL: ${{ needs.create-tag.outputs.upload_url }}
steps:
- name: Debug TAG_NAME
run: |
echo "Debug TAG_NAME: ${TAG_NAME}"
- name: Check Tag Name Variable
run: |
if [ -z "${TAG_NAME}" ]; then
echo "TAG_NAME variable does not exist. Exiting."
exit 1
else
echo "TAG_NAME variable exists: ${TAG_NAME}"
fi
- name: Check out the repo
uses: actions/checkout@v4
- name: Download and Install ARM Libraries
run: |
mkdir -p ${SYSROOT}/usr/lib
mkdir -p ${SYSROOT}/usr/include
# Download and install zlib 1.3.1
wget https://zlib.net/zlib-1.3.1.tar.gz
tar -xzf zlib-1.3.1.tar.gz
cd zlib-1.3.1
./configure --prefix=${SYSROOT}/usr
make
make install
cd ..
# Download and install libpng 1.6.37
wget https://download.sourceforge.net/libpng/libpng-1.6.37.tar.gz
tar -xzf libpng-1.6.37.tar.gz
cd libpng-1.6.37
./configure --host=aarch64-linux-gnu --prefix=${SYSROOT}/usr
make
make install
cd ..
# Download and install libjpeg
wget http://www.ijg.org/files/jpegsrc.v9d.tar.gz
tar -xzf jpegsrc.v9d.tar.gz
cd jpeg-9d
./configure --host=aarch64-linux-gnu --prefix=${SYSROOT}/usr
make
make install
cd ..
# Download and install libbz2
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
tar -xzf bzip2-1.0.8.tar.gz
cd bzip2-1.0.8
make CC="aarch64-linux-gnu-gcc" AR="aarch64-linux-gnu-ar" RANLIB="aarch64-linux-gnu-ranlib" libbz2.a
cp libbz2.a ${SYSROOT}/usr/lib/
cp bzlib.h ${SYSROOT}/usr/include/
cd ..
# Download and install libtiff
wget http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
tar -xzf tiff-4.0.9.tar.gz
cd tiff-4.0.9
if [ -f config/config.sub ]; then sed -i 's/| x86_64)/| x86_64| aarch64)/' config/config.sub; fi
./configure --host=aarch64-linux-gnu --prefix=${SYSROOT}/usr
make
make install
cd ..
# Download and install libwebp
wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.0.tar.gz
tar -xzf libwebp-1.0.0.tar.gz
cd libwebp-1.0.0
if [ -f config/config.sub ]; then sed -i 's/| x86_64)/| x86_64| aarch64)/' config/config.sub; fi
./configure --host=aarch64-linux-gnu --prefix=${SYSROOT}/usr
make
make install
cd ..
export SYSROOT=/usr/local/aarch64-linux-gnu-7.5.0-linaro/sysroot
export CC="aarch64-linux-gnu-gcc --sysroot=${SYSROOT}"
export CXX="aarch64-linux-gnu-g++ --sysroot=${SYSROOT}"
export CGO_ENABLED=1
export GOARCH=arm64
export GOOS=linux
export CGO_CFLAGS="-I${SYSROOT}/usr/include -I/usr/aarch64-linux-gnu/include -I/usr/aarch64-linux-gnu/include/SDL2 -I/usr/include/SDL2 -D_REENTRANT"
export CGO_LDFLAGS="-L${SYSROOT}/usr/lib -L/usr/lib/aarch64-linux-gnu -lSDL2_image -lSDL2_ttf -lSDL2 -lpng -ltiff -lwebp -lfreetype -ljpeg -lz -lbz2 -ldl -lpthread -lm"
ln -s ${SYSROOT}/lib/libpthread.so.0 /usr/lib/libpthread.so.0
ln -s ${SYSROOT}/usr/lib/libpthread_nonshared.a /usr/lib/libpthread_nonshared.a
- name: Install Dependencies
run: |
cd player
GOPROXY=https://proxy.golang.org,direct
go mod tidy
- name: Build Package
run: |
mkdir -p ../JukaGUI-Trimui
cd player
echo "Building package..."
CGO_ENABLED=1 \
CC="aarch64-linux-gnu-gcc --sysroot=${SYSROOT}" \
CXX="aarch64-linux-gnu-g++ --sysroot=${SYSROOT}" \
GOARCH=arm64 \
GOOS=linux \
CGO_CFLAGS="-I${SYSROOT}/usr/include -I/usr/aarch64-linux-gnu/include -I/usr/aarch64-linux-gnu/include/SDL2 -I/usr/include/SDL2 -D_REENTRANT" \
CGO_LDFLAGS="-L${SYSROOT}/usr/lib -L/usr/lib/aarch64-linux-gnu -lSDL2_image -lSDL2_ttf -lSDL2 -ldl -lpthread -lm" \
go build -tags dynamic -o ../JukaGUI-Trimui/JukaGUI ./
echo "Build completed."
- name: Package Artifacts
run: |
mkdir -p JukaGUI-Trimui
cp player/jukaconfig.json JukaGUI-Trimui/
cp player/Roboto-Black.ttf JukaGUI-Trimui/
cp player/launch.sh JukaGUI-Trimui/
cp player/config.json JukaGUI-Trimui/
cp player/background.jpg JukaGUI-Trimui/
cp player/JukaPlayer.png JukaGUI-Trimui/
zip -r JukaGUI-Trimui.zip JukaGUI-Trimui/
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.create-tag.outputs.upload_url }}
asset_path: ./JukaGUI-Trimui.zip
asset_name: JukaGUI-Trimui.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-publish-windows:
runs-on: macos-latest
needs: create-tag
env:
TAG_NAME: ${{ needs.create-tag.outputs.tag_name }}
UPLOAD_URL: ${{ needs.create-tag.outputs.upload_url }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Install Homebrew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Install MinGW
run: brew install mingw-w64
- name: Set up MinGW directories
run: |
MINGW_DIR=$(brew --prefix mingw-w64)/toolchain-x86_64
mkdir -p $MINGW_DIR/x86_64-w64-mingw32/bin
mkdir -p $MINGW_DIR/x86_64-w64-mingw32/include
mkdir -p $MINGW_DIR/x86_64-w64-mingw32/lib
- name: Download and Install SDL2
run: |
# Download SDL2 development libraries
curl -LO https://www.libsdl.org/release/SDL2-devel-2.30.11-mingw.tar.gz
tar -xzf SDL2-devel-2.30.11-mingw.tar.gz
MINGW_DIR=$(brew --prefix mingw-w64)/toolchain-x86_64
sudo cp -r SDL2-2.30.11/x86_64-w64-mingw32/* $MINGW_DIR/x86_64-w64-mingw32/
- name: Download and Install SDL2_image
run: |
# Download SDL2_image development libraries
curl -LO https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.4/SDL2_image-devel-2.8.4-mingw.tar.gz
tar -xzf SDL2_image-devel-2.8.4-mingw.tar.gz
MINGW_DIR=$(brew --prefix mingw-w64)/toolchain-x86_64
sudo cp -r SDL2_image-2.8.4/x86_64-w64-mingw32/* $MINGW_DIR/x86_64-w64-mingw32/
- name: Download and Install SDL2_ttf
run: |
# Download SDL2_ttf development libraries
curl -LO https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-devel-2.22.0-mingw.tar.gz
tar -xzf SDL2_ttf-devel-2.22.0-mingw.tar.gz
MINGW_DIR=$(brew --prefix mingw-w64)/toolchain-x86_64
sudo cp -r SDL2_ttf-2.22.0/x86_64-w64-mingw32/* $MINGW_DIR/x86_64-w64-mingw32/
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.23'
- name: Install Dependencies
run: |
cd player
go mod tidy
- name: Verify Go Environment
run: go env
- name: Verify Compiler
run: |
x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-g++ --version
- name: Build Package
env:
CC: "x86_64-w64-mingw32-gcc"
CXX: "x86_64-w64-mingw32-g++"
CGO_ENABLED: 1
GOARCH: "amd64"
GOOS: "windows"
MINGW_DIR: $(brew --prefix mingw-w64)/toolchain-x86_64
CGO_CFLAGS: "-I$(brew --prefix mingw-w64)/toolchain-x86_64/x86_64-w64-mingw32/include -D_REENTRANT"
CGO_LDFLAGS: "-L$(brew --prefix mingw-w64)/toolchain-x86_64/x86_64-w64-mingw32/lib -lSDL2"
run: |
mkdir -p ../JukaGUI-Trimui-Windows
cd player
echo "CC: $CC"
echo "CXX: $CXX"
echo "CGO_CFLAGS: $CGO_CFLAGS"
echo "CGO_LDFLAGS: $CGO_LDFLAGS"
go build -o ../JukaGUI-Trimui-Windows/JukaGUI.exe ./
echo "Build completed."
- name: Package Artifacts
run: |
cd player
cp jukaconfig.json Roboto-Black.ttf background.jpg SDL2.dll SDL2_image.dll SDL2_ttf.dll ../JukaGUI-Trimui-Windows/
cd ..
zip -r JukaGUI-Windows.zip JukaGUI-Trimui-Windows/
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.create-tag.outputs.upload_url }}
asset_path: ./JukaGUI-Windows.zip
asset_name: JukaGUI-Windows.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}