Repository navigation
ci: trigger harmonyos test on branch pushes #1
Workflow file for this run
This file contains hidden or 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: HarmonyOS Test | |
| on: | |
| push: | |
| branches: | |
| - harmonyos-adaptation | |
| workflow_dispatch: | |
| inputs: | |
| run_hap_build: | |
| description: "Run the Hvigor HAP build after validating the toolchain" | |
| type: boolean | |
| default: true | |
| ohos_sdk_version: | |
| description: "OpenHarmony SDK version downloaded from repo.huaweicloud.com" | |
| type: string | |
| default: "5.0.0" | |
| commandline_tools_version: | |
| description: "fcitx-contrib/ohpm-cli-tools release version" | |
| type: string | |
| default: "5.1.0.840" | |
| hvigor_version: | |
| description: "HarmonyOS Hvigor npm package version" | |
| type: string | |
| default: "6.26.1" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| package: | |
| name: Runner HAP package test | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 180 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Show runner disk before setup | |
| run: | | |
| df -h | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Setup HarmonyOS runner toolchain | |
| env: | |
| OHOS_SDK_VERSION: ${{ inputs.ohos_sdk_version || '5.0.0' }} | |
| COMMANDLINE_TOOLS_VERSION: ${{ inputs.commandline_tools_version || '5.1.0.840' }} | |
| HVIGOR_VERSION: ${{ inputs.hvigor_version || '6.26.1' }} | |
| run: | | |
| script/setup-harmonyos-runner.sh | |
| - name: Cache HarmonyOS Cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ohos/native/target/ | |
| key: harmonyos-cargo-${{ runner.os }}-${{ inputs.ohos_sdk_version || '5.0.0' }}-${{ hashFiles('ohos/native/Cargo.lock', 'ohos/native/Cargo.toml') }}-${{ github.run_id }} | |
| restore-keys: | | |
| harmonyos-cargo-${{ runner.os }}-${{ inputs.ohos_sdk_version || '5.0.0' }}-${{ hashFiles('ohos/native/Cargo.lock', 'ohos/native/Cargo.toml') }}- | |
| harmonyos-cargo-${{ runner.os }}-${{ inputs.ohos_sdk_version || '5.0.0' }}- | |
| - name: Probe HarmonyOS local toolchain | |
| run: | | |
| rustc --version | |
| cargo --version | |
| node --version | |
| npm --version | |
| ohpm --version | |
| hvigor --version | |
| command -v ohpm | |
| command -v hvigor | |
| echo "OHOS_NDK_HOME=${OHOS_NDK_HOME}" | |
| echo "DEVECO_SDK_HOME=${DEVECO_SDK_HOME}" | |
| find "${OHOS_NDK_HOME}" -maxdepth 2 -type f \( -name oh-uni-package.json -o -name sdk-pkg.json \) | sort | |
| find "${DEVECO_COMMANDLINE_TOOLS_HOME}" -maxdepth 5 -type f \( -name ohpm -o -name hdc \) | sort | |
| - name: Build HarmonyOS HAP | |
| if: ${{ github.event_name != 'workflow_dispatch' || inputs.run_hap_build }} | |
| run: | | |
| script/build-harmonyos.sh --local | |
| - name: List HarmonyOS outputs | |
| if: always() | |
| run: | | |
| find ohos -type f \( -name '*.hap' -o -name '*.har' -o -name '*.so' -o -name '*.json' -o -name '*.json5' \) | sort | |
| find ohos/.hvigor -maxdepth 4 -type f | sort || true | |
| df -h | |
| - name: Upload HarmonyOS diagnostics | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: harmonyos-diagnostics | |
| if-no-files-found: ignore | |
| path: | | |
| ohos/.hvigor/report/ | |
| ohos/.hvigor/cache/ | |
| ohos/entry/build/ | |
| ohos/build/ | |
| ohos/entry/libs/arm64-v8a/libonetcli_harmony.so | |
| - name: Upload HAP package | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: harmonyos-hap | |
| if-no-files-found: ignore | |
| path: | | |
| ohos/**/*.hap |