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 2e37a12
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 42 deletions.
29 changes: 11 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,34 @@ 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:
platform_setup: ${{ needs.build.outputs.platform_setup }}
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 }}
44 changes: 20 additions & 24 deletions .github/workflows/reusable_fit_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,36 @@ name: resuable-fit
on:
workflow_call:
inputs:
runs_on:
required: false
type: string
default: "ubuntu-latest"
platform_setup:
required: true
type: string
default: "non-embedded"
start_cmd:
required: false
test_path:
required: true
type: string
default: "fprime-gds"
gds_args:
runs_on:
required: false
type: string
dict_path:
default: "ubuntu-latest"
start_cmd:
required: false
type: string
test_path:
default: "fprime-gds"
gds_args:
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,17 +44,17 @@ 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
Expand All @@ -75,7 +72,7 @@ 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:
if: ${{ inputs.platform_setup == 'fsw-gds' }}
Expand All @@ -102,26 +99,25 @@ jobs:
- 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]
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 2e37a12

Please sign in to comment.