Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/cosmos-gem.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion goal-configs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions target-rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading