Skip to content

Update mcdc.yml

Update mcdc.yml #4

Workflow file for this run

name: OSAL standalone MCDC
on:
push:
pull_request:
# Force bash to apply pipefail option so pipeline failures aren't masked
defaults:
run:
shell: bash
env:
SIMULATION: native
ENABLE_UNIT_TESTS: true
OMIT_DEPRECATED: true
BUILDTYPE: debug
jobs:
# Checks for duplicate actions. Skips push actions if there is a matching or
# duplicate pull-request action.
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"]'
mcdc:
needs: checks-for-duplicates
if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'main') }}
name: Build and Run MCDC
runs-on: ubuntu-20.04
container: ghcr.io/arielswalker/mcdc:latest
steps:
- name: Checkout Bundle Workflow Scripts
uses: actions/checkout@v4
with:
repository: arielswalker/cFS
ref: test-mcdc
sparse-checkout: |
.github
- name: Checkout OSAL
uses: actions/checkout@v4
with:
path: source
- name: Modify osal to include coverage flags
run: |
sed -i '/if (NOT CMAKE_CROSSCOMPILING AND NOT OSAL_OMIT_DEPRECATED)/,/\}/s/set(UT_COVERAGE_COMPILE_FLAGS.*/set(UT_COVERAGE_COMPILE_FLAGS -pg -O0 -fprofile-arcs -ftest-coverage -fcondition-coverage -fprofile-abs-path)/' source/src/bsp/generic-linux/build_options.cmake
sed -i '/if (NOT CMAKE_CROSSCOMPILING AND NOT OSAL_OMIT_DEPRECATED)/,/\}/s/set(UT_COVERAGE_LINK_FLAGS.*/set(UT_COVERAGE_LINK_FLAGS -pg -O0 -fprofile-arcs -ftest-coverage -fcondition-coverage -fprofile-abs-path)/' source/src/bsp/generic-linux/build_options.cmake
- name: Set up build
run: cmake
-DCMAKE_BUILD_TYPE=Debug
-DENABLE_UNIT_TESTS=TRUE
-DOSAL_OMIT_DEPRECATED=TRUE
-DOSAL_VALIDATE_API=FALSE
-DOSAL_INSTALL_LIBRARIES=FALSE
-DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=TRUE
-DOSAL_SYSTEM_BSPTYPE=generic-linux
-DCMAKE_PREFIX_PATH=/usr/lib/cmake
-DCMAKE_INSTALL_PREFIX=/usr
-S source
-B build
- name: Build OSAL
working-directory: build
run: make ${{ env.build_tgt }} -j2
- name: Execute Tests
working-directory: build
run: |
echo "BASE_DIR=source/build/native/default_cpu1" >> $GITHUB_ENV
ctest --output-on-failure -j4 2>&1 | tee ../ctest.log
- name: Debug
run: |
pwd
ls
cd source
pwd
ls
- name: Run mcdc analysis
if: success() || failure()
run: bash .github/scripts/mcdc-analyze.sh
- name: Archive unit test results
# Upload if success or failure which supports skipping, unlike always()
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Unit test results
path: |
test_results.txt
- name: Archive mcdc results
# Upload if success or failure which supports skipping, unlike always()
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: mcdc results
path: |
**/*.gcov
mcdc_results.txt