Repository navigation
fix: use usize for HarmonyOS click count #16
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: "6.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 | |
| env: | |
| OHOS_SDK_VERSION: ${{ inputs.ohos_sdk_version || '6.0' }} | |
| COMMANDLINE_TOOLS_VERSION: ${{ inputs.commandline_tools_version || '5.1.0.840' }} | |
| HVIGOR_VERSION: ${{ inputs.hvigor_version || '6.26.1' }} | |
| 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: Restore HarmonyOS runner toolchain cache | |
| id: harmonyos-toolchain-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/ohos-sdk/ | |
| ~/deveco-commandline-tools/ | |
| ~/.npm/ | |
| ~/.npm-global/ | |
| key: harmonyos-toolchain-${{ runner.os }}-${{ env.OHOS_SDK_VERSION }}-${{ env.COMMANDLINE_TOOLS_VERSION }}-${{ env.HVIGOR_VERSION }} | |
| - name: Setup HarmonyOS runner toolchain | |
| id: setup-harmonyos-runner-toolchain | |
| run: | | |
| script/setup-harmonyos-runner.sh | |
| - name: Restore HarmonyOS Cargo build cache | |
| id: harmonyos-cargo-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ohos/native/target/ | |
| key: harmonyos-cargo-${{ runner.os }}-${{ env.OHOS_SDK_VERSION }}-${{ hashFiles('ohos/native/Cargo.lock', 'ohos/native/Cargo.toml') }}-${{ github.run_id }} | |
| restore-keys: | | |
| harmonyos-cargo-${{ runner.os }}-${{ env.OHOS_SDK_VERSION }}-${{ hashFiles('ohos/native/Cargo.lock', 'ohos/native/Cargo.toml') }}- | |
| harmonyos-cargo-${{ runner.os }}-${{ env.OHOS_SDK_VERSION }}- | |
| - name: Restore HarmonyOS ohpm dependency cache | |
| id: harmonyos-ohpm-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ohos/oh_modules/ | |
| key: harmonyos-ohpm-${{ runner.os }}-${{ hashFiles('ohos/oh-package.json5', 'ohos/oh-package-lock.json5', 'ohos/entry/oh-package.json5', 'ohos/entry/oh-package-lock.json5') }} | |
| - 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: Prepare HarmonyOS signing files | |
| env: | |
| OHOS_SIGNING_STORE_FILE_BASE64: ${{ secrets.OHOS_SIGNING_STORE_FILE_BASE64 }} | |
| OHOS_SIGNING_CERT_BASE64: ${{ secrets.OHOS_SIGNING_CERT_BASE64 }} | |
| OHOS_SIGNING_PROFILE_BASE64: ${{ secrets.OHOS_SIGNING_PROFILE_BASE64 }} | |
| OHOS_SIGNING_STORE_PASSWORD: ${{ secrets.OHOS_SIGNING_STORE_PASSWORD }} | |
| OHOS_SIGNING_KEY_ALIAS: ${{ secrets.OHOS_SIGNING_KEY_ALIAS }} | |
| OHOS_SIGNING_KEY_PASSWORD: ${{ secrets.OHOS_SIGNING_KEY_PASSWORD }} | |
| OHOS_SIGNING_ALG: ${{ secrets.OHOS_SIGNING_ALG }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${OHOS_SIGNING_STORE_FILE_BASE64}${OHOS_SIGNING_CERT_BASE64}${OHOS_SIGNING_PROFILE_BASE64}${OHOS_SIGNING_STORE_PASSWORD}${OHOS_SIGNING_KEY_ALIAS}${OHOS_SIGNING_KEY_PASSWORD}" ]; then | |
| echo "HarmonyOS signing secrets are not configured; building unsigned HAP." | |
| exit 0 | |
| fi | |
| missing=() | |
| [ -n "${OHOS_SIGNING_STORE_FILE_BASE64}" ] || missing+=("OHOS_SIGNING_STORE_FILE_BASE64") | |
| [ -n "${OHOS_SIGNING_CERT_BASE64}" ] || missing+=("OHOS_SIGNING_CERT_BASE64") | |
| [ -n "${OHOS_SIGNING_PROFILE_BASE64}" ] || missing+=("OHOS_SIGNING_PROFILE_BASE64") | |
| [ -n "${OHOS_SIGNING_STORE_PASSWORD}" ] || missing+=("OHOS_SIGNING_STORE_PASSWORD") | |
| [ -n "${OHOS_SIGNING_KEY_ALIAS}" ] || missing+=("OHOS_SIGNING_KEY_ALIAS") | |
| [ -n "${OHOS_SIGNING_KEY_PASSWORD}" ] || missing+=("OHOS_SIGNING_KEY_PASSWORD") | |
| if [ "${#missing[@]}" -gt 0 ]; then | |
| printf 'Incomplete HarmonyOS signing secrets: %s\n' "${missing[*]}" >&2 | |
| exit 2 | |
| fi | |
| mkdir -p "${RUNNER_TEMP}/harmonyos-signing" | |
| chmod 700 "${RUNNER_TEMP}/harmonyos-signing" | |
| printf '%s' "${OHOS_SIGNING_STORE_FILE_BASE64}" | base64 -d > "${RUNNER_TEMP}/harmonyos-signing/signing.p12" | |
| printf '%s' "${OHOS_SIGNING_CERT_BASE64}" | base64 -d > "${RUNNER_TEMP}/harmonyos-signing/signing.cer" | |
| printf '%s' "${OHOS_SIGNING_PROFILE_BASE64}" | base64 -d > "${RUNNER_TEMP}/harmonyos-signing/signing-profile.p7b" | |
| chmod 600 "${RUNNER_TEMP}/harmonyos-signing/"* | |
| { | |
| echo "OHOS_SIGNING_STORE_FILE=${RUNNER_TEMP}/harmonyos-signing/signing.p12" | |
| echo "OHOS_SIGNING_CERT_PATH=${RUNNER_TEMP}/harmonyos-signing/signing.cer" | |
| echo "OHOS_SIGNING_PROFILE=${RUNNER_TEMP}/harmonyos-signing/signing-profile.p7b" | |
| echo "OHOS_SIGNING_STORE_PASSWORD=${OHOS_SIGNING_STORE_PASSWORD}" | |
| echo "OHOS_SIGNING_KEY_ALIAS=${OHOS_SIGNING_KEY_ALIAS}" | |
| echo "OHOS_SIGNING_KEY_PASSWORD=${OHOS_SIGNING_KEY_PASSWORD}" | |
| if [ -n "${OHOS_SIGNING_ALG}" ]; then | |
| echo "OHOS_SIGNING_ALG=${OHOS_SIGNING_ALG}" | |
| fi | |
| } >> "${GITHUB_ENV}" | |
| - 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 dist -type f \( -name '*.hap' -o -name '*.har' -o -name '*.so' \) | sort || true | |
| 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/.hvigor/outputs/ | |
| 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: | | |
| dist/harmonyos/*.hap | |
| ohos/**/*.hap | |
| - name: Save HarmonyOS Cargo build cache | |
| if: always() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ohos/native/target/ | |
| key: ${{ steps.harmonyos-cargo-cache.outputs.cache-primary-key }} | |
| - name: Save HarmonyOS runner toolchain cache | |
| if: always() && steps.harmonyos-toolchain-cache.outputs.cache-hit != 'true' && steps.setup-harmonyos-runner-toolchain.outcome == 'success' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ~/ohos-sdk/ | |
| ~/deveco-commandline-tools/ | |
| ~/.npm/ | |
| ~/.npm-global/ | |
| key: harmonyos-toolchain-${{ runner.os }}-${{ env.OHOS_SDK_VERSION }}-${{ env.COMMANDLINE_TOOLS_VERSION }}-${{ env.HVIGOR_VERSION }} | |
| - name: Save HarmonyOS ohpm dependency cache | |
| if: always() && steps.harmonyos-ohpm-cache.outputs.cache-hit != 'true' && hashFiles('ohos/oh_modules/.ohpm/lock.json5') != '' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ohos/oh_modules/ | |
| key: harmonyos-ohpm-${{ runner.os }}-${{ hashFiles('ohos/oh-package.json5', 'ohos/oh-package-lock.json5', 'ohos/entry/oh-package.json5', 'ohos/entry/oh-package-lock.json5') }} |