diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e77bbba0d2c701cdb8f2ea838a8fdb6f69beae4..6af6dd6b09621501aa8f472f4f9fb24228416c85 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -186,6 +186,10 @@ lava-report: needs: [lava-qemu-x86, lava-qemu-x86_64, lava-zephyr-96b-nitrogen-tests, lava-zephyr-qemu-cortex-m3, lava-zephyr-qemu-x86] extends: .lava-report +lava-badge: + needs: [lava-report] + extends: .lava-badge + .build-with-kaniko: stage: build image: diff --git a/.oniro-ci/test-generic.yaml b/.oniro-ci/test-generic.yaml index 59bf0c2ee8e828770b2a96dc7861c7aa0f9f08ba..f668589f27c228038bd5228fbef2b388427e9328 100644 --- a/.oniro-ci/test-generic.yaml +++ b/.oniro-ci/test-generic.yaml @@ -125,3 +125,27 @@ # Run the build when a tag is placed. - if: '$CI_COMMIT_TAG' when: manual + +.lava-badge: + interruptible: true + image: + name: registry.booting.oniroproject.org/distro/oniro/bitbake-builder:latest + stage: report + variables: + GIT_STRATEGY: none + script: + - | + set -x + curl --silent "$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/test_report" > test-report.json + total_count="$(jq '.total_count' test-report.json)" + success_count="$(jq '.success_count' test-report.json)" + success_rate=$(( 100 * success_count / total_count )) + anybadge --label=lava-test --value=${success_rate} --suffix='%' --file=lava-test.svg 50=red 60=orange 80=yellow 100=green + set +x + artifacts: + when: always + paths: + - lava-test.svg + rules: + # Run the build when it is scheduled. + - if: $CI_PIPELINE_SOURCE == "schedule"