-
Notifications
You must be signed in to change notification settings - Fork 19
152 lines (130 loc) · 4.73 KB
/
Copy pathvalidation-test.yml
File metadata and controls
152 lines (130 loc) · 4.73 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
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
name: Build And Run EdsLib Validation Tests
on:
push:
branches:
- dev
- main
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
# 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: dev
jobs:
checks-for-duplicates:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
prepare-dependencies:
name: Prepare Dependencies
needs: checks-for-duplicates
if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'dev') }}
runs-on: ubuntu-latest
container: ghcr.io/core-flight-system/cfsbuildenv-linux:latest
steps:
- name: Cache EdsLib Source
uses: actions/cache@v5
id: cache-edslib
with:
path: ${{ github.workspace }}/source
key: edslib-source-${{ github.sha }}
- name: Cache OSAL Dependency
uses: actions/cache@v5
id: cache-osal
with:
path: ${{ github.workspace }}/osal-staging
key: edslib-dep-${{ env.UPSTREAM_OSAL_REPO }}@${{ env.UPSTREAM_OSAL_REF }}
- name: Checkout EdsLib
if: steps.cache-edslib.outputs.cache-hit != 'True'
uses: actions/checkout@v6
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 }}
build-and-test:
name: Build EdsLib and Execute Tests
needs: [prepare-dependencies]
runs-on: ubuntu-latest
container: ghcr.io/core-flight-system/cfsbuildenv-linux:latest
strategy:
fail-fast: false
matrix:
buildtype: [Debug, Release]
env:
MATRIX_ID: matrix-${{ matrix.buildtype }}
steps:
# Note - caches were updated in "prepare-dependencies" job so all three of these should be a hit
- name: Retrieve Cached EdsLib Source
uses: actions/cache@v5
id: restore-source
with:
path: ${{ github.workspace }}/source
key: edslib-source-${{ github.sha }}
- name: Retrieve Cached OSAL Dependency
id: restore-osal
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/osal-staging
key: edslib-dep-${{ env.UPSTREAM_OSAL_REPO }}@${{ env.UPSTREAM_OSAL_REF }}
# The files extracted from the cache only have owner permissions,
# so in order to make this work it needs to adjust this.
- name: Import OSAL
run: |
sudo cp -rv -t / ${GITHUB_WORKSPACE}/osal-staging/*
sudo find /usr/local -type d -exec chmod go+rx {} \;
sudo find /usr/local -type f -exec chmod go+r {} \;
sudo find /usr/local -type f -path '*/bin/*' -exec chmod go+x {} \;
- name: Refresh Dynamic Linker Cache
run: sudo ldconfig
- name: Set up EdsLib Build
run: cmake
-DCMAKE_BUILD_TYPE=${{ matrix.buildtype }}
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE
-DENABLE_UNIT_TESTS=TRUE
-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'
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