VM: 重写开始 #509
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build OpenMinecraft native version | |
| on: [push, pull_request] | |
| env: | |
| LINK_JOBS: 16 | |
| JOBS: 16 | |
| MODE: release | |
| XMAKE_ARGS: -v | |
| ANDROID_NDK_VERSION: r27c | |
| OHOS_SDK_VERSION: 5.0.0-Release | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| name: Windows (x64) | |
| plat: windows | |
| arch: x64 | |
| loaderarch: x64 | |
| - os: windows-latest | |
| name: Windows (x86) | |
| plat: windows | |
| arch: x86 | |
| loaderarch: x86 | |
| - os: windows-latest | |
| name: Windows (arm64) | |
| plat: windows | |
| arch: arm64 | |
| loaderarch: arm64 | |
| # - os: ubuntu-22.04 | |
| # name: OpenHarmony (arm64) | |
| # plat: harmony | |
| # arch: arm64-v8a | |
| # loaderarch: arm64 | |
| # - os: ubuntu-22.04 | |
| # name: OpenHarmony (arm32) | |
| # plat: harmony | |
| # arch: armeabi-v7a | |
| # loaderarch: arm32 | |
| # - os: ubuntu-22.04 | |
| # name: OpenHarmony (x64) | |
| # plat: harmony | |
| # arch: x86_64 | |
| # loaderarch: x64 | |
| - os: ubuntu-22.04 | |
| name: Android (arm64) | |
| plat: android | |
| arch: arm64-v8a | |
| loaderarch: arm64 | |
| - os: ubuntu-22.04 | |
| name: Android (arm32) | |
| plat: android | |
| arch: armeabi-v7a | |
| loaderarch: arm32 | |
| - os: ubuntu-22.04 | |
| name: Android (x64) | |
| plat: android | |
| arch: x86_64 | |
| loaderarch: x64 | |
| - os: ubuntu-22.04 | |
| name: Linux (x64) | |
| plat: linux | |
| arch: x64 | |
| loaderarch: x64 | |
| - os: ubuntu-24.04-arm | |
| name: Linux (arm64) | |
| plat: linux | |
| arch: arm64 | |
| loaderarch: arm64 | |
| - os: macos-latest | |
| name: MacOS (arm64) | |
| plat: macos | |
| arch: arm64 | |
| loaderarch: arm64 | |
| - os: macos-13 | |
| name: MacOS (x64) | |
| plat: macos | |
| arch: x64 | |
| loaderarch: x64 | |
| - os: macos-latest | |
| name: IOS | |
| plat: ios | |
| arch: arm64 | |
| loaderarch: arm64 | |
| name: Build ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: 'true' | |
| - name: Install xmake | |
| if: matrix.plat != 'freebsd' | |
| uses: xmake-io/github-action-setup-xmake@v1 | |
| - name: Update xmake repo | |
| if: matrix.plat != 'freebsd' | |
| run: xmake repo -u | |
| - name: Setup Python packages | |
| run: pip install wheel | |
| - name: Free Disk Space (FreeBSD Host) | |
| if: matrix.plat == 'freebsd' | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - 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 }} --sdk=${{ github.workspace }}/native -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 install libgl1-mesa-dev | |
| xmake f -a ${{ matrix.arch }} -m ${{ env.MODE }} -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: Build | |
| run: xmake -y --jobs=${{ env.JOBS }} --linkjobs=${{ env.LINK_JOBS }} ${{ env.XMAKE_ARGS }} | |
| - name: Xmake Install | |
| run: xmake install -o prod ${{ env.XMAKE_ARGS }} openminecraft | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: target-${{ matrix.plat }}-${{ matrix.loaderarch }} | |
| path: prod/ | |