summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGichan Jang <gichan2.jang@samsung.com>2024-11-12 16:26:19 +0900
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>2024-11-15 16:22:01 +0900
commitdda5e37408fed8f2e009744d4168848e00a1bbe8 (patch)
treec688e45d41dda41be1d3fdc5b3dd28139871a035
parentd139a4ce812c2210bd6324ab99466c9a6ddbfcd2 (diff)
downloadmachine-learning-dda5e37408fed8f2e009744d4168848e00a1bbe8.tar.gz
machine-learning-dda5e37408fed8f2e009744d4168848e00a1bbe8.tar.bz2
machine-learning-dda5e37408fed8f2e009744d4168848e00a1bbe8.zip
[Action] daily build android
- Generate badge and upload the result Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
-rw-r--r--.github/actions/android-build/action.yml9
-rw-r--r--.github/actions/gitpush/action.yml40
-rw-r--r--.github/actions/s3_upload/action.yml34
-rw-r--r--.github/workflows/daily-build-android.yml61
4 files changed, 129 insertions, 15 deletions
diff --git a/.github/actions/android-build/action.yml b/.github/actions/android-build/action.yml
index ea3bc1c..d9ba38b 100644
--- a/.github/actions/android-build/action.yml
+++ b/.github/actions/android-build/action.yml
@@ -6,6 +6,9 @@ inputs:
description: target ABI
required: false
default: arm64-v8a
+outputs:
+ result:
+ value: ${{ steps.ndk-build.outputs.result }}
runs:
using: composite
@@ -45,6 +48,7 @@ runs:
repository: nnstreamer/nnstreamer-android-resource
path: nnstreamer-android-resource
- name: NDK build
+ id: ndk-build
run: |
echo "NDK build, ${{ github.workspace }}"
export GSTREAMER_ROOT_ANDROID=~/android/gst_root_android/
@@ -63,7 +67,10 @@ runs:
result=$?
if [[ ${result} -ne 0 ]]; then
echo "NDK build failed"
- exit 1
+ echo "result=failure" >> $GITHUB_OUTPUT
+ else
+ echo "NDK build success"
+ echo "result=success" >> $GITHUB_OUTPUT
fi
shell: bash
env:
diff --git a/.github/actions/gitpush/action.yml b/.github/actions/gitpush/action.yml
new file mode 100644
index 0000000..fb5c05a
--- /dev/null
+++ b/.github/actions/gitpush/action.yml
@@ -0,0 +1,40 @@
+name: 'Push to github.io'
+description: 'Update the github action result to nnstreamer.github.io'
+inputs:
+ source:
+ description: 'source path of the file or directory to be copied'
+ required: true
+ dest:
+ description: 'destination directory in nnstreamer.github.io repository'
+ required: true
+ message:
+ description: 'commit message'
+ required: false
+ default: 'Update the result from nnstreamer github action.'
+ taos_account:
+ required: true
+ taos_account_token:
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - name: update the result
+ run: |
+ git clone https://${{ inputs.taos_account }}:${{ inputs.taos_account_token }}@github.com/nnstreamer/nnstreamer.github.io.git
+ pushd nnstreamer.github.io
+ mkdir -p ${{ inputs.dest }}
+ cp -r ${{ inputs.source }} ${{ inputs.dest }}
+ git diff > git_diff.txt
+ DIFF_SIZE=$(stat -c%s git_diff.txt)
+ if [[ $DIFF_SIZE -ne 0 ]]; then
+ git config user.email "nnsuite@samsung.com"
+ git config user.name "nnsuite"
+ git add *
+ git commit -s -m "${{ inputs.message }}"
+ git push origin main -f
+ else
+ echo "Nothing to commit. Skip the push operation."
+ fi
+ popd
+ shell: bash
diff --git a/.github/actions/s3_upload/action.yml b/.github/actions/s3_upload/action.yml
new file mode 100644
index 0000000..81d112f
--- /dev/null
+++ b/.github/actions/s3_upload/action.yml
@@ -0,0 +1,34 @@
+name: 'upload to release.nnstreamer.com'
+inputs:
+ source:
+ description: 'source path of the file or directory to be copied'
+ required: true
+ dest:
+ description: 'destination directory in release.nnstreamer.com repository'
+ required: true
+ s3_id:
+ required: true
+ s3_key:
+ required: true
+ s3_option:
+ required: false
+ default: ""
+
+runs:
+ using: "composite"
+ steps:
+ - name: get date
+ id: get-date
+ run: |
+ echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
+ shell: bash
+
+ - name: update the result to s3
+ env:
+ AWS_ACCESS_KEY_ID: ${{ inputs.s3_id }}
+ AWS_SECRET_ACCESS_KEY: ${{ inputs.s3_key }}
+ AWS_EC2_METADATA_DISABLED: true
+ run: |
+ aws s3 cp --region ap-northeast-2 ${{ inputs.source }} s3://nnstreamer-release/nnstreamer/${{ steps.get-date.outputs.date }}/${{ inputs.dest }} ${{ inputs.s3_option }}
+ aws s3 cp --region ap-northeast-2 ${{ inputs.source }} s3://nnstreamer-release/nnstreamer/latest/${{ inputs.dest }} ${{ inputs.s3_option }}
+ shell: bash
diff --git a/.github/workflows/daily-build-android.yml b/.github/workflows/daily-build-android.yml
index 439a526..139a97f 100644
--- a/.github/workflows/daily-build-android.yml
+++ b/.github/workflows/daily-build-android.yml
@@ -10,29 +10,62 @@ on:
jobs:
build:
runs-on: ubuntu-22.04
- env:
- AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
- AWS_EC2_METADATA_DISABLED: true
steps:
- uses: actions/checkout@v4
- - name: Prepare Android build
+
+ - name: build
+ id: android-build
uses: ./.github/actions/android-build
+ continue-on-error: true
+
- name: get date
id: get-date
run: |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
+
- name: Release daily build result
+ if: steps.android-build.outputs.result == 'success'
+ uses: ./.github/actions/s3_upload
+ with:
+ source: ${{ github.workspace }}/android_lib/
+ dest: android/
+ s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
+ s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
+ s3_option: --recursive
+
+ - name: Generate badge
run: |
- aws s3 cp --recursive --region ap-northeast-2 ${{ github.workspace }}/android_lib/ s3://nnstreamer-release/nnstreamer/${{ steps.get-date.outputs.date }}/android/
- aws s3 rm s3://nnstreamer-release/nnstreamer/latest/android/
- aws s3 cp --recursive --region ap-northeast-2 ${{ github.workspace }}/android_lib/ s3://nnstreamer-release/nnstreamer/latest/android/
- - name: Publish javadoc
+ pip install pybadges setuptools
+ mkdir -p ~/daily_build
+ if [ '${{ steps.android-build.outputs.result }}' == 'success' ]; then
+ python3 -m pybadges --left-text=test --right-text=success --right-color=green > ~/daily_build/android_build_result.svg
+ else
+ python3 -m pybadges --left-text=test --right-text=failure --right-color=red > ~/daily_build/android_build_result.svg
+ fi
+
+ - name: update daily result badge
+ uses: ./.github/actions/gitpush
+ with:
+ source: ~/daily_build/android_build_result.svg
+ dest: testresult
+ message: "Update android daily build result."
+ taos_account: ${{ secrets.TAOS_ACCOUNT }}
+ taos_account_token: ${{ secrets.TAOS_ACCOUNT_TOKEN }}
+
+ - name: Generate javadoc
+ if: steps.android-build.outputs.result == 'success'
run: |
- echo "Publish javadoc, ${{ github.workspace }}"
- mkdir ~/javadoc_dir
+ echo "Generate javadoc, ${{ github.workspace }}"
+ mkdir -p ~/javadoc_dir
sed -i "s|@BUILD_ANDROID@|//|" ${{ github.workspace }}/java/android/nnstreamer/src/main/java/org/nnsuite/nnstreamer/*.java
javadoc -d ~/javadoc_dir -public -splitindex -Xdoclint:none --ignore-source-errors java/android/nnstreamer/src/main/java/org/nnsuite/nnstreamer/*
- aws s3 cp --recursive --region ap-northeast-2 ~/javadoc_dir/ s3://nnstreamer-release/nnstreamer/${{ steps.get-date.outputs.date }}/java_html/
- aws s3 rm s3://nnstreamer-release/nnstreamer/latest/java_html/
- aws s3 cp --recursive --region ap-northeast-2 ~/javadoc_dir/ s3://nnstreamer-release/nnstreamer/latest/java_html/
+
+ - name: Publish javatoc to release.nnstreamer.com
+ if: steps.android-build.outputs.result == 'success'
+ uses: ./.github/actions/s3_upload
+ with:
+ source: ~/javadoc_dir/
+ dest: java_html/
+ s3_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
+ s3_key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
+ s3_option: --recursive