forked from nnstreamer/nnstreamer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gichan Jang <[email protected]>
- Loading branch information
1 parent
2100c36
commit a8d58cb
Showing
2 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
## | ||
# SPDX-License-Identifier: LGPL-2.1-only | ||
# Copyright (C) 2024 Samsung Electronics | ||
# | ||
# @file gen_build_result_badge.py | ||
# @brief A tool for generating a github badge image in svg format | ||
# @author Gichan Jang <[email protected]> | ||
# | ||
import sys | ||
import os | ||
import json | ||
from pybadges import badge | ||
|
||
## | ||
# @brief Generate a github badge svg file representing daily build result | ||
# @param[in] html build result of arch. | ||
# @param[in] path A file path to save the svg file | ||
def gen_build_result_badge(valid_json, out_dir): | ||
for arch in valid_json: | ||
result = valid_json[arch] | ||
color='green' | ||
if result == 'failure': | ||
color='red' | ||
|
||
s = badge(left_text='test', right_text=result, right_color=color) | ||
path = os.path.join(out_dir, arch + '_reuslt.svg') | ||
file = open(path, "w") | ||
file.write(s) | ||
file.close() | ||
|
||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) < 3: | ||
exit(1) | ||
|
||
file = open(sys.argv[1], "r") | ||
json_data = json.load(file) | ||
|
||
gen_build_result_badge (json_data, sys.argv[2]) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: temp | ||
|
||
on: | ||
# Allow manually triggering the workflow | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cache_gbs_build: | ||
outputs: | ||
x86_64: ${{ steps.gbs-result.outputs.x86_64 }} | ||
i586: ${{ steps.gbs-result.outputs.i586 }} | ||
armv7l: ${{ steps.gbs-result.outputs.armv7l }} | ||
aarch64: ${{ steps.gbs-result.outputs.aarch64 }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- gbs_build_arch: "x86_64" | ||
gbs_build_option: "success" | ||
- gbs_build_arch: "i586" | ||
gbs_build_option: "success" | ||
- gbs_build_arch: "armv7l" | ||
gbs_build_option: "success" | ||
- gbs_build_arch: "aarch64" | ||
gbs_build_option: "failure" | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v1 | ||
|
||
- name: prepare deb sources for GBS | ||
run: echo "deb [trusted=yes] http://download.tizen.org/tools/latest-release/Ubuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/tizen.list | ||
|
||
- name: install GBS | ||
run: sudo apt-get update && sudo apt-get install -y gbs | ||
|
||
# - name: configure GBS | ||
# run: cp .github/workflows/tizen.gbs.conf ~/.gbs.conf | ||
|
||
# - name: get date | ||
# id: get-date | ||
# run: | | ||
# echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
|
||
# - name: build and tests on GBS | ||
# id: gbs-build | ||
# run: gbs build --define "_skip_debug_rpm 1" -A ${{ matrix.gbs_build_arch }} | ||
|
||
- name: report GBS build and test result | ||
id: gbs-result | ||
run: echo "${{ matrix.gbs_build_arch }}=${{ matrix.gbs_build_option }}" >> $GITHUB_OUTPUT | ||
# run: echo "output_${{ matrix.gbs_build_arch }}=${{ steps.gbs-build.outcome }}" >> $GITHUB_OUTPUT | ||
|
||
- name: save gbs cache | ||
uses: actions/cache/save@v4 | ||
if: always() | ||
with: | ||
path: ~/GBS-ROOT/local/cache | ||
key: gbs-cache-${{ matrix.gbs_build_arch }}-${{ steps.get-date.outputs.date }} | ||
|
||
print_result: | ||
runs-on: ubuntu-22.04 | ||
needs: [cache_gbs_build] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v1 | ||
|
||
- name: print-result | ||
run: | | ||
mkdir -p ~/testresult | ||
pip install pybadges setuptools | ||
echo "aarch64 result: ${{ needs.cache_gbs_build.outputs.aarch64 }}" | ||
echo "x86_64 result: ${{ needs.cache_gbs_build.outputs.x86_64 }}" | ||
echo "i586 result: ${{ needs.cache_gbs_build.outputs.i586 }}" | ||
echo "armv7l result: ${{ needs.cache_gbs_build.outputs.armv7l }}" | ||
echo '${{ toJSON( needs.cache_gbs_build.outputs) }}' > daily_build_result.json | ||
cat daily_build_result.json | ||
python3 .github/workflows/gen_build_result_badge.py daily_build_result.json ~/testresult | ||
git clone https://${{ secrets.TAOS_ACCOUNT }}:${{ secrets.TAOS_ACCOUNT_TOKEN }}@github.com/nnstreamer/nnstreamer.github.io.git | ||
pushd nnstreamer.github.io | ||
cp -r ~/testresult/*.svg testresult | ||
git config user.email "[email protected]" | ||
git config user.name "nnsuite" | ||
git add * | ||
git commit -s -m "[DEBUG] Update unit test result badge." | ||
git push origin main -f | ||
popd |