🏗️ Compile #1123
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: 🏗️ Compile | |
#on: [push, pull_request] | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "* */12 * * *" | |
jobs: | |
compile_windows: | |
runs-on: windows-2019 | |
name: "Windows" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Checkout cocos-engines | |
shell: bash | |
run: | | |
set -x | |
# git clone --branch v3.7-use-bus-event --depth 1 https://github.com/PatriceJiang/engine engine | |
git clone --branch v3.8.0 --depth 1 https://github.com/cocos/cocos-engine engine | |
cd engine | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
cd native | |
rm -rf external | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external external | |
- name: Compile Windows | |
shell: bash | |
run: | | |
set -x | |
ROOT=${GITHUB_WORKSPACE//\\//} | |
COCOS_X_PATH=$ROOT/engine/native | |
NATIVE_DIR=$ROOT/NewProject/native/engine/win64 | |
RES_DIR=$ROOT/NewProject/build/windows | |
sed -i "s@^.*COCOS_X_PATH.*@set(COCOS_X_PATH $COCOS_X_PATH)@g" NewProject/build/windows/proj/cfg.cmake | |
cd $RES_DIR/proj | |
cmake -S $NATIVE_DIR -B . -DRES_DIR=$RES_DIR | |
cmake --build . --config Debug | |
echo "Compile Windows Debug done!" | |
AUTOGEN_SRC=`find . -name plugin_registry_autogen.cpp` | |
if [[ $AUTOGEN_SRC == '' ]]; then | |
echo "plugin_registry_autogen.cpp not found" | |
exit 1 | |
fi | |
compile_android: | |
name: "Android" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Checkout cocos-engines | |
shell: bash | |
run: | | |
set -x | |
# git clone --branch v3.7-use-bus-event --depth 1 https://github.com/PatriceJiang/engine engine | |
git clone --branch v3.8.0 --depth 1 https://github.com/cocos/cocos-engine engine | |
cd engine | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
cd native | |
rm -rf external | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external external | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r21e | |
add-to-path: false | |
- name: set cocos_engine | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
shell: bash | |
run: | | |
set -x | |
COCOS_X_PATH=$GITHUB_WORKSPACE/engine/native | |
NATIVE_DIR=$GITHUB_WORKSPACE/NewProject/native/engine/android | |
KEYSTORE=$GITHUB_WORKSPACE/NewProject/native/engine/android/debug.keystore | |
RES_PATH=$GITHUB_WORKSPACE/NewProject/build/android | |
sed -i "s@^.*COCOS_X_PATH.*@set(COCOS_X_PATH $COCOS_X_PATH)@g" NewProject/build/android/proj/cfg.cmake | |
sed -i "s@^RES_PATH.*@RES_PATH=$RES_PATH@g" NewProject/build/android/proj/gradle.properties | |
sed -i "s@^COCOS_ENGINE_PATH.*@COCOS_ENGINE_PATH=$COCOS_X_PATH@g" NewProject/build/android/proj/gradle.properties | |
sed -i "s@^NATIVE_DIR.*@NATIVE_DIR=$NATIVE_DIR@g" NewProject/build/android/proj/gradle.properties | |
sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDROID_NDK_HOME@g" NewProject/build/android/proj/gradle.properties | |
sed -i "s@^RELEASE_STORE_FILE.*@RELEASE_STORE_FILE=$KEYSTORE@g" NewProject/build/android/proj/gradle.properties | |
sed -i "s@^sdk.dir.*@sdk.dir=$ANDROID_HOME@g" NewProject/build/android/proj/local.properties | |
echo "inspect gradle.properties" | |
cat NewProject/build/android/proj/gradle.properties | |
# install android cmake | |
$ANDROID_HOME/tools/bin/sdkmanager "cmake;3.18.1" | |
- name: Compile | |
shell: bash | |
run: | | |
set -x | |
cd NewProject/build/android/proj | |
chmod +x gradlew | |
./gradlew assembleDebug | |
echo "Compile Android Debug Done!" | |
AUTOGEN_SRC=`find . -name plugin_registry_autogen.cpp` | |
if [[ $AUTOGEN_SRC == '' ]]; then | |
echo "plugin_registry_autogen.cpp not found" | |
exit 1 | |
fi | |
compile_mac: | |
name: "MacOS" | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Checkout cocos-engines | |
shell: bash | |
run: | | |
set -x | |
# git clone --branch v3.7-use-bus-event --depth 1 https://github.com/PatriceJiang/engine engine | |
git clone --branch v3.8.0 --depth 1 https://github.com/cocos/cocos-engine engine | |
cd engine | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
cd native | |
rm -rf external | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external external | |
- name: Compile Mac | |
shell: bash | |
run: | | |
set -x | |
brew install gsed | |
ROOT=${GITHUB_WORKSPACE//\\//} | |
COCOS_X_PATH=$ROOT/engine/native | |
NATIVE_DIR=$ROOT/NewProject/native/engine/mac | |
RES_DIR=$ROOT/NewProject/build/mac | |
gsed -i "s@^.*COCOS_X_PATH.*@set(COCOS_X_PATH $COCOS_X_PATH)@g" NewProject/build/mac/proj/cfg.cmake | |
cd $RES_DIR/proj | |
cmake -S $NATIVE_DIR -B . -DRES_DIR=$RES_DIR -GXcode -DCMAKE_OSX_ARCHITECTURES=x86_64 | |
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` | |
cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES -arch x86_64 | |
echo "Compile Mac Debug done!" | |
AUTOGEN_SRC=`find . -name plugin_registry_autogen.cpp` | |
if [[ $AUTOGEN_SRC == '' ]]; then | |
echo "plugin_registry_autogen.cpp not found" | |
exit 1 | |
fi | |
compile_iOS: | |
name: "iOS" | |
runs-on: macos-latest | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- uses: actions/checkout@v2 | |
- name: Checkout cocos-engines | |
shell: bash | |
run: | | |
set -x | |
# git clone --branch v3.7-use-bus-event --depth 1 https://github.com/PatriceJiang/engine engine | |
git clone --branch v3.8.0 --depth 1 https://github.com/cocos/cocos-engine engine | |
cd engine | |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` | |
cd native | |
rm -rf external | |
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external external | |
- name: Compile iOS | |
shell: bash | |
run: | | |
set -x | |
brew install gsed | |
ROOT=${GITHUB_WORKSPACE//\\//} | |
COCOS_X_PATH=$ROOT/engine/native | |
NATIVE_DIR=$ROOT/NewProject/native/engine/ios | |
RES_DIR=$ROOT/NewProject/build/ios | |
gsed -i "s@^.*COCOS_X_PATH.*@set(COCOS_X_PATH $COCOS_X_PATH)@g" NewProject/build/ios/proj/cfg.cmake | |
cd $RES_DIR/proj | |
cmake -S $NATIVE_DIR -B . -DRES_DIR=$RES_DIR -GXcode \ | |
-DCMAKE_SYSTEM_NAME=iOS \ | |
-DCMAKE_OSX_SYSROOT=iphoneos \ | |
-DCMAKE_OSX_ARCHITECTURES=arm64 | |
NUM_OF_CORES=`getconf _NPROCESSORS_ONLN` | |
cmake --build . --config Debug -- -quiet -jobs $NUM_OF_CORES CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
echo "Compile iOS Debug done!" | |
AUTOGEN_SRC=`find . -name plugin_registry_autogen.cpp` | |
if [[ $AUTOGEN_SRC == '' ]]; then | |
echo "plugin_registry_autogen.cpp not found" | |
exit 1 | |
fi |