V3.8.1 pipeline #6414
Workflow file for this run
This file contains 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: <Native> Compile | |
on: | |
pull_request: | |
paths: | |
- 'templates/**' | |
- 'native/**' | |
- '.github/workflows/native-compile-platforms.yml' | |
# github.head_ref is only defined on pull_request events | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }} | |
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/cocos/cocos-engine-external native/external | |
- name: Install deps | |
uses: humbletim/[email protected] | |
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/cocos/cocos-engine-external native/external | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r21e | |
add-to-path: false | |
- 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 | |
ANDORID_NDK=$ANDROID_NDK_LATEST_HOME | |
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 | |
<resources> | |
<string name="app_name" translatable="false">CocosGame</string> | |
</resources> | |
EOF | |
mkdir -p build-android/assets | |
ASSET_DIR=$GITHUB_WORKSPACE/templates/android/build/build-android/ | |
sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDORID_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 | |
echo "Compile Android - cmake ..." | |
echo "ANDORID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" | |
# ./gradlew :CocosGame:assembleDebug --quiet | |
./gradlew :CocosGame:assembleRelease --quiet | |
echo "Compile Android Debug Done!" | |
compile_android: | |
name: "Android" | |
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/cocos/cocos-engine-external native/external | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r21e | |
add-to-path: false | |
- 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 | |
ANDORID_NDK=$ANDROID_NDK_LATEST_HOME | |
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(CC_USE_GLES3 ON)" >> build-android/proj/cfg.cmake | |
echo "set(CC_USE_VULKAN ON)" >> build-android/proj/cfg.cmake | |
echo "set(CC_USE_GLES2 ON)" >> build-android/proj/cfg.cmake | |
echo "set(USE_WEBSOCKET_SERVER ON)" >> build-android/proj/cfg.cmake | |
echo "set(CMAKE_CXX_STANDARD_REQUIRED 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 | |
<resources> | |
<string name="app_name" translatable="false">CocosGame</string> | |
</resources> | |
EOF | |
mkdir -p build-android/assets | |
ASSET_DIR=$GITHUB_WORKSPACE/templates/android/build/build-android/ | |
sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDORID_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=armeabi-v7a:arm64-v8a@g" gradle.properties | |
echo "Compile Android - cmake ..." | |
echo "ANDORID_NDK ${ANDROID_NDK} or ${ANDROID_NDK_HOME}" | |
./gradlew :CocosGame:assembleDebug --quiet | |
echo "Compile Android Debug 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/cocos/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/cocos/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/cocos/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_wgpu_mac: | |
name: "Emscripten" | |
runs-on: macos-latest | |
if: contains( github.event.pull_request.title, 'WGPU_CI_ON' ) | |
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/cocos/cocos-engine-external native/external | |
- name: Setup Emscripten | |
run: | | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
git clone https://github.com/emscripten-core/emsdk.git NATIVE_ROOT/../../emsdk | |
cd NATIVE_ROOT/../../emsdk | |
./emsdk install 3.1.17 | |
./emsdk activate 3.1.17 | |
source ./emsdk_env.sh | |
emcc -v | |
- name: Compile | |
env: | |
COCOS_ENGINE_DEV: 1 | |
run: | | |
NATIVE_ROOT=$GITHUB_WORKSPACE/native | |
cd $NATIVE_ROOT/cocos/renderer/gfx-wgpu | |
$NATIVE_ROOT/../../emsdk/upstream/emscripten/emcmake cmake . | |
$NATIVE_ROOT/../../emsdk/upstream/emscripten/emmake make | |
echo "Compile WGPU by ems on MacOS Done!" |