Skip to content

Commit

Permalink
workflow-2612
Browse files Browse the repository at this point in the history
 - Update / cleanup interface input/output between build job and
   reusable workflow.
  • Loading branch information
rlcheng committed Sep 30, 2024
1 parent 8c91a74 commit f164fb1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 43 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/baremetal_ci_teensy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ on: [push]

env:
platform_setup: "fsw-gds"
baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex
build_binary: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex
gds_args: --comm-adapter uart --uart-device /dev/ttyACM0
dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml
test_path: BaremetalReference/test/int/baremetal_ref_integration_test.py
workspace_path: ${{ github.workspace }}
new_baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/build_binary
new_build_binary: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/build_binary
new_dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/dictionary.xml

jobs:
Expand All @@ -20,23 +19,21 @@ jobs:
platform_setup: ${{ env.platform_setup }}
start_cmd: /home/odroid/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY41 -v -s ./build_binary
gds_args: ${{ env.gds_args }}
dict_path: ${{ env.dict_path }}
test_path: ${{ env.test_path }}
workspace_path: ${{ env.workspace_path }}
steps:
- uses: actions/checkout@v4
- name: "Checkout F' Repository"
uses: actions/checkout@v4
with:
submodules: true
path: ${{ inputs.fprime_location }}
- name: "Build"
- name: "Fprime Venv and Requirements Install"
run: |
python3 -m venv ./fprime-venv
. ./fprime-venv/bin/activate
pip3 install -U setuptools wheel pip
pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt
- name: "Platform Specific Requirements Install"
run: |
mkdir -p ~/.local/bin
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/.local/bin sh
cd ~/.local/bin
Expand All @@ -50,38 +47,33 @@ jobs:
arduino-cli config add board_manager.additional_urls https://www.pjrc.com/teensy/package_teensy_index.json
arduino-cli core update-index
arduino-cli core install teensy:avr
- name: "Build"
run: |
. ./fprime-venv/bin/activate
fprime-util generate
fprime-util build
- name: "Rename build files"
run: |
mv ${{ env.baremetal_bin }} ${{ env.new_baremetal_bin }}
mv ${{ env.build_binary }} ${{ env.new_build_binary }}
mv ${{ env.dict_path}} ${{ env.new_dict_path}}
- name: "Upload build binary"
uses: actions/upload-artifact@v4
with:
name: build_binary
path: ${{ env.new_baremetal_bin }}
path: ${{ env.new_build_binary }}
- name: "Upload dictionary"
uses: actions/upload-artifact@v4
with:
name: dictionary.xml
path: ${{ env.new_dict_path }}
#- name: "Temp step, file renaming"
# run: |
# mv ${{ github.workspace }}/lib/arduino/fprime-arduino/ATmega/vendor/libraries/TimerOne/examples/FanSpeed/FanSpeed.pde ${{ github.workspace }}/lib/arduino/fprime-arduino/ATmega/vendor/libraries/TimerOne/examples/FanSpeed/FanSpeed.ino
# mv ${{ github.workspace }}/lib/arduino/fprime-arduino/ATmega/vendor/libraries/TimerOne/examples/Interrupt/Interrupt.pde ${{ github.workspace }}/lib/arduino/fprime-arduino/ATmega/vendor/libraries/TimerOne/examples/Interrupt/Interrupt.ino
- run: echo "Expose env vars for reusable workflow."

fit:
needs: build
uses: ./.github/workflows/reusable_fit_ci.yml
with:
test_path: ${{ needs.build.outputs.test_path }}
runs_on: self-hosted
platform_setup: ${{ needs.build.outputs.platform_setup }}
start_cmd: ${{ needs.build.outputs.start_cmd }}
gds_args: ${{ needs.build.outputs.gds_args }}
dict_path: ${{ needs.build.outputs.dict_path }}
test_path: ${{ needs.build.outputs.test_path }}
workspace_path: ${{ needs.build.outputs.workspace_path }}
46 changes: 21 additions & 25 deletions .github/workflows/reusable_fit_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name: resuable-fit
on:
workflow_call:
inputs:
test_path:
required: true
type: string
runs_on:
required: false
type: string
default: "ubuntu-latest"
platform_setup:
required: true
required: false
type: string
default: "non-embedded"
start_cmd:
Expand All @@ -18,24 +21,18 @@ on:
gds_args:
required: false
type: string
dict_path:
required: false
type: string
test_path:
required: false
type: string
workspace_path:
required: true
type: string
default: ""

jobs:
# Following jobs are on a switch, only one will run based on platform_setup string.
# Each job has a different method of starting FSW, FIT is run at the end of each job.
# Setup will run first by creating the virtual environment and then downloading the
# FSW binary and dictionary created in the build job step. After that the following
# jobs are on a switch, only one will run based on platform_setup string. Each job
# has a different method of starting FSW, FIT is run at the end of each job.
# If adding a new setup make sure it does not collide with an existing job.
# After one of these jobs is run, the upload FIT artifact job will then run.
#
# / non-embedded \
# build --->| fsw-gds |---> upload-fit-artifacts
# setup --->| fsw-gds |---> upload-fit-artifacts
# \ gds-fsw /

setup:
Expand All @@ -47,22 +44,22 @@ jobs:
with:
submodules: true
path: ${{ inputs.fprime_location }}
- name: "Build"
- name: "Install and activate Virtual Environment"
run: |
python3 -m venv ./fprime-venv
. ./fprime-venv/bin/activate
pip3 install -U setuptools wheel pip
pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt
- name: "Download Binary"
- name: "Download FSW Binary"
uses: actions/download-artifact@v4
with:
name: build_binary
- name: "Download dictionary"
- name: "Download Dictionary"
uses: actions/download-artifact@v4
with:
name: dictionary.xml

non-embedded:
run-non-embedded:
if: ${{ inputs.platform_setup == 'non-embedded' }}
runs-on: ${{ inputs.runs_on }}
needs: setup
Expand All @@ -75,9 +72,9 @@ jobs:
run: |
. ./fprime-venv/bin/activate
sleep 12
pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP
pytest ${{ inputs.test_path }} --dictionary ./dictionary.xml -rP
fsw-gds:
run-fsw-gds:
if: ${{ inputs.platform_setup == 'fsw-gds' }}
needs: setup
runs-on: ${{ inputs.runs_on }}
Expand All @@ -94,34 +91,33 @@ jobs:
. ./fprime-venv/bin/activate
pytest ${{ inputs.test_path }} -rP --dictionary ./dictionary.xml --logs ./
gds-fsw:
run-gds-fsw:
if: ${{ inputs.platform_setup == 'gds-fsw' }}
needs: setup
runs-on: ${{ inputs.runs_on }}
steps:
- name: "Start GDS"
run: |
. ./fprime-venv/bin/activate
fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} &
fprime-gds -n --dictionary ./dictionary.xml --gui none ${{ inputs.gds_args }} &
- name: "Start FSW"
run: |
${{ inputs.start_cmd }}
sleep 12
- name: "Run Integration tests"
run: |
. ./fprime-venv/bin/activate
pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP
pytest ${{ inputs.test_path }} --dictionary ./dictionary.xml -rP
upload-fit-artifact:
runs-on: ${{ inputs.runs_on }}
if: ${{ always() }} #as long as one of the above jobs run, this job will run
needs: [non-embedded, fsw-gds, gds-fsw]
needs: [run-non-embedded, run-fsw-gds, run-gds-fsw]
steps:
- name: "Upload Integration Test Results"
#Navigate to workspace path. nagigate into newest directory, which is for test logs.
#Navigate into newest directory, which is for test logs.
#Rename test log because it contains date time and time is separated by colons that upload-artifact cannot handle.
#Store full path to test log xlsx in a variable for upload-artifact to use.
# cd ${{ inputs.workspace_path }}
run: |
cd "$(ls -td -- */ | head -n 1)"
mv TestLog*.xlsx TestLog.xlsx
Expand Down

0 comments on commit f164fb1

Please sign in to comment.