Skip to content

Commit

Permalink
[v3.8.5] Update CI for HarmonyOS Next. (#17879)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar authored Nov 19, 2024
1 parent 59e00c9 commit ba73143
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 74 deletions.
36 changes: 6 additions & 30 deletions .github/workflows/generate-oh-sdk-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: <Native> Generate OH SDK Cache

on:
workflow_dispatch:
inputs:
oh_sdk_version:
description: 'Openharmony SDK version'
type: string
default: '9'
required: true

jobs:
generate_oh_sdk_cache:
Expand All @@ -34,15 +28,11 @@ jobs:
id: cache-oh-sdk
uses: actions/cache@v4
env:
cache-name: cache-oh-sdk-${{ github.event.inputs.oh_sdk_version }}
cache-name: cache-oh-sdk-12
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@v4
with:
node-version: 14
Expand All @@ -55,26 +45,12 @@ jobs:
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"
wget -q https://github.com/dumganhar/oh-sdk-for-ci/releases/download/api-12/commandline-tools-linux-x64-5.0.3.906.zip.001
wget -q https://github.com/dumganhar/oh-sdk-for-ci/releases/download/api-12/commandline-tools-linux-x64-5.0.3.906.zip.002
echo "Unzip commandline-tools-linux.zip ..."
unzip commandline-tools-linux.zip -d $HOME/openharmony > /dev/null
7z x commandline-tools-linux-x64-5.0.3.906.zip.001 -o$HOME/openharmony > /dev/null
cd $HOME/openharmony
ls -l
cd command-line-tools
echo "=============== PATCHING sdkmanager/bin/sdkmgr file ==============="
sed -i "[email protected][email protected]=UTF-8 -Duser.country=CN@g" ./sdkmanager/bin/sdkmgr
cd bin
./sdkmgr list
echo "=============== INSTALL HOS toolchains:${{ github.event.inputs.oh_sdk_version }} ==============="
./sdkmgr install toolchains:${{ github.event.inputs.oh_sdk_version }} --accept-license > /dev/null
echo "=============== INSTALL OH SDK ets:${{ github.event.inputs.oh_sdk_version }} ==============="
./sdkmgr install OpenHarmony/ets:${{ github.event.inputs.oh_sdk_version }} --accept-license > /dev/null
echo "=============== INSTALL OH SDK js:${{ github.event.inputs.oh_sdk_version }} ==============="
./sdkmgr install OpenHarmony/js:${{ github.event.inputs.oh_sdk_version }} --accept-license > /dev/null
echo "=============== INSTALL OH SDK native:${{ github.event.inputs.oh_sdk_version }} ==============="
./sdkmgr install OpenHarmony/native:${{ github.event.inputs.oh_sdk_version }} --accept-license > /dev/null
echo "=============== INSTALL OH SDK toolchains:${{ github.event.inputs.oh_sdk_version }} ==============="
./sdkmgr install OpenHarmony/toolchains:${{ github.event.inputs.oh_sdk_version }} --accept-license > /dev/null
echo "=============== INSTALL OH SDK DONE ==============="
./sdkmgr list
cd commandline-tools-linux-x64-5.0.3.906
ls -l
fi
87 changes: 43 additions & 44 deletions .github/workflows/native-compile-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,25 @@ jobs:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: ubuntu-latest
steps:
- name: Before free space
run: |
df -h
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@d5af243ce7bacb67384aa6c5b1fc5f169e30903e
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: After free space
run: |
df -h
- uses: actions/checkout@v4
- name: Download external libraries
shell: bash
Expand All @@ -258,15 +277,15 @@ jobs:
id: cache-oh-sdk
uses: actions/cache@v4
env:
cache-name: cache-oh-sdk-9
cache-name: cache-oh-sdk-12
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
# - name: Add package.json
# run: |
# echo "{}" > package.json
# echo "{\"name\": \"tests\",\"lockfileVersion\": 3,\"requires\": true,\"packages\": {}}" > package-lock.json
- uses: actions/setup-node@v4
with:
node-version: 14
Expand All @@ -279,28 +298,14 @@ jobs:
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"
wget -q https://github.com/dumganhar/oh-sdk-for-ci/releases/download/api-12/commandline-tools-linux-x64-5.0.3.906.zip.001
wget -q https://github.com/dumganhar/oh-sdk-for-ci/releases/download/api-12/commandline-tools-linux-x64-5.0.3.906.zip.002
echo "Unzip commandline-tools-linux.zip ..."
unzip commandline-tools-linux.zip -d $HOME/openharmony > /dev/null
7z x commandline-tools-linux-x64-5.0.3.906.zip.001 -o$HOME/openharmony > /dev/null
cd $HOME/openharmony
ls -l
cd command-line-tools
echo "=============== PATCHING sdkmanager/bin/sdkmgr file ==============="
sed -i "[email protected][email protected]=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
cd commandline-tools-linux-x64-5.0.3.906
ls -l
fi
- name: Compile for Openharmony
Expand All @@ -312,10 +317,13 @@ jobs:
npm -v
java --version
echo "=============== list files in oh sdk ($HOME/openharmony) ==============="
pushd $HOME/openharmony
pushd $HOME/openharmony/commandline-tools-linux-x64-5.0.3.906
ls -l
popd
export PATH=$PATH:$HOME/openharmony/commandline-tools-linux-x64-5.0.3.906/bin
which hvigorw
NATIVE_ROOT=$GITHUB_WORKSPACE/native
echo "Compiling Openharmony ... "
Expand All @@ -333,8 +341,9 @@ jobs:
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 "set(USE_SE_V8 ON)" >> build-oh/proj/cfg.cmake
echo "set(USE_SE_NAPI OFF)" >> build-oh/proj/cfg.cmake
echo "set(USE_SE_JSVM OFF)" >> build-oh/proj/cfg.cmake
echo "=============== cat build-oh/proj/cfg.cmake ==============="
cat build-oh/proj/cfg.cmake
Expand All @@ -352,28 +361,18 @@ jobs:
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 "=============== 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
sed -i '/<% if(useV8) { %>/,/<% } %>/d' ./entry/src/main/ets/workers/cocos_worker.ts
ls -l ./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 clean -i
hvigorw --stop-daemon -i
hvigorw --mode module -p product=default assembleHap --parallel --incremental debuggable=true --no-daemon -d
#./hvigorw default@ProcessLibs -p debuggable=true --no-daemon -d
echo "=============== EXECUTE hvigorw DONE ==============="
Expand Down
2 changes: 2 additions & 0 deletions native/cmake/predefine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ if("$ENV{COCOS_ENGINE_DEV}" EQUAL "1")
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-nullability-completeness -Wno-deprecated-declarations")
elseif(ANDROID)
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-deprecated-builtins")
elseif(OPENHARMONY)
set(WERROR_FLAGS " ${WERROR_FLAGS} -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-unused-command-line-argument -Wno-format")
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
Expand Down

0 comments on commit ba73143

Please sign in to comment.