forked from open-edge-platform/edge-ai-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (51 loc) · 2.09 KB
/
timeseries-unit-test.yaml
File metadata and controls
52 lines (51 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# Apache v2 license
# Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
name: "Time Series Analytics Microservice - Unit Testing"
run-name: "Time Series Analytics Microservice - Unit Testing (by @${{ github.actor }} via ${{ github.event_name }})"
on:
workflow_dispatch:
workflow_call:
jobs:
timeseries-unit-test:
name: Timeseries Unit Test
permissions:
contents: read
packages: read # needed for actions/checkout
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run unit tests
run: |
cd "${{ github.workspace }}"
cd ./microservices/time-series-analytics
echo "Running unit tests"
./tests/run_tests.sh
coverage=$(grep 'TOTAL' /tmp/unit-test-results.txt | awk '{print $4}')
# Extract test summary
summary=$(grep -Eo '[0-9]+ (passed|failed|skipped)' /tmp/unit-test-results.txt)
# Calculate total number of test cases
total_tests=$(echo "$summary" | awk '{sum += $1} END {print sum}')
# Extract number of passed tests
passed_tests=$(echo "$summary" | grep 'passed' | awk '{print $1}')
# Extract number of failed tests
failed_tests=$(echo "$summary" | grep 'failed' | awk '{print $1}')
# Print results
echo "Coverage: $coverage" >> $GITHUB_STEP_SUMMARY
echo "Total tests: $total_tests" >> $GITHUB_STEP_SUMMARY
echo "Passed tests: $passed_tests" >> $GITHUB_STEP_SUMMARY
echo "Failed tests: $failed_tests" >> $GITHUB_STEP_SUMMARY
- name: Upload HTML unit test coverage to Github
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: unit-test-coverage
path: /tmp/htmlcov
- name: Upload XML unit test coverage to Github
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: unit-test-report
path: /tmp/report.txt