Skip to content

Commit

Permalink
Add workflow_dispatch for oh sdk & vulkan sdk (#16204)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar authored Sep 7, 2023
1 parent 0b65ab3 commit 2cb1652
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
80 changes: 80 additions & 0 deletions .github/workflows/generate-oh-sdk-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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:
name: "Generate OH SDK cache"
runs-on: ubuntu-latest
steps:
- 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-${{ github.event.inputs.oh_sdk_version }}
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 "[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
fi
22 changes: 22 additions & 0 deletions .github/workflows/generate-vulkan-sdk-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: <Native> Generate Vulkan SDK Cache

on:
workflow_dispatch:
inputs:
vulkan_sdk_version:
description: 'Vulkan SDK version'
type: string
default: '1.2.189.0'
required: true

jobs:
generate_vulkan_sdk_cache:
name: "Generate Vulkan SDK cache"
runs-on: windows-2019
steps:
- name: Setup Vulkan SDK
uses: humbletim/[email protected]
with:
vulkan-query-version: ${{ github.event.inputs.vulkan_sdk_version }}
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true
2 changes: 1 addition & 1 deletion .github/workflows/native-compile-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
id: cache-oh-sdk
uses: actions/cache@v3
env:
cache-name: cache-oh-sdk-2
cache-name: cache-oh-sdk-9
with:
path: ${{ steps.oh-sdk-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}
Expand Down

0 comments on commit 2cb1652

Please sign in to comment.