Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Build Verification CI Workflow #2

Merged
merged 3 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Verify Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Build and Verify Application
runs-on: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install tree command
run: brew install tree

- name: Setup signing certificates and keystore
# This step extracts the required signing materials from a base64 encoded zip stored in GitHub Secrets
# The zip contains:
# - .cer file: Developer certificate for signing
# - .p7b file: Profile for app provisioning
# - .p12 file: Keystore containing private key
run: |
# Decode base64 secret to zip file
echo "${{ secrets.ONIRO_APP_SIGNATURE_ZIP }}" | base64 -d > secrets.zip

# Extract files while preserving directory structure
unzip -o secrets.zip

# Cleanup temporary zip file
rm secrets.zip

# Display extracted files for verification
echo "=== Extracted Signing Materials ==="
tree .secret -L 4

- name: Modify bundleName in app.json5
run: |
echo "Modifying bundleName in app.json5 to match the one in the signature materials"
echo "this is a temporary workaround for using the same signature materials stored"
echo "in GitHub secrets for multiple apps."
echo "See: https://github.com/eclipse-oniro4openharmony/oniro-planning/issues/5#issuecomment-2538648996"
sed -i '' 's/"bundleName": "[^"]*"/"bundleName": "com.example.oniromathpunching"/' ./AppScope/app.json5

- name: Set up tools and dependencies
uses: eclipse-oniro4openharmony/oh-app-action@main

- name: Verify Installation
run: |
echo "=== Environment Variables ==="
echo "PATH: $PATH"
echo "OHOS_BASE_SDK_HOME: $OHOS_BASE_SDK_HOME"
echo "CMD_PATH: $CMD_PATH"

echo "=== OHPM Installation ==="
which ohpm
ohpm -v

echo "=== Hvigor Installation ==="
which hvigorw
hvigorw --version

echo "=== Installation Directories ==="
echo "Command-line Tools:"
tree -L 3 $CMD_PATH

echo "OpenHarmony SDK:"
tree -L 3 $OHOS_BASE_SDK_HOME

echo "=== Node.js Version ==="
node --version
npm --version

echo "=== NPM Configuration ==="
cat $HOME/.npmrc

- name: Install OpenHarmony Dependencies
run: ohpm install --all

- name: Initialize and Build
run: |
hvigorw --version --accept-license
hvigorw clean --no-parallel --no-daemon
hvigorw assembleHap --mode module -p product=default --stacktrace --no-parallel --no-daemon

- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: HAP packages
path: ./entry/build/default/outputs/default
10 changes: 5 additions & 5 deletions build-profile.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
{
"name": "default",
"material": {
"certpath": "C:/Users/c84381641/.ohos/config/openharmony/default_GuessNumber_B_Qn8V44HXwj1kWhXEL-umMcc38FMloFMKDBR34bgHY=.cer",
"storePassword": "0000001BB99CAAF78A02482768042F74FC27CE26C360282120D17048B0A5A5AC5A569A5138A816CFDA52FF",
"certpath": "./.secret/oniro-ci.cer",
"storePassword": "0000001BD5A16C997F0EF958596A946A060A50ED61DF4D945A74AB3C462CBCFBE5BA90427A3DEAC0D27D3E",
"keyAlias": "debugKey",
"keyPassword": "0000001B40F99276F50ED0FD81057333E98D5978E93A5307E70CA46D064C35F23BF20BCB436C0CD13B2745",
"profile": "C:/Users/c84381641/.ohos/config/openharmony/default_GuessNumber_B_Qn8V44HXwj1kWhXEL-umMcc38FMloFMKDBR34bgHY=.p7b",
"keyPassword": "0000001BACA49D623B16BE8A9C4C216A9ED64244F7255BC9AEF8C862264DDA900496AD36202857353771E8",
"profile": "./.secret/oniro-ci.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "C:/Users/c84381641/.ohos/config/openharmony/default_GuessNumber_B_Qn8V44HXwj1kWhXEL-umMcc38FMloFMKDBR34bgHY=.p12"
"storeFile": "./.secret/oniro-ci.p12"
}
}
],
Expand Down
Loading