diff --git a/.github/workflows/native-compile-platforms.yml b/.github/workflows/native-compile-platforms.yml index 2f6ff20cef1..8275ed2e167 100644 --- a/.github/workflows/native-compile-platforms.yml +++ b/.github/workflows/native-compile-platforms.yml @@ -13,122 +13,127 @@ concurrency: cancel-in-progress: true jobs: - compile_windows: - name: "Windows" - if: - (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - name: Download external libraries - shell: bash - run: | - EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` - git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external - - name: Install deps - uses: humbletim/setup-vulkan-sdk@v1.2.0 - with: - vulkan-query-version: 1.2.189.0 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - name: Compile win64 - shell: bash - env: - COCOS_ENGINE_DEV: 1 - run: | - cd $GITHUB_WORKSPACE/templates/windows - echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake - echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake - mkdir -p build-win64/proj - touch build-win64/proj/cfg.cmake - echo "set(CC_USE_GLES3 ON)" >> build-win64/proj/cfg.cmake - echo "set(CC_USE_VULKAN ON)" >> build-win64/proj/cfg.cmake - echo "set(CC_USE_GLES2 ON)" >> build-win64/proj/cfg.cmake - echo "set(USE_SPINE OFF)" >> build-win64/proj/cfg.cmake - echo "set(USE_DRAGONBONES OFF)" >> build-win64/proj/cfg.cmake - echo "set(USE_WEBSOCKET_SERVER ON)" >> build-win64/proj/cfg.cmake - echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-win64/proj/cfg.cmake - echo "set(CC_EXECUTABLE_NAME \"\")" >> build-win64/proj/cfg.cmake - mkdir build-win64/assets - cd build-win64 - RES_DIR=${GITHUB_WORKSPACE//\\//}/templates/windows/build-win64 - COCOS_X_PATH=${GITHUB_WORKSPACE//\\//}/native - cmake ../ -G"Visual Studio 16 2019" -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS_X_PATH -Ax64 - cmake --build . --config Release - echo "Compile Win64 Release Done!" - - compile_android_minimal: - name: "Android Minimal" - if: - (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Download external libraries - shell: bash - run: | - EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` - git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external - - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: r23c - add-to-path: false - local-cache: true - - uses: actions/setup-java@v3 - id: setup-jdk - with: - distribution: 'zulu' - java-version: '17' - - name: Compile - env: - COCOS_ENGINE_DEV: 1 - run: | - NATIVE_ROOT=$GITHUB_WORKSPACE/native - ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} - NATIVE_DIR=$GITHUB_WORKSPACE/templates/android-template - echo "Compiling Android ... " - cd $GITHUB_WORKSPACE/templates/ - echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> android/template/Pre-Sample.cmake - echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> android/template/Post-Sample.cmake - if [ ! -d android-template ]; then - cp -r android/template android-template - fi - cd $GITHUB_WORKSPACE/templates/android/build - mkdir -p build-android/proj - touch build-android/proj/cfg.cmake - echo "set(CI_FORCE_MINIMAL_FEATURES ON)" >> build-android/proj/cfg.cmake - echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-android/proj/cfg.cmake - echo "set(CC_EXECUTABLE_NAME \"\")" >> build-android/proj/cfg.cmake - - mkdir -p build-android/proj/res/values - cat << EOF > build-android/proj/res/values/strings.xml - - CocosGame - - EOF + # compile_windows: + # name: "Windows" + # if: + # (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) + # runs-on: windows-2019 + # steps: + # - uses: actions/checkout@v2 + # - name: Download external libraries + # shell: bash + # run: | + # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` + # git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external + # - name: Install deps + # uses: humbletim/setup-vulkan-sdk@v1.2.0 + # with: + # vulkan-query-version: 1.2.189.0 + # vulkan-components: Vulkan-Headers, Vulkan-Loader + # vulkan-use-cache: true + # - name: Compile win64 + # shell: bash + # env: + # COCOS_ENGINE_DEV: 1 + # run: | + # cd $GITHUB_WORKSPACE/templates/windows + # echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake + # echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake + # mkdir -p build-win64/proj + # touch build-win64/proj/cfg.cmake + # echo "set(CC_USE_GLES3 ON)" >> build-win64/proj/cfg.cmake + # echo "set(CC_USE_VULKAN ON)" >> build-win64/proj/cfg.cmake + # echo "set(CC_USE_GLES2 ON)" >> build-win64/proj/cfg.cmake + # echo "set(USE_SPINE OFF)" >> build-win64/proj/cfg.cmake + # echo "set(USE_DRAGONBONES OFF)" >> build-win64/proj/cfg.cmake + # echo "set(USE_WEBSOCKET_SERVER ON)" >> build-win64/proj/cfg.cmake + # echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-win64/proj/cfg.cmake + # echo "set(CC_EXECUTABLE_NAME \"\")" >> build-win64/proj/cfg.cmake + # mkdir build-win64/assets + # cd build-win64 + # RES_DIR=${GITHUB_WORKSPACE//\\//}/templates/windows/build-win64 + # COCOS_X_PATH=${GITHUB_WORKSPACE//\\//}/native + # cmake ../ -G"Visual Studio 16 2019" -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS_X_PATH -Ax64 + # cmake --build . --config Release + # echo "Compile Win64 Release Done!" + + # compile_android_minimal: + # name: "Android Minimal" + # if: + # (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Download external libraries + # shell: bash + # run: | + # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` + # git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external + # - uses: nttld/setup-ndk@v1 + # id: setup-ndk + # with: + # ndk-version: r23c + # add-to-path: false + # local-cache: true + # - uses: actions/setup-java@v3 + # id: setup-jdk + # with: + # distribution: 'zulu' + # java-version: '17' + # - name: Compile + # env: + # COCOS_ENGINE_DEV: 1 + # run: | + # NATIVE_ROOT=$GITHUB_WORKSPACE/native + # ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} + # NATIVE_DIR=$GITHUB_WORKSPACE/templates/android-template + # echo "Compiling Android ... " + # cd $GITHUB_WORKSPACE/templates/ + # echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> android/template/Pre-Sample.cmake + # echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> android/template/Post-Sample.cmake + # if [ ! -d android-template ]; then + # cp -r android/template android-template + # fi + # cd $GITHUB_WORKSPACE/templates/android/build + # mkdir -p build-android/proj + # touch build-android/proj/cfg.cmake + # echo "set(CI_FORCE_MINIMAL_FEATURES ON)" >> build-android/proj/cfg.cmake + # echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-android/proj/cfg.cmake + # echo "set(CC_EXECUTABLE_NAME \"\")" >> build-android/proj/cfg.cmake + + # mkdir -p build-android/proj/res/values + # cat << EOF > build-android/proj/res/values/strings.xml + # + # CocosGame + # + # EOF - mkdir -p build-android/assets + # mkdir -p build-android/assets - ASSET_DIR=$GITHUB_WORKSPACE/templates/android/build/build-android/ + # ASSET_DIR=$GITHUB_WORKSPACE/templates/android/build/build-android/ - sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDROID_NDK@g" gradle.properties - sed -i "s@^APPLICATION_ID.*@APPLICATION_ID=com.cocos.android@g" gradle.properties - sed -i "s@^RES_PATH.*@RES_PATH=$ASSET_DIR@g" gradle.properties - sed -i "s@^COCOS_ENGINE_PATH.*@COCOS_ENGINE_PATH=$NATIVE_ROOT@g" gradle.properties - sed -i "s@^NATIVE_DIR.*@NATIVE_DIR=$NATIVE_DIR@g" gradle.properties + # sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDROID_NDK@g" gradle.properties + # sed -i "s@^APPLICATION_ID.*@APPLICATION_ID=com.cocos.android@g" gradle.properties + # sed -i "s@^RES_PATH.*@RES_PATH=$ASSET_DIR@g" gradle.properties + # sed -i "s@^COCOS_ENGINE_PATH.*@COCOS_ENGINE_PATH=$NATIVE_ROOT@g" gradle.properties + # sed -i "s@^NATIVE_DIR.*@NATIVE_DIR=$NATIVE_DIR@g" gradle.properties - # To speedup CI, compile arm64-v8a only - # sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86@g" gradle.properties - sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=arm64-v8a@g" gradle.properties + # # To speedup CI, compile arm64-v8a only + # # sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86@g" gradle.properties + # sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=arm64-v8a@g" gradle.properties - echo "Compile Android - cmake ..." - echo "ANDROID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" - # ./gradlew :CocosGame:assembleDebug --quiet - ./gradlew :CocosGame:assembleRelease --quiet - echo "Compile Android Debug Done!" + # echo "Compile Android - cmake ..." + # echo "ANDROID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" + # # ./gradlew :CocosGame:assembleDebug --quiet + # ./gradlew :CocosGame:assembleRelease --quiet + # echo "Compile Android Debug Done!" compile_android: + strategy: + fail-fast: false + matrix: + arch: [arm64-v8a, armeabi-v7a, x86, x86_64] + ndk: [r22b, r23c, r24, r25c] name: "Android" if: (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) @@ -143,7 +148,7 @@ jobs: - uses: nttld/setup-ndk@v1 id: setup-ndk with: - ndk-version: r23c + ndk-version: ${{ matrix.ndk }} add-to-path: false local-cache: true - uses: actions/setup-java@v3 @@ -151,7 +156,7 @@ jobs: with: distribution: 'zulu' java-version: '17' - - name: Compile + - name: Compile ${{ matrix.arch }}-${{ matrix.ndk }} env: COCOS_ENGINE_DEV: 1 run: | @@ -196,319 +201,319 @@ jobs: # To speedup CI, compile arm64-v8a only # sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86@g" gradle.properties df -h - sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=arm64-v8a@g" gradle.properties + sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=${{ matrix.arch }}@g" gradle.properties echo "Compile Android - cmake ..." echo "ANDROID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" - ./gradlew :CocosGame:assembleDebug --quiet - df -h - ./gradlew clean - sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a@g" gradle.properties - ./gradlew :CocosGame:assembleDebug --quiet + ./gradlew :CocosGame:assembleDebug df -h + # ./gradlew clean + # sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a@g" gradle.properties + # ./gradlew :CocosGame:assembleDebug --quiet + # df -h echo "Compile Android Debug Done!" - compile_openharmony: - name: "Openharmony" - if: - (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Download external libraries - shell: bash - run: | - EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` - git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external - - uses: actions/setup-java@v3 - id: setup-jdk - with: - distribution: 'zulu' - java-version: '17' - - name: Get oh sdk cache directory path - id: oh-sdk-cache-dir-path - run: | - echo "cache dir: " - echo "dir=$HOME/openharmony" >> $GITHUB_OUTPUT - - - name: Output cache dir - run: | - echo "Output cache dir: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}" - - - name: Cache OH SDK - id: cache-oh-sdk - uses: actions/cache@v3 - env: - cache-name: cache-oh-sdk-9 - with: - path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-build-${{ env.cache-name }} - - - name: Add package.json - run: | - echo "{}" > package.json - echo "{\"name\": \"tests\",\"lockfileVersion\": 3,\"requires\": true,\"packages\": {}}" > package-lock.json - - uses: actions/setup-node@v3 - with: - node-version: 14 - cache: 'npm' - - - if: ${{ steps.cache-oh-sdk.outputs.cache-hit != 'true' }} - name: No Cache found, install oh sdk - continue-on-error: false - run: | - if [ ! -d "$HOME/openharmony" ]; then - mkdir -p $HOME/openharmony - echo "Download commandline-tools-linux.zip ..." - curl -o commandline-tools-linux.zip "https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b1/v3/E6zhv5UFQ2-inIwNJhTN6Q/commandline-tools-linux-2.0.0.2.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074401Z&HW-CC-Expire=315360000&HW-CC-Sign=621224257B02079B1E76C0A56FDF21483400B1E3556213F88DC79BC9BE7D595D" - echo "Unzip commandline-tools-linux.zip ..." - unzip commandline-tools-linux.zip -d $HOME/openharmony > /dev/null - cd $HOME/openharmony - ls -l - cd command-line-tools - echo "=============== PATCHING sdkmanager/bin/sdkmgr file ===============" - sed -i "s@-Dfile.encoding=UTF-8@-Dfile.encoding=UTF-8 -Duser.country=CN@g" ./sdkmanager/bin/sdkmgr - cd bin - ./sdkmgr list - echo "=============== INSTALL HOS toolchains:9 ===============" - ./sdkmgr install toolchains:9 --accept-license > /dev/null - echo "=============== INSTALL OH SDK ets:9 ===============" - ./sdkmgr install OpenHarmony/ets:9 --accept-license > /dev/null - echo "=============== INSTALL OH SDK js:9 ===============" - ./sdkmgr install OpenHarmony/js:9 --accept-license > /dev/null - echo "=============== INSTALL OH SDK native:9 ===============" - ./sdkmgr install OpenHarmony/native:9 --accept-license > /dev/null - echo "=============== INSTALL OH SDK toolchains:9 ===============" - ./sdkmgr install OpenHarmony/toolchains:9 --accept-license > /dev/null - echo "=============== INSTALL OH SDK DONE ===============" - ./sdkmgr list - fi - - - name: Compile for Openharmony - run: | - which node - which npm - which java - node -v - npm -v - java --version - echo "=============== list files in oh sdk ($HOME/openharmony) ===============" - pushd $HOME/openharmony - ls -l - popd - - NATIVE_ROOT=$GITHUB_WORKSPACE/native - echo "Compiling Openharmony ... " - - cd $GITHUB_WORKSPACE/templates/openharmony - - echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake - echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake - - mkdir -p build-oh/proj - touch build-oh/proj/cfg.cmake - echo "set(CC_USE_GLES3 ON)" >> build-oh/proj/cfg.cmake - echo "set(CC_USE_VULKAN OFF)" >> build-oh/proj/cfg.cmake - echo "set(CC_USE_GLES2 ON)" >> build-oh/proj/cfg.cmake - echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-oh/proj/cfg.cmake - echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-oh/proj/cfg.cmake - echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-oh/proj/cfg.cmake - echo "set(CC_EXECUTABLE_NAME \"\")" >> build-oh/proj/cfg.cmake - echo "set(USE_SE_V8 OFF)" >> build-oh/proj/cfg.cmake - echo "set(USE_SE_NAPI ON)" >> build-oh/proj/cfg.cmake - - echo "=============== cat build-oh/proj/cfg.cmake ===============" - cat build-oh/proj/cfg.cmake - - mkdir -p build-oh/assets - - ASSET_DIR=$GITHUB_WORKSPACE/templates/openharmony/build-oh - - echo "=============== HACK ./entry/build-profile.json5 ===============" - sed -i "s@[^-]DRES_DIR[^=]@$ASSET_DIR@g" ./entry/build-profile.json5 - sed -i "s@[^-]DCOMMON_DIR[^=]@$GITHUB_WORKSPACE/templates/common@g" ./entry/build-profile.json5 - # To speedup CI, compile arm64-v8a only - sed -i "s@\"armeabi-v7a\",@@g" ./entry/build-profile.json5 - - echo "entry/build-profile.json5: " - cat ./entry/build-profile.json5 - - echo "=============== HACK ./hvigor/hvigor-wrapper.js ===============" - sed -i "s@HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,\[\"install\"\]@HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,\[\"install\", \"--lockfile=false\"\]@g" ./hvigor/hvigor-wrapper.js - - echo "=============== SET NPM OH REGISTRY ===============" - echo "@ohos:registry=https://repo.harmonyos.com/npm/" >> ~/.npmrc - npm config get @ohos:registry - npm config get registry - - echo "=============== UPDATE local.properties ===============" - echo "nodejs.dir=/usr/bin" >> local.properties - echo "hwsdk.dir=$HOME/openharmony/hwsdk" >> local.properties - - echo "=============== UPDATE ./hvigor/hvigor-config.json5 ===============" - echo "{\"hvigorVersion\":\"3.0.2\",\"dependencies\":{\"@ohos/hvigor-ohos-plugin\":\"3.0.2\"}}" > ./hvigor/hvigor-config.json5 - - echo "=============== Do not import game.ts for cocos_worker.ts ===============" - sed -i '/<% if(!useV8) { %>/,/<% } %>/d' ./entry/src/main/ets/workers/cocos_worker.ts - - echo "=============== EXECUTE hvigorw ===============" - ./hvigorw clean -i - ./hvigorw --stop-daemon -i - ./hvigorw assembleHap -p debuggable=true --no-daemon -d - #./hvigorw default@ProcessLibs -p debuggable=true --no-daemon -d - echo "=============== EXECUTE hvigorw DONE ===============" - - - compile_mac_x86_64: - name: "MacOS x86_64" - if: - (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Download external libraries - shell: bash - run: | - EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` - git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external - - - name: Compile - env: - COCOS_ENGINE_DEV: 1 - run: | - NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` - NATIVE_ROOT=$GITHUB_WORKSPACE/native - echo "Compiling MacOSX ... " - cd $GITHUB_WORKSPACE/templates/mac - echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake - echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake - mkdir -p build-mac/proj - touch build-mac/proj/cfg.cmake - echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake - echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake - echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake - echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake - echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake - echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake - echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake - mkdir build-mac/assets - - RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac - cd build-mac - cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT - set +e - cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch x86_64 - retcode=$? - set -e - if [ $retcode -ne 0 ]; then - echo "-----------------------------------------------------------------------------------------------" - echo "------------------------------------ recompile without `-quiet` -------------------------------" - echo "-----------------------------------------------------------------------------------------------" - cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch x86_64 - fi - echo "Compile MacOSX x86_64 Release Done!" - - compile_mac_arm64: - name: "MacOS arm64" - if: - (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Download external libraries - shell: bash - run: | - EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` - git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external - - name: Compile - env: - COCOS_ENGINE_DEV: 1 - run: | - NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` - NATIVE_ROOT=$GITHUB_WORKSPACE/native - echo "Compiling MacOSX ... " - cd $GITHUB_WORKSPACE/templates/mac - mkdir -p build-mac/proj - touch build-mac/proj/cfg.cmake - echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake - echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake - echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake - echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake - echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake - echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake - echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake - mkdir build-mac/assets - - RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac - cd build-mac - cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT - set +e - cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch arm64 - retcode=$? - set -e - if [ $retcode -ne 0 ]; then - echo "-----------------------------------------------------------------------------------------------" - echo "------------------------------------ recompile without `-quiet` -------------------------------" - echo "-----------------------------------------------------------------------------------------------" - cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch arm64 - fi - echo "Compile MacOSX ARM64 Release Done!" - - compile_iOS: - name: "iOS" - if: - (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) - runs-on: macos-11 - steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 12.4 - - uses: actions/checkout@v2 - - name: Download external libraries - shell: bash - run: | - EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` - git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external - - name: Compile - env: - COCOS_ENGINE_DEV: 1 - run: | - set -x - NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` - NATIVE_ROOT=$GITHUB_WORKSPACE/native - echo "Compiling iOS ... " - cd $GITHUB_WORKSPACE/templates/ios - echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake - echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake - mkdir -p build-ios/proj - touch build-ios/proj/cfg.cmake - echo "set(CC_USE_GLES3 OFF)" >> build-ios/proj/cfg.cmake - echo "set(CC_USE_VULKAN OFF)" >> build-ios/proj/cfg.cmake - echo "set(CC_USE_GLES2 OFF)" >> build-ios/proj/cfg.cmake - echo "set(CC_USE_METAL ON)" >> build-ios/proj/cfg.cmake - echo "set(TARGET_IOS_VERSION 11.0)" >> build-ios/proj/cfg.cmake - echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-ios/proj/cfg.cmake - echo "set(USE_DRAGONBONES OFF)" >> build-ios/proj/cfg.cmake - echo "set(CMAKE_CXX_STANDARD_REQUIRED OFF)" >> build-ios/proj/cfg.cmake - echo "set(MACOSX_BUNDLE_GUI_IDENTIFIER com.cocos.demo.ios)" >> build-ios/proj/cfg.cmake - echo "set(CC_EXECUTABLE_NAME \"\")" >> build-ios/proj/cfg.cmake - mkdir build-ios/assets - cd build-ios - RES_DIR=$GITHUB_WORKSPACE/templates/ios/build-ios - cmake ../ -GXcode -DCMAKE_SYSTEM_NAME=iOS \ - -DCMAKE_OSX_SYSROOT=iphoneos \ - -DCMAKE_OSX_ARCHITECTURES=arm64 \ - -DRES_DIR=$RES_DIR \ - -DCOCOS_X_PATH=$NATIVE_ROOT - set +e - #cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES -allowProvisioningUpdates CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - retcode=$? - set -e - if [ $retcode -ne 0 ]; then - echo "-----------------------------------------------------------------------------------------------" - echo "------------------------------------ recompile without `-quiet` -------------------------------" - echo "-----------------------------------------------------------------------------------------------" - cmake --build . --config Debug -- -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - fi - echo "Compile iOS Done!" + # compile_openharmony: + # name: "Openharmony" + # if: + # (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Download external libraries + # shell: bash + # run: | + # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` + # git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external + # - uses: actions/setup-java@v3 + # id: setup-jdk + # with: + # distribution: 'zulu' + # java-version: '17' + # - name: Get oh sdk cache directory path + # id: oh-sdk-cache-dir-path + # run: | + # echo "cache dir: " + # echo "dir=$HOME/openharmony" >> $GITHUB_OUTPUT + + # - name: Output cache dir + # run: | + # echo "Output cache dir: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}" + + # - name: Cache OH SDK + # id: cache-oh-sdk + # uses: actions/cache@v3 + # env: + # cache-name: cache-oh-sdk-9 + # with: + # path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }} + # key: ${{ runner.os }}-build-${{ env.cache-name }} + + # - name: Add package.json + # run: | + # echo "{}" > package.json + # echo "{\"name\": \"tests\",\"lockfileVersion\": 3,\"requires\": true,\"packages\": {}}" > package-lock.json + # - uses: actions/setup-node@v3 + # with: + # node-version: 14 + # cache: 'npm' + + # - if: ${{ steps.cache-oh-sdk.outputs.cache-hit != 'true' }} + # name: No Cache found, install oh sdk + # continue-on-error: false + # run: | + # if [ ! -d "$HOME/openharmony" ]; then + # mkdir -p $HOME/openharmony + # echo "Download commandline-tools-linux.zip ..." + # curl -o commandline-tools-linux.zip "https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b1/v3/E6zhv5UFQ2-inIwNJhTN6Q/commandline-tools-linux-2.0.0.2.zip?HW-CC-KV=V1&HW-CC-Date=20230621T074401Z&HW-CC-Expire=315360000&HW-CC-Sign=621224257B02079B1E76C0A56FDF21483400B1E3556213F88DC79BC9BE7D595D" + # echo "Unzip commandline-tools-linux.zip ..." + # unzip commandline-tools-linux.zip -d $HOME/openharmony > /dev/null + # cd $HOME/openharmony + # ls -l + # cd command-line-tools + # echo "=============== PATCHING sdkmanager/bin/sdkmgr file ===============" + # sed -i "s@-Dfile.encoding=UTF-8@-Dfile.encoding=UTF-8 -Duser.country=CN@g" ./sdkmanager/bin/sdkmgr + # cd bin + # ./sdkmgr list + # echo "=============== INSTALL HOS toolchains:9 ===============" + # ./sdkmgr install toolchains:9 --accept-license > /dev/null + # echo "=============== INSTALL OH SDK ets:9 ===============" + # ./sdkmgr install OpenHarmony/ets:9 --accept-license > /dev/null + # echo "=============== INSTALL OH SDK js:9 ===============" + # ./sdkmgr install OpenHarmony/js:9 --accept-license > /dev/null + # echo "=============== INSTALL OH SDK native:9 ===============" + # ./sdkmgr install OpenHarmony/native:9 --accept-license > /dev/null + # echo "=============== INSTALL OH SDK toolchains:9 ===============" + # ./sdkmgr install OpenHarmony/toolchains:9 --accept-license > /dev/null + # echo "=============== INSTALL OH SDK DONE ===============" + # ./sdkmgr list + # fi + + # - name: Compile for Openharmony + # run: | + # which node + # which npm + # which java + # node -v + # npm -v + # java --version + # echo "=============== list files in oh sdk ($HOME/openharmony) ===============" + # pushd $HOME/openharmony + # ls -l + # popd + + # NATIVE_ROOT=$GITHUB_WORKSPACE/native + # echo "Compiling Openharmony ... " + + # cd $GITHUB_WORKSPACE/templates/openharmony + + # echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake + # echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake + + # mkdir -p build-oh/proj + # touch build-oh/proj/cfg.cmake + # echo "set(CC_USE_GLES3 ON)" >> build-oh/proj/cfg.cmake + # echo "set(CC_USE_VULKAN OFF)" >> build-oh/proj/cfg.cmake + # echo "set(CC_USE_GLES2 ON)" >> build-oh/proj/cfg.cmake + # echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-oh/proj/cfg.cmake + # echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-oh/proj/cfg.cmake + # echo "set(COCOS_X_PATH $NATIVE_ROOT)" >> build-oh/proj/cfg.cmake + # echo "set(CC_EXECUTABLE_NAME \"\")" >> build-oh/proj/cfg.cmake + # echo "set(USE_SE_V8 OFF)" >> build-oh/proj/cfg.cmake + # echo "set(USE_SE_NAPI ON)" >> build-oh/proj/cfg.cmake + + # echo "=============== cat build-oh/proj/cfg.cmake ===============" + # cat build-oh/proj/cfg.cmake + + # mkdir -p build-oh/assets + + # ASSET_DIR=$GITHUB_WORKSPACE/templates/openharmony/build-oh + + # echo "=============== HACK ./entry/build-profile.json5 ===============" + # sed -i "s@[^-]DRES_DIR[^=]@$ASSET_DIR@g" ./entry/build-profile.json5 + # sed -i "s@[^-]DCOMMON_DIR[^=]@$GITHUB_WORKSPACE/templates/common@g" ./entry/build-profile.json5 + # # To speedup CI, compile arm64-v8a only + # sed -i "s@\"armeabi-v7a\",@@g" ./entry/build-profile.json5 + + # echo "entry/build-profile.json5: " + # cat ./entry/build-profile.json5 + + # echo "=============== HACK ./hvigor/hvigor-wrapper.js ===============" + # sed -i "s@HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,\[\"install\"\]@HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,\[\"install\", \"--lockfile=false\"\]@g" ./hvigor/hvigor-wrapper.js + + # echo "=============== SET NPM OH REGISTRY ===============" + # echo "@ohos:registry=https://repo.harmonyos.com/npm/" >> ~/.npmrc + # npm config get @ohos:registry + # npm config get registry + + # echo "=============== UPDATE local.properties ===============" + # echo "nodejs.dir=/usr/bin" >> local.properties + # echo "hwsdk.dir=$HOME/openharmony/hwsdk" >> local.properties + + # echo "=============== UPDATE ./hvigor/hvigor-config.json5 ===============" + # echo "{\"hvigorVersion\":\"3.0.2\",\"dependencies\":{\"@ohos/hvigor-ohos-plugin\":\"3.0.2\"}}" > ./hvigor/hvigor-config.json5 + + # echo "=============== Do not import game.ts for cocos_worker.ts ===============" + # sed -i '/<% if(!useV8) { %>/,/<% } %>/d' ./entry/src/main/ets/workers/cocos_worker.ts + + # echo "=============== EXECUTE hvigorw ===============" + # ./hvigorw clean -i + # ./hvigorw --stop-daemon -i + # ./hvigorw assembleHap -p debuggable=true --no-daemon -d + # #./hvigorw default@ProcessLibs -p debuggable=true --no-daemon -d + # echo "=============== EXECUTE hvigorw DONE ===============" + + + # compile_mac_x86_64: + # name: "MacOS x86_64" + # if: + # (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) + # runs-on: macos-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Download external libraries + # shell: bash + # run: | + # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` + # git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external + + # - name: Compile + # env: + # COCOS_ENGINE_DEV: 1 + # run: | + # NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` + # NATIVE_ROOT=$GITHUB_WORKSPACE/native + # echo "Compiling MacOSX ... " + # cd $GITHUB_WORKSPACE/templates/mac + # echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake + # echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake + # mkdir -p build-mac/proj + # touch build-mac/proj/cfg.cmake + # echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake + # echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake + # echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake + # mkdir build-mac/assets + + # RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac + # cd build-mac + # cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT + # set +e + # cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch x86_64 + # retcode=$? + # set -e + # if [ $retcode -ne 0 ]; then + # echo "-----------------------------------------------------------------------------------------------" + # echo "------------------------------------ recompile without `-quiet` -------------------------------" + # echo "-----------------------------------------------------------------------------------------------" + # cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch x86_64 + # fi + # echo "Compile MacOSX x86_64 Release Done!" + + # compile_mac_arm64: + # name: "MacOS arm64" + # if: + # (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) + # runs-on: macos-latest + # steps: + # - uses: actions/checkout@v2 + # - name: Download external libraries + # shell: bash + # run: | + # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` + # git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external + # - name: Compile + # env: + # COCOS_ENGINE_DEV: 1 + # run: | + # NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` + # NATIVE_ROOT=$GITHUB_WORKSPACE/native + # echo "Compiling MacOSX ... " + # cd $GITHUB_WORKSPACE/templates/mac + # mkdir -p build-mac/proj + # touch build-mac/proj/cfg.cmake + # echo "set(CC_USE_VULKAN OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CC_USE_GLES2 OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CC_USE_GLES3 OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CC_USE_METAL ON)" >> build-mac/proj/cfg.cmake + # echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-mac/proj/cfg.cmake + # echo "set(CMAKE_CXX_STANDARD_REQUIRED ON)" >> build-mac/proj/cfg.cmake + # echo "set(CC_EXECUTABLE_NAME \"\")" >> build-mac/proj/cfg.cmake + # mkdir build-mac/assets + + # RES_DIR=$GITHUB_WORKSPACE/templates/mac/build-mac + # cd build-mac + # cmake ../ -GXcode -DCMAKE_OSX_ARCHITECTURES=arm64 -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$NATIVE_ROOT + # set +e + # cmake --build . --config Release -- -quiet -jobs $NUM_OF_CORES -arch arm64 + # retcode=$? + # set -e + # if [ $retcode -ne 0 ]; then + # echo "-----------------------------------------------------------------------------------------------" + # echo "------------------------------------ recompile without `-quiet` -------------------------------" + # echo "-----------------------------------------------------------------------------------------------" + # cmake --build . --config Release -- -jobs $NUM_OF_CORES -arch arm64 + # fi + # echo "Compile MacOSX ARM64 Release Done!" + + # compile_iOS: + # name: "iOS" + # if: + # (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) + # runs-on: macos-11 + # steps: + # - uses: maxim-lobanov/setup-xcode@v1 + # with: + # xcode-version: 12.4 + # - uses: actions/checkout@v2 + # - name: Download external libraries + # shell: bash + # run: | + # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` + # git clone --branch $EXT_VERSION --depth 1 https://github.com/dumganhar/cocos-engine-external native/external + # - name: Compile + # env: + # COCOS_ENGINE_DEV: 1 + # run: | + # set -x + # NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` + # NATIVE_ROOT=$GITHUB_WORKSPACE/native + # echo "Compiling iOS ... " + # cd $GITHUB_WORKSPACE/templates/ios + # echo "message(STATUS \"hook before \${CC_TARGET_NAME}\")" >> Pre-Sample.cmake + # echo "message(STATUS \"hook after \${CC_TARGET_NAME}\")" >> Post-Sample.cmake + # mkdir -p build-ios/proj + # touch build-ios/proj/cfg.cmake + # echo "set(CC_USE_GLES3 OFF)" >> build-ios/proj/cfg.cmake + # echo "set(CC_USE_VULKAN OFF)" >> build-ios/proj/cfg.cmake + # echo "set(CC_USE_GLES2 OFF)" >> build-ios/proj/cfg.cmake + # echo "set(CC_USE_METAL ON)" >> build-ios/proj/cfg.cmake + # echo "set(TARGET_IOS_VERSION 11.0)" >> build-ios/proj/cfg.cmake + # echo "set(USE_WEBSOCKET_SERVER OFF)" >> build-ios/proj/cfg.cmake + # echo "set(USE_DRAGONBONES OFF)" >> build-ios/proj/cfg.cmake + # echo "set(CMAKE_CXX_STANDARD_REQUIRED OFF)" >> build-ios/proj/cfg.cmake + # echo "set(MACOSX_BUNDLE_GUI_IDENTIFIER com.cocos.demo.ios)" >> build-ios/proj/cfg.cmake + # echo "set(CC_EXECUTABLE_NAME \"\")" >> build-ios/proj/cfg.cmake + # mkdir build-ios/assets + # cd build-ios + # RES_DIR=$GITHUB_WORKSPACE/templates/ios/build-ios + # cmake ../ -GXcode -DCMAKE_SYSTEM_NAME=iOS \ + # -DCMAKE_OSX_SYSROOT=iphoneos \ + # -DCMAKE_OSX_ARCHITECTURES=arm64 \ + # -DRES_DIR=$RES_DIR \ + # -DCOCOS_X_PATH=$NATIVE_ROOT + # set +e + # #cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES -allowProvisioningUpdates CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO + # cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO + # retcode=$? + # set -e + # if [ $retcode -ne 0 ]; then + # echo "-----------------------------------------------------------------------------------------------" + # echo "------------------------------------ recompile without `-quiet` -------------------------------" + # echo "-----------------------------------------------------------------------------------------------" + # cmake --build . --config Debug -- -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO + # fi + # echo "Compile iOS Done!"