-
Notifications
You must be signed in to change notification settings - Fork 1
268 lines (264 loc) · 10.3 KB
/
Copy pathbuild.yml
File metadata and controls
268 lines (264 loc) · 10.3 KB
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
name: Build OpenMinecraft native version
on: [push, pull_request]
env:
LINK_JOBS: 16
JOBS: 16
MODE: debug
XMAKE_ARGS: -v
ANDROID_NDK_VERSION: r27c
OHOS_SDK_VERSION: 6.1-Release
CROSS_TOOL_VERSION: toolchain-20260719-1
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
plat: windows
arch: x64
loaderarch: amd64
- os: windows-latest
plat: windows
arch: x86
loaderarch: x86
- os: windows-latest
plat: windows
arch: arm64
loaderarch: arm64
- os: ubuntu-latest
plat: mingw
arch: x86_64
loaderarch: amd64
- os: ubuntu-22.04
plat: harmony
arch: arm64-v8a
loaderarch: arm64
- os: ubuntu-22.04
plat: harmony
arch: x86_64
loaderarch: amd64
- os: ubuntu-22.04
plat: android
arch: arm64-v8a
loaderarch: arm64
- os: ubuntu-22.04
plat: android
arch: armeabi-v7a
loaderarch: arm32
- os: ubuntu-22.04
plat: android
arch: x86_64
loaderarch: amd64
- os: ubuntu-22.04
plat: linux
arch: x86_64
loaderarch: amd64
- os: ubuntu-24.04-arm
plat: linux
arch: arm64
loaderarch: arm64
- os: ubuntu-latest
plat: linux-cross
arch: loong64
loaderarch: loong64
- os: ubuntu-latest
plat: linux-cross
arch: riscv64
loaderarch: riscv64
- os: ubuntu-latest
plat: linux-cross
arch: s390x
loaderarch: s390x
- os: ubuntu-latest
plat: linux-cross
arch: ppc64
loaderarch: ppc64
- os: macos-latest
plat: macos
arch: arm64
loaderarch: arm64
- os: macos-15-intel
plat: macos
arch: x86_64
loaderarch: amd64
- os: macos-latest
plat: ios
arch: arm64
loaderarch: arm64
- os: ubuntu-latest
plat: freebsd
arch: x86_64
loaderarch: amd64
- os: ubuntu-latest
plat: freebsd
arch: arm64
loaderarch: arm64
- os: ubuntu-latest
plat: freebsd
arch: riscv64
loaderarch: riscv64
- os: ubuntu-latest
plat: freebsd
arch: ppc64
loaderarch: ppc64
name: Build ${{ matrix.plat }}-${{ matrix.loaderarch }}
runs-on: ${{ matrix.os }}
permissions:
actions: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'true'
- name: Generate cache name (UNIX)
if: matrix.plat != 'windows'
run: |
CACHENAME=$(python ./misc/simple_name_gen.py)
echo $CACHENAME
echo "CACHENAME=$CACHENAME" >> $GITHUB_ENV
echo "CACHEPATH=~/.xmake/packages" >> $GITHUB_ENV
- name: Generate cache name (Windows)
if: matrix.plat == 'windows'
run: |
$CACHENAME = python ./misc/simple_name_gen.py
echo "CACHENAME=$CACHENAME" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "CACHEPATH=C:/Users/runneradmin/AppData/Local/.xmake/packages" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: MacOS JIT Test
if: matrix.plat == 'macos'
run: |
/usr/libexec/PlistBuddy -c "Add :com.apple.security.cs.allow-jit bool true" jit.entitlements
gcc -g -std=c17 -Wall -Wdeprecated -Wpedantic -Wextra -o ./jit ./misc/jit.c
codesign -s - -f --entitlements jit.entitlements jit
lldb -o r -o exit ./jit
rm jit
- name: Install xmake
if: matrix.plat != 'freebsd'
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@dev
- name: Install xmake from source
if: matrix.plat == 'freebsd'
run: |
git clone https://github.com/OpenMinecraft-Dev/xmake
cd xmake
git submodule update --recursive --init
./scripts/get.sh __local__
source ~/.xmake/profile
- name: Setup Python packages
run: pip install wheel
- name: Restore xmake packages (bootstrap)
uses: actions/cache/restore@v5
with:
path: ${{ env.CACHEPATH }}
key: ${{ matrix.plat }}-${{ matrix.loaderarch }}-pkgs-
restore-keys: ${{ matrix.plat }}-${{ matrix.loaderarch }}-pkgs-
- name: Generate header
run: |
xmake f -yc ${{ env.XMAKE_ARGS }}
xmake -y -v -b openminecraft-bundlemaker
xmake run -y -w . openminecraft-bundlemaker -a Cyrene -c -t boot.bundle -P bootassets
xmake run -w . openminecraft-bundlemaker -r -t boot.bundle
- name: Save xmake packages (bootstrap)
uses: actions/cache/save@v5
with:
path: ${{ env.CACHEPATH }}
key: ${{ matrix.plat }}-${{ matrix.loaderarch }}-pkgs-${{ env.CACHENAME }}
- name: Clear xmake cache
run: rm -r ${{ env.CACHEPATH }}
- name: Restore xmake packages (Core)
uses: actions/cache/restore@v5
with:
path: ${{ env.CACHEPATH }}
key: ${{ matrix.plat }}-${{ matrix.loaderarch }}-corepkgs-
restore-keys: ${{ matrix.plat }}-${{ matrix.loaderarch }}-corepkgs-
- name: Setup OpenHarmony SDK
if: matrix.plat == 'harmony'
run: |
wget https://repo.huaweicloud.com/openharmony/os/${{ env.OHOS_SDK_VERSION }}/ohos-sdk-windows_linux-public.tar.gz
tar -zxvf ohos-sdk-windows_linux-public.tar.gz
unzip linux/native*.zip
- name: Setup Android NDK
if: matrix.plat == 'android'
run: |
wget https://dl.google.com/android/repository/android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip
unzip android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip
- name: Configure MacOS
if: matrix.plat == 'macos'
run: xmake f -m ${{ env.MODE }} --cxx="clang++" -yc ${{ env.XMAKE_ARGS }}
- name: Configure IOS
if: matrix.plat == 'ios'
run: xmake f -p iphoneos -m ${{ env.MODE }} --cc="clang" -yc ${{ env.XMAKE_ARGS
}}
- name: Configure OpenHarmony
if: matrix.plat == 'harmony'
run: xmake f -p harmony -a ${{ matrix.arch }} --toolchain=hdk --sdk=${{
github.workspace }}/native --cxflags="-fPIC" --cflags="-fPIC" -m ${{
env.MODE }} -yc ${{ env.XMAKE_ARGS }}
- name: Configure Android
if: matrix.plat == 'android'
run: xmake f -p android -a ${{ matrix.arch }} --ndk=${{ github.workspace
}}/android-ndk-${{ env.ANDROID_NDK_VERSION }} -m ${{ env.MODE }} -yc
${{ env.XMAKE_ARGS }} --cxxflags="-fPIC"
- name: Configure Linux
if: ${{ matrix.plat == 'linux' }}
run: |
sudo apt update
sudo apt install libgl1-mesa-dev
xmake f -a ${{ matrix.arch }} -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }}
- name: Configure Linux Cross
if: ${{ matrix.plat == 'linux-cross' }}
run: |
sudo apt update
sudo apt install clang llvm
wget https://github.com/OpenMinecraft-Dev/cross-toolchain-sysroot/releases/download/${{ env.CROSS_TOOL_VERSION }}/llvm-toolchain-linux-debian-${{ matrix.arch }}.tar.xz
mkdir toolchain
tar -xJf llvm-toolchain-linux-debian-${{ matrix.arch }}.tar.xz -C ./toolchain/
rm llvm-toolchain-linux-debian-${{ matrix.arch }}.tar.xz
xmake f --toolchain=llvm --sdk=${{ github.workspace }}/toolchain -a ${{ matrix.arch }} -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }}
- name: Configure FreeBSD Cross
if: ${{ matrix.plat == 'freebsd' }}
run: |
sudo apt update
sudo apt install clang llvm
wget https://github.com/OpenMinecraft-Dev/cross-toolchain-sysroot/releases/download/${{ env.CROSS_TOOL_VERSION }}/llvm-toolchain-freebsd-${{ matrix.arch }}.tar.xz
mkdir toolchain
tar -xJf llvm-toolchain-freebsd-${{ matrix.arch }}.tar.xz -C ./toolchain/
rm llvm-toolchain-freebsd-${{ matrix.arch }}.tar.xz
xmake f --toolchain=llvm --sdk=${{ github.workspace }}/toolchain -a ${{ matrix.arch }} -m ${{ env.MODE }} -p bsd --target_os=FreeBSD -yc ${{ env.XMAKE_ARGS }}
- name: Configure Windows
if: matrix.plat == 'windows'
run: xmake f --toolchain=msvc -a ${{ matrix.arch }} -m ${{ env.MODE }} -yc ${{
env.XMAKE_ARGS }}
- name: Configure mingw
if: matrix.plat == 'mingw'
run: |
sudo apt install gcc-mingw-w64 g++-mingw-w64 binutils-mingw-w64 mingw-w64-common mingw-w64-i686-dev mingw-w64-x86-64-dev libz-mingw-w64-dev
xmake f -p mingw -a ${{ matrix.arch }} --toolchain=mingw --sdk=/usr/x86_64-w64-mingw32 --ldflags="-static" -m ${{ env.MODE }} -yc ${{ env.XMAKE_ARGS }}
- name: Save xmake packages (Core)
uses: actions/cache/save@v5
with:
path: ${{ env.CACHEPATH }}
key: ${{ matrix.plat }}-${{ matrix.loaderarch }}-corepkgs-${{ env.CACHENAME }}
- name: Build
run: xmake build -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{
env.XMAKE_ARGS }} openminecraft
- name: Build network tools
run: xmake build -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{
env.XMAKE_ARGS }} openminecraft-test-network
- name: Build VM tools
run: xmake build -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{
env.XMAKE_ARGS }} openminecraft-elysiavis
- name: Xmake Install
run: xmake install -o prod ${{ env.XMAKE_ARGS }} openminecraft
- name: Screen Capture
if: matrix.plat == 'macos'
run: xmake run openminecraft 3dtest gl & ; sleep 15; screencapture -x -C ./prod/temp.png
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: target-${{ matrix.plat }}-${{ matrix.loaderarch }}-${{ env.CACHENAME }}
path: prod/
compression-level: 9