278 lines
8.8 KiB
YAML
278 lines
8.8 KiB
YAML
name: Build Game
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- '**' # every branch
|
|
- '!no-build-**' # unless marked as no-build
|
|
|
|
env:
|
|
BUILD_TYPE: Release
|
|
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-windows:
|
|
name: Build Windows
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup caches
|
|
uses: ./.github/actions/setup-cache
|
|
with:
|
|
host: linux
|
|
target: win
|
|
|
|
- name: Setup Ninja
|
|
uses: ./.github/actions/setup-ninja
|
|
with:
|
|
host: linux
|
|
|
|
- name: Download llvm-mingw
|
|
run: |
|
|
curl -L https://github.com/mstorsjo/llvm-mingw/releases/download/20260311/llvm-mingw-20260311-msvcrt-ubuntu-22.04-x86_64.tar.xz -o llvm-mingw.tar.xz
|
|
tar -xf llvm-mingw.tar.xz
|
|
mv llvm-mingw-* llvm-mingw
|
|
|
|
- name: Create Build Environment
|
|
run: cmake -E make_directory ${{github.workspace}}/build
|
|
|
|
- name: Configure CMake
|
|
working-directory: ${{github.workspace}}/build
|
|
run: |
|
|
cmake $GITHUB_WORKSPACE \
|
|
-G Ninja \
|
|
-DCMAKE_SYSTEM_NAME=Windows \
|
|
-DCMAKE_C_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-clang \
|
|
-DCMAKE_CXX_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-clang++ \
|
|
-DCMAKE_RC_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-windres \
|
|
-DALSOFT_BACKEND_PIPEWIRE=OFF \
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
|
|
- name: Build
|
|
working-directory: ${{github.workspace}}/build
|
|
run: cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mcpe-windows
|
|
path: |
|
|
${{github.workspace}}/build/MinecraftPE.exe
|
|
${{github.workspace}}/build/libpng16.dll
|
|
${{github.workspace}}/build/OpenAL32.dll
|
|
${{github.workspace}}/build/libz.dll
|
|
|
|
build-ios:
|
|
# credit to pengubow from deepfriedwaffles repo
|
|
name: Build iOS
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@main
|
|
|
|
- name: Build
|
|
run: |
|
|
cd project/iosproj
|
|
xcodebuild -scheme minecraftpe -derivedDataPath build -destination 'generic/platform=iOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
|
|
mkdir -p Payload
|
|
cp -R build/Build/Products/Debug-iphoneos/minecraftpe.app Payload/
|
|
zip -r minecraftpe.ipa Payload
|
|
rm -rf Payload
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: minecraftpe-ios
|
|
path: project/iosproj/minecraftpe.ipa
|
|
|
|
build-linux:
|
|
name: Build Linux
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup caches
|
|
uses: ./.github/actions/setup-cache
|
|
with:
|
|
host: linux
|
|
target: linux
|
|
|
|
- name: Create Build Environment
|
|
run: cmake -E make_directory ${{github.workspace}}/build
|
|
|
|
- name: Setup Environment
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install gcc-multilib
|
|
sudo apt-get install -y --no-install-recommends build-essential libgl-dev libwayland-dev xorg-dev libxkbcommon-dev
|
|
|
|
- name: Configure CMake
|
|
shell: bash
|
|
working-directory: ${{github.workspace}}/build
|
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
|
|
- name: Build
|
|
working-directory: ${{github.workspace}}/build
|
|
shell: bash
|
|
run: |
|
|
cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel
|
|
cmake --build . --config $BUILD_TYPE --target MinecraftPE-server --parallel
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mcpe-linux
|
|
path: |
|
|
${{github.workspace}}/build/MinecraftPE
|
|
${{github.workspace}}/build/MinecraftPE-server
|
|
|
|
build-android:
|
|
name: Build Android (${{ matrix.abi }})
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
abi: [ arm64-v8a, armeabi-v7a ]
|
|
|
|
env:
|
|
ANDROID_SDK_ROOT: ${{ github.workspace }}/android-sdk
|
|
ANDROID_NDK_PATH: ${{ github.workspace }}/android-ndk-r14b
|
|
ANDROID_PLATFORM_API: 36
|
|
ANDROID_BUILD_TOOLS_VERSION: 36.0.0
|
|
ADB: /bin/true
|
|
MATRIX_ABI: ${{ matrix.abi }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache Android command-line tools
|
|
id: cache-android-tools
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ env.ANDROID_SDK_ROOT }}
|
|
key: android-cmdline-tools-v36
|
|
|
|
- name: Setup Android command line tools
|
|
if: steps.cache-android-tools.outputs.cache-hit != 'true'
|
|
run: |
|
|
if [ ! -d "$ANDROID_SDK_ROOT/cmdline-tools/latest" ]; then
|
|
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
|
|
curl -o cmdline-tools.zip -L "https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip"
|
|
unzip -q cmdline-tools.zip -d "$ANDROID_SDK_ROOT/cmdline-tools"
|
|
mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
|
fi
|
|
yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" "platforms;android-${ANDROID_PLATFORM_API}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}"
|
|
|
|
- name: Cache Android NDK r14b
|
|
id: cache-android-ndk
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ github.workspace }}/android-ndk-r14b
|
|
key: android-ndk-r14b
|
|
|
|
- name: Install Android NDK r14b
|
|
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
|
|
run: |
|
|
if [ ! -d "$ANDROID_NDK_PATH" ]; then
|
|
curl -L -o ndk.zip "https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip"
|
|
unzip -q ndk.zip -d "$GITHUB_WORKSPACE"
|
|
fi
|
|
|
|
- name: Install system prerequisites
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y --no-install-recommends wget unzip curl git python3 libncurses6 libtinfo6
|
|
if ! ldconfig -p | grep -q "libncurses.so.5"; then
|
|
sudo ln -sf /lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5 || true
|
|
fi
|
|
if ! ldconfig -p | grep -q "libtinfo.so.5"; then
|
|
sudo ln -sf /lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5 || true
|
|
fi
|
|
|
|
- name: Setup Java 25
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
|
|
- name: Validate environment
|
|
run: |
|
|
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
|
|
echo "ANDROID_NDK_PATH=$ANDROID_NDK_PATH"
|
|
echo "JAVA_HOME=$JAVA_HOME"
|
|
echo "MATRIX_ABI=$MATRIX_ABI"
|
|
$ANDROID_SDK_ROOT/platform-tools/adb version || true
|
|
java -version
|
|
javac -version
|
|
|
|
- name: Run Android build script
|
|
run: |
|
|
chmod +x ./build.sh
|
|
./build.sh
|
|
|
|
- name: Upload APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: minecraftpe-apk-${{ matrix.abi }}
|
|
path: ${{ github.workspace }}/build-apk/minecraftpe-*-debug.apk
|
|
|
|
build-web:
|
|
name: Build Web
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup caches
|
|
uses: ./.github/actions/setup-cache
|
|
with:
|
|
host: linux
|
|
target: linux
|
|
|
|
- name: Setup Ninja
|
|
uses: ./.github/actions/setup-ninja
|
|
with:
|
|
host: linux
|
|
|
|
- name: Setup emsdk
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 5.0.3
|
|
actions-cache-folder: 'emsdk-cache'
|
|
|
|
- name: Create Build Environment
|
|
run: cmake -E make_directory ${{github.workspace}}/build
|
|
|
|
- name: Configure CMake
|
|
shell: bash
|
|
working-directory: ${{github.workspace}}/build
|
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/emsdk-cache/emsdk-main/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
|
|
|
|
- name: Build
|
|
working-directory: ${{github.workspace}}/build
|
|
run: cmake --build . --config $BUILD_TYPE --target MinecraftPE --parallel
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mcpe-web
|
|
path: |
|
|
${{github.workspace}}/build/MinecraftPE.js
|
|
${{github.workspace}}/build/MinecraftPE.wasm
|
|
${{github.workspace}}/build/MinecraftPE.data
|
|
|
|
publish:
|
|
name: Publish
|
|
runs-on: ubuntu-latest
|