Updated on 2025-08-06 GMT+08:00

Building with HarmonyOS

Build, test, and deploy a project with Hvigor.

Constraints

You are advised to use executors with 4 vCPUs and 16 GB memory (at least 8 GB) or higher for Hvigor builds.

Build on GUI

Add Build with HarmonyOS, when configuring build actions. Set the parameters according to Table 1.

Table 1 Parameters for building with HarmonyOS

Parameter

Description

Action Name

Assign a custom name to the build action. The name can contain:

  • Letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), and parentheses.
  • 1 to 128 characters.

Tool Version

The default version is HarmonyOS-5.0.0-API12. Currently, HarmonyOS-5.0.0-API12 and HarmonyOS-API9 are supported.

Commands

Configure commands, or use the default ones. If you have special build requirements, enter your custom build script in the text box.

Continue After Failure

Specify whether to proceed after the current action fails by setting the parameter to either Yes or No.

Build with Code

Modify the code in the BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - harmonyos:
        name: "HarmonyOS Build"
        inputs:
            command: |
                npm config set strict-ssl false
                npm config set registry=https://repo.huaweicloud.com/repository/npm/
                npm config set @ohos:registry=https://repo.harmonyos.com/npm/
                chmod +x hvigorw
                ./hvigorw clean assembleApp --no-daemon
           ignore_fail: true
Table 2 Parameters in the sample code

Parameter

Type

Description

command

String

Configure the HarmonyOS commands.

ignore_fail

String

Whether to proceed after the current action fails.
  • true: Yes
  • Empty: No