-
Notifications
You must be signed in to change notification settings - Fork 15
155 lines (128 loc) · 4.86 KB
/
unit-test-functional.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build And Run BPLib Functional Tests
on:
workflow_dispatch:
pull_request:
# Force bash to apply pipefail option so pipeline failures aren't masked
defaults:
run:
shell: bash
env:
UPSTREAM_OSAL_REPO: nasa/osal
UPSTREAM_OSAL_REF: main
UPSTREAM_TINYCBOR_REPO: intel/tinycbor
UPSTREAM_TINYCBOR_REF: v0.6.0
jobs:
prepare-dependencies:
name: Prepare Dependencies
runs-on: ubuntu-22.04
steps:
- name: Cache BPLib Source
uses: actions/cache@v3
id: cache-bplib
with:
path: ${{ github.workspace }}/source
key: bplib-source-${{ github.sha }}
- name: Cache OSAL Dependency
uses: actions/cache@v3
id: cache-osal
with:
path: ${{ github.workspace }}/osal-staging
key: bplib-dep-${{ env.UPSTREAM_OSAL_REPO }}@${{ env.UPSTREAM_OSAL_REF }}
- name: Cache TinyCBOR Dependency
uses: actions/cache@v3
id: cache-tinycbor
with:
path: ${{ github.workspace }}/tinycbor-staging
key: bplib-dep-${{ env.UPSTREAM_TINYCBOR_REPO }}@${{ env.UPSTREAM_TINYCBOR_REF }}
- name: Checkout BPLib
if: steps.cache-bplib.outputs.cache-hit != 'True'
uses: actions/checkout@v3
with:
path: source
- name: Set up OSAL
if: steps.cache-osal.outputs.cache-hit != 'True'
uses: ./source/.github/actions/setup-osal
with:
staging-dir: ${{ github.workspace }}/osal-staging
upstream-repo: ${{ env.UPSTREAM_OSAL_REPO }}
upstream-ref: ${{ env.UPSTREAM_OSAL_REF }}
- name: Set up TinyCBOR
if: steps.cache-tinycbor.outputs.cache-hit != 'True'
uses: ./source/.github/actions/setup-tinycbor
with:
staging-dir: ${{ github.workspace }}/tinycbor-staging
upstream-repo: ${{ env.UPSTREAM_TINYCBOR_REPO }}
upstream-ref: ${{ env.UPSTREAM_TINYCBOR_REF }}
build-and-test:
name: Build BPLib and Execute Tests
needs: [prepare-dependencies]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
buildtype: [Debug, Release]
os-layer: [OSAL, POSIX]
env:
MATRIX_ID: matrix-${{ matrix.buildtype }}-${{ matrix.os-layer }}
steps:
# Note - caches were updated in "prepare-dependencies" job so all three of these should be a hit
- name: Retrieve Cached BPLib Source
uses: actions/cache@v3
id: restore-source
with:
path: ${{ github.workspace }}/source
key: bplib-source-${{ github.sha }}
- name: Retrieve Cached TinyCBOR Dependency
id: restore-tinycbor
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tinycbor-staging
key: bplib-dep-${{ env.UPSTREAM_TINYCBOR_REPO }}@${{ env.UPSTREAM_TINYCBOR_REF }}
- name: Import TinyCBOR
run: sudo cp -rv -t / ${{ github.workspace }}/tinycbor-staging/*
- name: Retrieve Cached OSAL Dependency
if: matrix.os-layer == 'OSAL'
id: restore-osal
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/osal-staging
key: bplib-dep-${{ env.UPSTREAM_OSAL_REPO }}@${{ env.UPSTREAM_OSAL_REF }}
- name: Install Coverage Analysis Tools
if: env.MATRIX_ID == 'matrix-Debug-OSAL'
run: sudo apt-get install -y lcov xsltproc
- name: Import OSAL
if: matrix.os-layer == 'OSAL'
run: sudo cp -rv -t / ${{ github.workspace }}/osal-staging/*
- name: Refresh Dynamic Linker Cache
run: sudo ldconfig
- name: Set up BPLib Build
run: cmake
-DCMAKE_BUILD_TYPE=${{ matrix.buildtype }}
-DBPLIB_OS_LAYER=${{ matrix.os-layer }}
-DCMAKE_PREFIX_PATH=/usr/local/lib/cmake
-S source -B ${{ env.MATRIX_ID }}
- name: Build BPLib
working-directory: ${{ env.MATRIX_ID }}
run: make all
- name: Check for Tests
run: if [ -e '${{ env.MATRIX_ID }}/CTestTestfile.cmake' ]; then echo 'RUN_TESTS=True' >> $GITHUB_ENV; fi
- name: Run Tests
working-directory: ${{ env.MATRIX_ID }}
if: env.RUN_TESTS == 'True'
run: ctest --output-on-failure 2>&1 | tee ctest.log
- name: Check Coverage
if: env.MATRIX_ID == 'matrix-Debug-OSAL'
uses: ./source/.github/actions/check-coverage
with:
binary-dir: ${{ env.MATRIX_ID }}
- name: Assemble Results
run: |
if [ -s '${{ env.MATRIX_ID }}/ctest.log' ]; then
echo '<h2>CTest Execution</h2>' >> $GITHUB_STEP_SUMMARY
echo '<pre>' >> $GITHUB_STEP_SUMMARY
cat '${{ env.MATRIX_ID }}/ctest.log' >> $GITHUB_STEP_SUMMARY
echo '</pre>' >> $GITHUB_STEP_SUMMARY
fi
if [ -s '${{ env.MATRIX_ID }}/lcov-summary.xml' ]; then
cat '${{ env.MATRIX_ID }}/lcov-summary.xml' >> $GITHUB_STEP_SUMMARY
fi