-
Notifications
You must be signed in to change notification settings - Fork 0
258 lines (226 loc) · 9.23 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
name: Build and Release
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
jobs:
create-tag:
name: Create Tag
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.set_tag_name.outputs.tag_name }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Create Tag
id: create_tag
uses: actions/github-script@v5
with:
script: |
const timestamp = new Date().toISOString().replace(/[-:]/g, '').replace(/\..+/, '');
const tag = `JukaGUI-${timestamp}`;
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${tag}`,
sha: context.sha,
});
return { tag: tag };
- name: Set Output Tag Name
id: set_tag_name
run: echo "tag_name=${{ steps.create_tag.outputs.tag }}" >> $GITHUB_ENV
build-and-publish-ubuntu:
name: Build and Publish (Ubuntu)
runs-on: ubuntu-latest
needs: create-tag
container:
image: anibaldeboni/trimui-smart-pro-toolchain:latest
steps:
- 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 -lpng -ltiff -lwebp -lfreetype -ljpeg -lz -lbz2 -ldl -lpthread -lm" \
go build -tags static -ldflags "-s -w -extldflags '-static'" -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: Confirm Tag Name
run: echo "Tag name is ${{ env.tag_name }}"
- name: Create Release
uses: actions/create-release@v1
id: create_release
with:
tag_name: ${{ env.tag_name }}
release_name: ${{ env.tag_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.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:
name: Build and Publish (Windows)
runs-on: windows-latest
needs: create-tag
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Install mingw-w64
run: |
choco install mingw --version=8.1.0
echo "C:/tools/mingw64/bin" >> $GITHUB_PATH
- name: Download and Install SDL2
run: |
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL/releases/download/release-2.30.11/SDL2-devel-2.30.11-mingw.zip -OutFile SDL2.zip
Expand-Archive -Path SDL2.zip -DestinationPath SDL2
xcopy SDL2\SDL2-2.30.11\x86_64-w64-mingw32 C:\tools\mingw64 /E /I /Y
- name: Download and Install SDL_image and SDL_ttf
run: |
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.4/SDL2_image-devel-2.8.4-mingw.zip -OutFile SDL2_image.zip
Invoke-WebRequest -Uri https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.22.0/SDL2_ttf-devel-2.22.0-mingw.zip -OutFile SDL2_ttf.zip
Expand-Archive -Path SDL2_image.zip -DestinationPath SDL2_image
Expand-Archive -Path SDL2_ttf.zip -DestinationPath SDL2_ttf
xcopy SDL2_image\SDL2_image-2.8.4\x86_64-w64-mingw32 C:\tools\mingw64 /E /I /Y
xcopy SDL2_ttf\SDL2_ttf-2.22.0\x86_64-w64-mingw32 C:\tools\mingw64 /E /I /Y
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.23'
- name: Install Dependencies
run: |
cd player
go mod tidy
- name: Build Package
run: |
mkdir -p ../JukaGUI-Trimui-Windows
cd player
$env:CGO_CFLAGS="-IC:/tools/mingw64/x86_64-w64-mingw32/include/SDL2"
$env:CGO_LDFLAGS="-LC:/tools/mingw64/x86_64-w64-mingw32/lib"
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-Trimui-Windows.zip JukaGUI-Trimui-Windows/
- name: Confirm Tag Name
run: echo "Tag name is ${{ env.tag_name }}"
- name: Create Release
uses: actions/create-release@v1
id: create_release
with:
tag_name: ${{ env.tag_name }}
release_name: ${{ env.tag_name }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./JukaGUI-Trimui-Windows.zip
asset_name: JukaGUI-Trimui-Windows.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}