From 1c961c941ec5d3610fb00d8ba71d1ac3b34a672b Mon Sep 17 00:00:00 2001 From: Adams Date: Tue, 7 Apr 2026 12:29:36 -0500 Subject: [PATCH] Part cFS/workflows#177, Update Existing Workflows with Internal Logic --- .../workflows/build-osal-documentation.yml | 6 +- .github/workflows/format-check.yml | 7 ++- .github/workflows/standalone-build.yml | 62 ++++++------------- 3 files changed, 28 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build-osal-documentation.yml b/.github/workflows/build-osal-documentation.yml index 8e40bc0f9..03b8dc5ac 100644 --- a/.github/workflows/build-osal-documentation.yml +++ b/.github/workflows/build-osal-documentation.yml @@ -33,12 +33,10 @@ jobs: needs: check-for-duplicates if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} runs-on: ubuntu-22.04 + container: ghcr.io/core-flight-system/cfsbuildenv-doxygen:latest timeout-minutes: 15 steps: - - name: Install Dependencies - run: sudo apt-get update && sudo apt-get install doxygen graphviz -y - - name: Checkout submodule uses: actions/checkout@v4 @@ -73,4 +71,4 @@ jobs: if [[ -s osal-apiguide-warnings.log ]]; then cat osal-apiguide-warnings.log exit -1 - fi + fi \ No newline at end of file diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml index 9065a28ac..243ad404d 100644 --- a/.github/workflows/format-check.yml +++ b/.github/workflows/format-check.yml @@ -2,13 +2,18 @@ name: Format Check # Run on all push and pull requests on: + push: + branches: + - dev + - main pull_request: types: - opened - reopened - synchronize + workflow_dispatch: jobs: format-check: name: Run format check - uses: nasa/cFS/.github/workflows/format-check.yml@main \ No newline at end of file + uses: nasa/cFS/.github/workflows/format-check.yml@dev \ No newline at end of file diff --git a/.github/workflows/standalone-build.yml b/.github/workflows/standalone-build.yml index da3c67c10..8ca6fd032 100644 --- a/.github/workflows/standalone-build.yml +++ b/.github/workflows/standalone-build.yml @@ -22,53 +22,38 @@ env: allowed_ncov_functions: 0 jobs: - build-and-test: name: Build and Execute Tests + runs-on: ubuntu-22.04 + container: ghcr.io/core-flight-system/cfsbuildenv-linux:latest strategy: fail-fast: false - matrix: - build-type: [Debug, Release] - base-os: [ubuntu-22.04] - - runs-on: ${{ matrix.base-os }} steps: - - name: Checkout OSAL uses: actions/checkout@v4 with: path: source - - name: Install Coverage Analysis Tools - if: ${{ matrix.build-type == 'Debug' }} - run: sudo apt-get update && sudo apt-get install -y lcov xsltproc && echo "run_lcov=TRUE" >> $GITHUB_ENV + - name: Set CXX environment variable + run: echo "CXX=/usr/bin/g++" >> $GITHUB_ENV + + - name: Set run_lcov=TRUE + run: echo "run_lcov=TRUE" >> $GITHUB_ENV - name: Set up debug environment - if: ${{ matrix.build-type == 'Debug' }} run: | - echo "is_debug=TRUE" >> $GITHUB_ENV - echo "is_release=FALSE" >> $GITHUB_ENV - echo "build_tgt=all" >> $GITHUB_ENV echo "DESTDIR=${{ github.workspace }}/staging-debug" >> $GITHUB_ENV - - name: Set up release environment - if: ${{ matrix.build-type == 'Release' }} - run: | - echo "is_debug=FALSE" >> $GITHUB_ENV - echo "is_release=TRUE" >> $GITHUB_ENV - echo "build_tgt=install" >> $GITHUB_ENV - echo "DESTDIR=${{ github.workspace }}/staging-release" >> $GITHUB_ENV - - name: Set up build run: cmake - -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} - -DENABLE_UNIT_TESTS=${{ env.is_debug }} - -DOSAL_OMIT_DEPRECATED=${{ env.is_debug }} - -DOSAL_VALIDATE_API=${{ env.is_release }} - -DOSAL_INSTALL_LIBRARIES=${{ env.is_release }} - -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=${{ env.is_debug }} + -DCMAKE_BUILD_TYPE=Debug + -DENABLE_UNIT_TESTS=TRUE + -DOSAL_OMIT_DEPRECATED=FALSE + -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 @@ -79,57 +64,50 @@ jobs: working-directory: build run: make ${{ env.build_tgt }} -j2 - - name: Validate API - if: ${{ matrix.build-type == 'Release' }} - working-directory: build - run: make osal_apicheck - - name: Execute Tests - if: ${{ matrix.build-type == 'Debug' }} working-directory: build run: ctest --output-on-failure -j4 2>&1 | tee ../ctest.log - name: Check Coverage id: stats - if: ${{ env.run_lcov == 'TRUE' }} uses: ./source/.github/actions/check-coverage with: binary-dir: build - name: Enforce coverage function minimum - if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_functions > env.allowed_ncov_functions }} + if: ${{ always() && steps.stats.outputs.ncov_functions > env.allowed_ncov_functions }} run: | echo "::error::Too many uncovered functions (${{ steps.stats.outputs.ncov_functions }})" /bin/false - name: Enforce coverage line minimum - if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_lines > env.allowed_ncov_lines }} + if: ${{ always() && steps.stats.outputs.ncov_lines > env.allowed_ncov_lines }} run: | echo "::error::Too many uncovered lines (${{ steps.stats.outputs.ncov_lines }})" /bin/false - name: Enforce coverage branch minimum - if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_branches > env.allowed_ncov_branches }} + if: ${{ always() && steps.stats.outputs.ncov_branches > env.allowed_ncov_branches }} run: | echo "::error::Too many uncovered branches (${{ steps.stats.outputs.ncov_branches }})" /bin/false - name: Enforce keeping coverage function minimum up-to-date - if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_functions < env.allowed_ncov_functions }} + if: ${{ always() && steps.stats.outputs.ncov_functions < env.allowed_ncov_functions }} run: | echo "::error::${{ steps.stats.outputs.ncov_functions }} uncovered function${{ steps.stats.outputs.ncov_functions == 1 && '' || 's' }} reported, but ${{ env.allowed_ncov_functions }} ${{ env.allowed_ncov_functions == 1 && 'is' || 'are' }} allowed." echo "::error::Please update the 'allowed_ncov_functions' variable to ${{ steps.stats.outputs.ncov_functions }} in order to match the new coverage level." /bin/false - name: Enforce keeping coverage line minimum up-to-date - if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_lines < env.allowed_ncov_lines }} + if: ${{ always() && steps.stats.outputs.ncov_lines < env.allowed_ncov_lines }} run: | echo "::error::${{ steps.stats.outputs.ncov_lines }} uncovered line${{ steps.stats.outputs.ncov_lines == 1 && '' || 's' }} reported, but ${{ env.allowed_ncov_lines }} ${{ env.allowed_ncov_lines == 1 && 'is' || 'are' }} allowed." echo "::error::Please update the 'allowed_ncov_lines' variable to ${{ steps.stats.outputs.ncov_lines }} in order to match the new coverage level." /bin/false - name: Enforce keeping coverage branch minimum up-to-date - if: ${{ env.run_lcov == 'TRUE' && always() && steps.stats.outputs.ncov_branches < env.allowed_ncov_branches }} + if: ${{ always() && steps.stats.outputs.ncov_branches < env.allowed_ncov_branches }} run: | echo "::error::${{ steps.stats.outputs.ncov_branches }} uncovered branch${{ steps.stats.outputs.ncov_branches == 1 && '' || 'es' }} reported, but ${{ env.allowed_ncov_branches }} ${{ env.allowed_ncov_branches == 1 && 'is' || 'are' }} allowed." echo "::error::Please update the 'allowed_ncov_branches' variable to ${{ steps.stats.outputs.ncov_branches }} in order to match the new coverage level." @@ -146,4 +124,4 @@ jobs: fi if [ -s 'build/lcov-summary.xml' ]; then cat 'build/lcov-summary.xml' >> $GITHUB_STEP_SUMMARY - fi + fi \ No newline at end of file