-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (61 loc) · 2.28 KB
/
run-unit-test-and-upload-codecov.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
##############################################################################
#
# GitGub CI workflow syntax spec:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
# CodeCov github action setup:
# https://github.com/codecov/codecov-action
#
# CodeCov badge setup:
# https://docs.codecov.com/docs/status-badges
#
# version 1.1
##############################################################################
name: Run Unit Test and Upload Coverage Report
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened]
workflow_dispatch:
jobs:
build-run-upload:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install build packages
run: |
sudo apt update
sudo apt install -y software-properties-common
sudo apt install -y doxygen lcov gcovr
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
- name: Set up OpenCV
id: opencv
run: |
echo "::set-output name=cache-key::opencv-4.5.0-cuda-off"
- name: Restore Cache
uses: actions/cache@v2
with:
path: /home/runner/work/ENPM808X-Human-Detection-and-Tracking/ENPM808X-Human-Detection-and-Tracking/opencv/build
key: ${{ steps.opencv.outputs.cache-key }}
- name: Configure CMake flags and build executables
run: |
cmake -D WANT_COVERAGE=ON -D CMAKE_BUILD_TYPE=Debug -S ./ -B build/
cmake --build build/ --clean-first --target all test_coverage
- name: Save Cache
if: success() # Save the cache only if the previous steps were successful
uses: actions/cache@v2
with:
path: /home/runner/work/ENPM808X-Human-Detection-and-Tracking/ENPM808X-Human-Detection-and-Tracking/opencv/build
key: ${{ steps.opencv.outputs.cache-key }}
- name: Upload coverage result to CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/build/test_coverage.info
fail_ci_if_error: true
verbose: true