From 3b771348beea9c3264b69743ddababa49949f4f8 Mon Sep 17 00:00:00 2001 From: Justin Figueroa Date: Thu, 24 Mar 2022 17:24:26 -0400 Subject: [PATCH] Fixes #212, Adds unit test workflow Changes enable_unit_test to true, changes ctest_output_on_failure to true, Adds repo_name, changes ubuntu-latest to ubuntu-18.04, splits build-run Copied and pasted this file from a successful run Adds matrix method to ubuntu-18.04 and ubuntu-20.04, adds cache key for os --- .github/workflows/build-cfs.yml | 89 +++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-cfs.yml b/.github/workflows/build-cfs.yml index 7eec1837..68da5fd4 100644 --- a/.github/workflows/build-cfs.yml +++ b/.github/workflows/build-cfs.yml @@ -8,12 +8,19 @@ on: env: SIMULATION: native OMIT_DEPRECATED: true - ENABLE_UNIT_TESTS: false + ENABLE_UNIT_TESTS: true + CTEST_OUTPUT_ON_FAILURE: true + REPO_NAME: ${{ github.event.repository.name }} jobs: #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. check-for-duplicates: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + # Map a step output to a job output outputs: should_skip: ${{ steps.skip_check.outputs.should_skip }} @@ -25,13 +32,31 @@ jobs: skip_after_successful_duplicate: 'true' do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - build-run: + build-cf-omit-deprecated-true: + name: Build needs: check-for-duplicates if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} - runs-on: ubuntu-18.04 + runs-on: ${{ matrix.os }} timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + buildtype: [debug, release] + + # Set the type of machine to run on + env: + BUILDTYPE: ${{ matrix.buildtype }} + steps: + - name: Cache Source and Build + id: cache-src-bld + uses: actions/cache@v2 + with: + path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* + key: build-${{ github.run_number }}-${{ matrix.buildtype }}-${{ matrix.os }} + - name: Checkout bundle uses: actions/checkout@v2 with: @@ -60,6 +85,29 @@ jobs: - name: Make Install run: make install + + run-cf-omit-deprecated-true: + name: Run + needs: build-cf-omit-deprecated-true + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + buildtype: [debug, release] + + # Set the type of machine to run on + env: + BUILDTYPE: ${{ matrix.buildtype }} + + steps: + - name: Cache Source and Build + id: cache-src-bld + uses: actions/cache@v2 + with: + path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* + key: build-${{ github.run_number }}-${{ matrix.buildtype }}-${{ matrix.os }} - name: Run cFS run: | @@ -83,4 +131,37 @@ jobs: exit -1 fi working-directory: ./build/exe/cpu1/ + + tests-and-coverage-omit-deprecated-true: + name: Run Unit Tests and Check Coverage + needs: run-cf-omit-deprecated-true + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + buildtype: [debug, release] + + # Set the type of machine to run on + env: + BUILDTYPE: ${{ matrix.buildtype }} + ENABLE_UNIT_TESTS: true + + steps: + - name: Install Dependencies + run: sudo apt-get install lcov -y + + - name: Cache Source and Build + id: cache-src-bld + uses: actions/cache@v2 + with: + path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/* + key: build-${{ github.run_number }}-${{ matrix.buildtype }}-${{ matrix.os }} + + - name: Run Tests + run: make test + - name: Check Coverage + run: make lcov + \ No newline at end of file