From 330c75f2acb7b52d01966bb00774ebe1fe0d87a1 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 19 May 2026 13:33:03 -0400 Subject: [PATCH] Fix nasa/cFS#1022, add makefile target for cosmos gem Adds a target to the bundle makefiles for building the CFS test suite gem file for COSMOS. --- .github/workflows/cosmos-gem.yml | 100 +++++++++++++++++++++++++++++++ goal-configs.mk | 2 +- target-rules.mk | 5 ++ tools/cfs-cosmos-plugin | 2 +- 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cosmos-gem.yml diff --git a/.github/workflows/cosmos-gem.yml b/.github/workflows/cosmos-gem.yml new file mode 100644 index 000000000..a598eaaf4 --- /dev/null +++ b/.github/workflows/cosmos-gem.yml @@ -0,0 +1,100 @@ +name: Build COSMOS gem + +# Run on all pull requests, and pushes in dev and main branches +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: + COSMOS_VERSION: '6.10.5' + CFS_CONFIG: native_std + GH_HOST: github.com + GH_REPO: ${{ github.repository }} + +jobs: + stage-gem: + name: 'Set up CFS source' + runs-on: ubuntu-latest + container: + image: ghcr.io/core-flight-system/cfsbuildenv-linux + outputs: + version: ${{ steps.get-version.outputs.version }} + suffix: ${{ steps.get-version.outputs.suffix }} + steps: + - name: Checkout Bundle + uses: actions/checkout@v6 + with: + submodules: true + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Determine plugin version + id: get-version + run: | + git config --global --add safe.directory "${GITHUB_WORKSPACE}" + git fetch --tags --unshallow --recurse-submodules=no origin + echo "version=$(git describe --tags --abbrev=0 --match "v[0-9].[0-9].[0-9]" | tr -d v)" >> ${GITHUB_OUTPUT} + echo "suffix=g$(git rev-parse --short HEAD)" >> ${GITHUB_OUTPUT} + + - name: Prepare ${{ env.CFS_CONFIG }} Build + run: make ${CFS_CONFIG}.prep + + - name: Stage gem contents + run: make ${CFS_CONFIG}.gem + + - name: Upload gem contents + uses: actions/upload-artifact@v7 + with: + name: ${{ env.CFS_CONFIG }}-gem-source + path: build-${{ env.CFS_CONFIG }}/cosmos/plugin/* + + + build-gem: + name: 'Build gem binary' + needs: stage-gem + runs-on: ubuntu-latest + + steps: + - name: 'Download artifact' + uses: actions/download-artifact@v8 + with: + name: ${{ env.CFS_CONFIG }}-gem-source + path: build-${{ env.CFS_CONFIG }} + + ## Note this does not use actions/checkout because this is a public repo + - name: Check out COSMOS + uses: actions/checkout@v6 + with: + repository: 'OpenC3/cosmos-project' + ref: 'v${{ env.COSMOS_VERSION }}' + path: ./cosmos-project + + - name: Build GEM + working-directory: ${{ github.workspace }}/cosmos-project + env: + GEM_SOURCE_DIR: ${{ github.workspace }}/build-${{ env.CFS_CONFIG }} + PLUGIN_VERSION: ${{ needs.stage-gem.outputs.version }}.${{ needs.stage-gem.outputs.suffix }} + run: > + docker compose run --rm --no-deps + -v ${GEM_SOURCE_DIR}:/openc3/local:z + --user $(id -u):$(id -g) + -w /openc3/local + openc3-cosmos-cmd-tlm-api ruby /openc3/bin/openc3cli rake build VERSION=${PLUGIN_VERSION} + + - name: Upload gem binary + uses: actions/upload-artifact@v7 + with: + name: ${{ env.CFS_CONFIG }}-gem-binary + path: ./build-${{ env.CFS_CONFIG }}/*.gem diff --git a/goal-configs.mk b/goal-configs.mk index 8d3279095..d84e03ade 100644 --- a/goal-configs.mk +++ b/goal-configs.mk @@ -56,7 +56,7 @@ # The "stamp" target names are associated with a file in the build dir to indicate last run time # The "nostamp" target names do not have this, and are always executed STAMP_GOAL_NAMES := prep compile install checktest runtest lcov -CFS_STAMP_GOAL_NAMES := detaildesign usersguide osalguide image +CFS_STAMP_GOAL_NAMES := detaildesign usersguide osalguide image gem ALL_GOAL_NAMES := $(STAMP_GOAL_NAMES) $(CFS_STAMP_GOAL_NAMES) # This file must define CONFIG_NAMES and all other per-config vars diff --git a/target-rules.mk b/target-rules.mk index 85a413a39..ffccdd1af 100644 --- a/target-rules.mk +++ b/target-rules.mk @@ -63,6 +63,11 @@ export CPUNAME %/stamp.image: %/stamp.install touch "$(@)" +# Build the COSMOS gem file. Be sure to pass in the absolute path for $(O) +%/stamp.gem: %/stamp.prep + $(MAKE) --no-print-directory O=$(abspath $(O)) -C tools/cfs-cosmos-plugin gem + touch "$(@)" + # Check which tests exist # Extract the list of tests and associated commands from JSON %/stamp.checktest: %/stamp.install diff --git a/tools/cfs-cosmos-plugin b/tools/cfs-cosmos-plugin index 1a79bbab9..5cc09adec 160000 --- a/tools/cfs-cosmos-plugin +++ b/tools/cfs-cosmos-plugin @@ -1 +1 @@ -Subproject commit 1a79bbab983ca72e25a9bd51695dfd7faadfea81 +Subproject commit 5cc09adec6d47054118b83629d816271e743f790