From 49f9e4436a817ded856e323aab93482e7b886760 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Wed, 15 May 2024 09:48:37 -0700 Subject: [PATCH 01/43] integration-test-2611 - Update Baremetal Reference to use Uart for uplink/downlink instead of through radio. Can still be switched back if needed. --- BaremetalReference/Main.cpp | 4 ++-- .../Top/BaremetalReferencePackets.xml | 2 ++ .../Top/BaremetalReferenceTopology.cpp | 7 +++++-- BaremetalReference/Top/instances.fpp | 7 +++++-- BaremetalReference/Top/topology.fpp | 17 +++++++++++------ 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/BaremetalReference/Main.cpp b/BaremetalReference/Main.cpp index 1900f194..efbe39eb 100644 --- a/BaremetalReference/Main.cpp +++ b/BaremetalReference/Main.cpp @@ -31,9 +31,9 @@ void setup() { // Setup Serial Serial.begin(115200); - Os::setArduinoStreamLogHandler(&Serial); + //Os::setArduinoStreamLogHandler(&Serial); //***Turn off for Uart Comm delay(1000); - Fw::Logger::logMsg("Program Started\n"); + //Fw::Logger::logMsg("Program Started\n"); //***Turn off for Uart Comm // Object for communicating state to the reference topology BaremetalReference::TopologyState inputs; diff --git a/BaremetalReference/Top/BaremetalReferencePackets.xml b/BaremetalReference/Top/BaremetalReferencePackets.xml index 32f9a14b..79cef256 100644 --- a/BaremetalReference/Top/BaremetalReferencePackets.xml +++ b/BaremetalReference/Top/BaremetalReferencePackets.xml @@ -57,12 +57,14 @@ + diff --git a/BaremetalReference/Top/BaremetalReferenceTopology.cpp b/BaremetalReference/Top/BaremetalReferenceTopology.cpp index 944c9b4c..041aa897 100644 --- a/BaremetalReference/Top/BaremetalReferenceTopology.cpp +++ b/BaremetalReference/Top/BaremetalReferenceTopology.cpp @@ -12,7 +12,7 @@ #include #include -#include +//#include //***Turn off for Uart Comm // Allows easy reference to objects in FPP/autocoder required namespaces using namespace BaremetalReference; @@ -102,7 +102,7 @@ void setupTopology(const TopologyState& state) { // Configure GPIO pins gpioDriver.open(Arduino::DEF_LED_BUILTIN, Arduino::GpioDriver::GpioDirection::OUT); - gpioRadioReset.open(Radio::RFM69_RST, Arduino::GpioDriver::GpioDirection::OUT); + //gpioRadioReset.open(Radio::RFM69_RST, Arduino::GpioDriver::GpioDirection::OUT); //***Turn off for Uart Comm // Configure I2C driver i2cDriver.open(&Wire); @@ -110,6 +110,9 @@ void setupTopology(const TopologyState& state) { // Configure IMU imu.setup(Sensors::IMU_MPU9250::I2cDevAddr::AD0_0); + // Configure StreamDriver / UART + comDriver.configure(&Serial); //***turn off if using radio + // Start hardware rate driver rateDriver.start(); } diff --git a/BaremetalReference/Top/instances.fpp b/BaremetalReference/Top/instances.fpp index ebd90a79..8e0b772c 100644 --- a/BaremetalReference/Top/instances.fpp +++ b/BaremetalReference/Top/instances.fpp @@ -73,8 +73,11 @@ module BaremetalReference { instance blinker: Components.LedBlinker base id 0x10000 - instance rfm69: Radio.RFM69 base id 0x10100 + #instance rfm69: Radio.RFM69 base id 0x10100 ###//Turn off for Uart Comm + instance rfm69: Svc.ComStub base id 0x10100 - instance imu: Sensors.IMU_MPU9250 base id 0x10200 + instance comDriver: Arduino.StreamDriver base id 0x10200 + + instance imu: Sensors.IMU_MPU9250 base id 0x10300 } diff --git a/BaremetalReference/Top/topology.fpp b/BaremetalReference/Top/topology.fpp index 263c4588..85edbadf 100644 --- a/BaremetalReference/Top/topology.fpp +++ b/BaremetalReference/Top/topology.fpp @@ -18,6 +18,7 @@ module BaremetalReference { instance blinker instance bufferManager instance cmdDisp + instance comDriver ## disable when using radio instance commQueue instance deframer instance eventLogger @@ -62,7 +63,7 @@ module BaremetalReference { # Rate group 1 rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1] -> rateGroup1.CycleIn - rateGroup1.RateGroupMemberOut[0] -> rfm69.run + rateGroup1.RateGroupMemberOut[0] -> comDriver.schedIn #rfm69.run rateGroup1.RateGroupMemberOut[1] -> blinker.run # Rate group 2 @@ -87,12 +88,17 @@ module BaremetalReference { framer.framedAllocate -> bufferManager.bufferGetCallee framer.framedOut -> rfm69.comDataIn - rfm69.deallocate -> bufferManager.bufferSendIn - + #rfm69.deallocate -> bufferManager.bufferSendIn ### //Turn off for Uart Comm + comDriver.deallocate -> bufferManager.bufferSendIn + comDriver.ready -> rfm69.drvConnected rfm69.comStatus -> commQueue.comStatusIn + rfm69.drvDataOut -> comDriver.$send # Uplink - rfm69.allocate -> bufferManager.bufferGetCallee + #rfm69.allocate -> bufferManager.bufferGetCallee + comDriver.$recv -> rfm69.drvDataIn + comDriver.allocate -> bufferManager.bufferGetCallee + rfm69.comDataOut -> deframer.framedIn deframer.framedDeallocate -> bufferManager.bufferSendIn @@ -101,7 +107,6 @@ module BaremetalReference { deframer.bufferAllocate -> bufferManager.bufferGetCallee deframer.bufferDeallocate -> bufferManager.bufferSendIn - } connections I2c { @@ -112,7 +117,7 @@ module BaremetalReference { connections BaremetalReference { # Add here connections to user-defined components blinker.gpioSet -> gpioDriver.gpioWrite - rfm69.gpioReset -> gpioRadioReset.gpioWrite + #rfm69.gpioReset -> gpioRadioReset.gpioWrite ### //Turn off for Uart Comm } } From 2218d00177e7c678e888738b3549200ac1d4b481 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 28 May 2024 13:12:08 -0700 Subject: [PATCH 02/43] integration-test-2611 - Add baremetal_ref_integration_test.py. --- .../int/baremetal_ref_integration_test.py | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 BaremetalReference/test/int/baremetal_ref_integration_test.py diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py new file mode 100644 index 00000000..14cebb97 --- /dev/null +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -0,0 +1,123 @@ +""" baremetal_ref_integration_test.py: + +A set of integration tests to apply to the Baremetal Ref app. This is intended to be a reference of integration testing. +""" +import subprocess +import time +from enum import Enum +from pathlib import Path + +from fprime_gds.common.testing_fw import predicates +from fprime_gds.common.utils.event_severity import EventSeverity + +def test_send_command(fprime_test_api): + """Test that commands can be sent + + Tests command send, dispatch, and receipt using a pair of NO_OP commands. + """ + result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP", max_delay=10.0) + + +def test_send_command_with_args(fprime_test_api): + """Test that commands with arguments can be sent + + Test command send, dispatch, and receipt using a pair of NO_OP_STRING commands. + """ + #result = fprime_test_api.send_and_assert_command('cmdDisp.CMD_NO_OP_STRING', ['hello'], max_delay=10.0) + result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP_STRING', ['hello']) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_and_assert_command('cmdDisp.CMD_NO_OP_STRING', ['hello'], max_delay=10.0) + +def test_telemetry_update(fprime_test_api): + """Test that telemetry updates + + Test sending 5 NO_OP commands and the cmdDisp.CommandsDispatched channel updates by 5. + """ + #result = fprime_test_api.send_and_await_telemetry('cmdDisp.CMD_NO_OP', channels = 'cmdDisp.CommandsDispatched') + result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') #have to send a no op to get chan to update to grab baseline value + result = fprime_test_api.await_telemetry('cmdDisp.CommandsDispatched') + + baselineVal = result.get_val() #await_telemetry() returns ChData and need to use the getter to get channel value. + cmdsCount = 5 + expectedVal = baselineVal + cmdsCount + + for i in range(cmdsCount): + result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') + result = fprime_test_api.await_telemetry('cmdDisp.CommandsDispatched', expectedVal) + +def test_event_filter(fprime_test_api): + """Test that events can be filtered by type + + 1. Verify BLINKING_ON_OFF command and all associated EVRs are sent / nominal. + 2. Send SET_EVENT_FILTER command to disable activity hi evrs. + 3. Send BLINKING_ON_OFF command and verify SetBlinkingState evr, which is an activity hi evr, is filtered. + 4. Re-enable activity hi evrs and send BLINKING_ON_OFF back to on, verify evr is no longer filtered. + """ + result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) + result = fprime_test_api.assert_event('SetBlinkingState', timeout = 3) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('eventLogger.SET_EVENT_FILTER', ['ACTIVITY_HI', 'DISABLED']) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['OFF']) + result = fprime_test_api.await_event_count(0, 'SetBlinkingState') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + #tear down steps. set EVR back to enable and LED back to on. + result = fprime_test_api.send_command('eventLogger.SET_EVENT_FILTER', ['ACTIVITY_HI', 'ENABLED']) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) + result = fprime_test_api.await_event_count(1, 'SetBlinkingState') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + +def test_id_filter(fprime_test_api): + """Test that event can be filtered by ID. + + 1. Verify BLINKING_ON_OFF command and all associated EVRs are sent / nominal. + 2. Send SET_ID_FILTER command to filter SetBlinkingState evr. + 3. Send BLINKING_ON_OFF command and verify SetBlinkingState evr is filtered. + 4. Attempt to remove SetBlinkState evr again and verify that the SET_ID_FILTER command fails because ID is not found. + 5. Remove SetBlinkState evr from the filter list and send BLINKING_ON_OFF back to on. + """ + result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) + result = fprime_test_api.assert_event('SetBlinkingState', timeout = 3) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x10001', 'ENABLED']) + result = fprime_test_api.assert_event('eventLogger.ID_FILTER_ENABLED', timeout = 3) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) + result = fprime_test_api.await_event_count(0, 'SetBlinkingState') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x10001', 'DISABLED']) + result = fprime_test_api.assert_event('eventLogger.ID_FILTER_REMOVED', timeout = 3) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') + time.sleep(3) + result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x100', 'DISABLED']) + result = fprime_test_api.assert_event('eventLogger.ID_FILTER_NOT_FOUND', timeout = 3) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeError') + time.sleep(3) + result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) + result = fprime_test_api.await_event_count(1, 'SetBlinkingState') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) + result = fprime_test_api.assert_event('OpCodeCompleted') From 1b3e0aa623fa3ee90316ce164faa8a5ecbdd603e Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 3 Jun 2024 09:47:55 -0700 Subject: [PATCH 03/43] integration-test-2611 - Update procedure in baremetal_ref_integration_test.py. - Update run-baremetal-reference.md with directions on how to run baremetal reference. --- .../int/baremetal_ref_integration_test.py | 19 ++++--- docs/run-baremetal-reference.md | 52 +++++++++++++++++++ 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py index 14cebb97..15025247 100644 --- a/BaremetalReference/test/int/baremetal_ref_integration_test.py +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -20,7 +20,9 @@ def test_send_command(fprime_test_api): result = fprime_test_api.assert_event('OpCodeCompleted') time.sleep(3) result = fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP", max_delay=10.0) - + #Note: send_and_assert_command has issues finding both displatched and completed EVRs. It can only find them if you + # send the same command twice. This is only an issue with baremetal due to not having a reference time and + # sclk from 0. Usage of send_command with assert_event has no issues and this test is an example of doing both. def test_send_command_with_args(fprime_test_api): """Test that commands with arguments can be sent @@ -32,12 +34,15 @@ def test_send_command_with_args(fprime_test_api): result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) result = fprime_test_api.assert_event('OpCodeCompleted') time.sleep(3) - result = fprime_test_api.send_and_assert_command('cmdDisp.CMD_NO_OP_STRING', ['hello'], max_delay=10.0) + result = fprime_test_api.send_and_assert_command('cmdDisp.CMD_NO_OP_STRING', ['hola'], max_delay=10.0) def test_telemetry_update(fprime_test_api): """Test that telemetry updates - Test sending 5 NO_OP commands and the cmdDisp.CommandsDispatched channel updates by 5. + Test telemetry update using CMD_NO_OP command and CommandsDispatched channel. + 1. Send CMD_NO_OP and capture current value of CommandsDispatched as baseline. + 2. Send 5 CMD_NO_OP commands. + 3. Verify channel CommandsDispatched is the baseline value +5. """ #result = fprime_test_api.send_and_await_telemetry('cmdDisp.CMD_NO_OP', channels = 'cmdDisp.CommandsDispatched') result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') #have to send a no op to get chan to update to grab baseline value @@ -54,6 +59,7 @@ def test_telemetry_update(fprime_test_api): def test_event_filter(fprime_test_api): """Test that events can be filtered by type + Test event filter with BLINKIING_ON_OFF command and associated activity hi EVR SetBlinkingState. 1. Verify BLINKING_ON_OFF command and all associated EVRs are sent / nominal. 2. Send SET_EVENT_FILTER command to disable activity hi evrs. 3. Send BLINKING_ON_OFF command and verify SetBlinkingState evr, which is an activity hi evr, is filtered. @@ -86,11 +92,12 @@ def test_event_filter(fprime_test_api): def test_id_filter(fprime_test_api): """Test that event can be filtered by ID. + Test ID filter with BLINKIING_ON_OFF command and associated activity hi EVR SetBlinkingState. 1. Verify BLINKING_ON_OFF command and all associated EVRs are sent / nominal. - 2. Send SET_ID_FILTER command to filter SetBlinkingState evr. - 3. Send BLINKING_ON_OFF command and verify SetBlinkingState evr is filtered. + 2. Send SET_ID_FILTER command to filter SetBlinkingState EVR. + 3. Send BLINKING_ON_OFF command and verify SetBlinkingState EVR is filtered. 4. Attempt to remove SetBlinkState evr again and verify that the SET_ID_FILTER command fails because ID is not found. - 5. Remove SetBlinkState evr from the filter list and send BLINKING_ON_OFF back to on. + 5. Remove SetBlinkState EVR from the filter list and send BLINKING_ON_OFF back to on. """ result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) result = fprime_test_api.assert_event('SetBlinkingState', timeout = 3) diff --git a/docs/run-baremetal-reference.md b/docs/run-baremetal-reference.md index 7ffe4578..5a28adf2 100644 --- a/docs/run-baremetal-reference.md +++ b/docs/run-baremetal-reference.md @@ -1,3 +1,55 @@ +# Programming and Running BaremetalReference Application in Serial Mode +Current BaremetalReference has been set to communicate by serial and without the radio. Radio can be re-enabled (currently commented out), see this [section](#programming-and-running-the-baremetalreference-and-radiopassthrough-applications) for instructions. + +## Uploading hex file for the Teensy +1. Use `fprime-util build` to make the hex file to load onto Teensy. + +Note: There are depencies that may need to be updated. Change file extension of this file from .pde to .ino: `fprime-baremetal-reference/lib/arduino/fprime-arduino/ATmega/vendor/libraries/TimerOne/examples/FanSpeed/FanSpeed.pde` +Without doing this during upload you will get the following message: +`Sketches with .pde extension are deprecated, please rename the following files to .ino` + +2. Have the Teensy connected to the computer and press the button the board to put it in the HalfKay bootloader mode. Board should now have a solid red led lit by the usb port. + +Note: Teensy has 2 different serial addresses, one for when programming is running and one for when the board is in HalfKay bootloader mode. Right now you will need the latter. To determine the address do one of two things (after putting the board in HalfKay bootloader mode): +- Use Arduino IDE. Under Tools -> Port, select port listed under teensy port. After this go to Tools tab again and now Port should print out the usb address similar to `usb:xxxxxxxx`. +- if on a Mac, About -> System Report. Look for USB Serial device. Manufacturer should be Teensyduino. Location id given is the address. + +3. Program the reference hex file: +``` +arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i /full_path/fprime-baremetal-reference/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex +``` + +Note: It has to be the full path to the BaremetalReference.hex file for arduino-cli. So no `./` + +4. While programming the red led will be brighter and then flash. Once done the board will get out of HalfKay bootloader mode (red led off) and run the BaremetalReference application. You should now see an orange flashing led by the button. + +## Using GDS via serial +1. Find the serial port, this varies by your host system but it should show up as a `/dev/tty*` device. On the mac, it's /dev/tty.usbmodem*(9 digit number). +2. Launch GDS: +``` +fprime-gds -n --dictionary ./build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 --uart-baud 115200 +``` +3. GDS should now launch in your browser. Connection should be good, you should see a green circle in the upper right by the warning hi, fatal, and GDS errors counter table. If connection is bad, instead of a green circle you would see a red X. + +## Running BaremetalReference integration tests +BaremetalReference comes with a set of integration tests. With board connecting and GDS running: +``` +pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ./build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml +``` +This will run through the test and give you results. With GDS up you can check the Events tab and see EVRs come in as the test runs. + +There are various options that you can try with pytest, see their documentation for more information. To run the test with a more verbose output, try options `-s` `-rP`. Both offer similar verbose outputs but `-s` outputs real time while `-rP` outputs at the end of testing and shows the beginning and end of tests. + +You can also run specific tests: +``` +pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ./build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -k 'test_id' +``` +This runs just the `test_id_filter` test. Note that this is string / pattern matching so you don't need to type in the full name. With this comes limitations: +``` +pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ./build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -k 'test_send_command' +``` +This runs both `test_send_command` and `test_send_command_args` because both tests satisfy the pattern. + # Programming and Running the BaremetalReference and RadioPassthrough Applications You will need two microcontrollers: one that will run the BaremetalReference and the other for the RadioPassthrough. The goal is to command the BaremetalReference deployment wirelessly from the RadioPassthrough deployment using a radio and fprime-gds. The BaremetalReference deployment is a reference of components that spacecrafts are expected to have, such as the LED blinker and radio components. From 55cae7035092c687b2b433fb3faee5b6ace65f8e Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 3 Jun 2024 13:28:09 -0700 Subject: [PATCH 04/43] integration-test-2611 - Integration test cleanup: remove commented out test code. --- BaremetalReference/test/int/baremetal_ref_integration_test.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py index 15025247..fe58ffac 100644 --- a/BaremetalReference/test/int/baremetal_ref_integration_test.py +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -29,7 +29,6 @@ def test_send_command_with_args(fprime_test_api): Test command send, dispatch, and receipt using a pair of NO_OP_STRING commands. """ - #result = fprime_test_api.send_and_assert_command('cmdDisp.CMD_NO_OP_STRING', ['hello'], max_delay=10.0) result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP_STRING', ['hello']) result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) result = fprime_test_api.assert_event('OpCodeCompleted') @@ -44,7 +43,6 @@ def test_telemetry_update(fprime_test_api): 2. Send 5 CMD_NO_OP commands. 3. Verify channel CommandsDispatched is the baseline value +5. """ - #result = fprime_test_api.send_and_await_telemetry('cmdDisp.CMD_NO_OP', channels = 'cmdDisp.CommandsDispatched') result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') #have to send a no op to get chan to update to grab baseline value result = fprime_test_api.await_telemetry('cmdDisp.CommandsDispatched') From 89afb8261ee790bbdbd0356255f2375b25a757aa Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 4 Jun 2024 09:38:08 -0700 Subject: [PATCH 05/43] integration-test-2611 - Update documentation for better way to find teensy port. --- docs/run-baremetal-reference.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/run-baremetal-reference.md b/docs/run-baremetal-reference.md index 5a28adf2..69e12366 100644 --- a/docs/run-baremetal-reference.md +++ b/docs/run-baremetal-reference.md @@ -10,7 +10,8 @@ Without doing this during upload you will get the following message: 2. Have the Teensy connected to the computer and press the button the board to put it in the HalfKay bootloader mode. Board should now have a solid red led lit by the usb port. -Note: Teensy has 2 different serial addresses, one for when programming is running and one for when the board is in HalfKay bootloader mode. Right now you will need the latter. To determine the address do one of two things (after putting the board in HalfKay bootloader mode): +Note: Teensy has 2 different serial addresses, one for when programming is running and one for when the board is in HalfKay bootloader mode. Right now you will need the latter. To determine the address do one of three things (after putting the board in HalfKay bootloader mode): +- Run command `arduino-cli board list`. Look for `usb:xxxxxxx` that should have protocol `teensy`. This also lists the fully qualified board name (FQBN) that we will use in the next step. - Use Arduino IDE. Under Tools -> Port, select port listed under teensy port. After this go to Tools tab again and now Port should print out the usb address similar to `usb:xxxxxxxx`. - if on a Mac, About -> System Report. Look for USB Serial device. Manufacturer should be Teensyduino. Location id given is the address. From 70b1ac2967a186dbded9bed4c9c7916d46248eea Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 6 Jun 2024 10:15:55 -0700 Subject: [PATCH 06/43] workflow-2612 - test commit. --- .github/workflows/learn-github-actions.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/learn-github-actions.yml diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml new file mode 100644 index 00000000..6e653cf4 --- /dev/null +++ b/.github/workflows/learn-github-actions.yml @@ -0,0 +1,13 @@ +name: learn-github-actions +run-name: ${{ github.actor }} is learning GitHub Actions +on: [push] +jobs: + check-bats-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm install -g bats + - run: bats -v From 5119deeb172175d7e1d9cdb08e1bce827282377d Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 6 Jun 2024 14:07:24 -0700 Subject: [PATCH 07/43] workflow-2612 - test. --- BaremetalReference/test/int/baremetal_ref_integration_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py index fe58ffac..97214577 100644 --- a/BaremetalReference/test/int/baremetal_ref_integration_test.py +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -101,7 +101,7 @@ def test_id_filter(fprime_test_api): result = fprime_test_api.assert_event('SetBlinkingState', timeout = 3) result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) result = fprime_test_api.assert_event('OpCodeCompleted') - time.sleep(3) + time.sleep(5) result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x10001', 'ENABLED']) result = fprime_test_api.assert_event('eventLogger.ID_FILTER_ENABLED', timeout = 3) result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) From e68e4178fbb9ee2f28fa7cdf580ba576cdc0fc61 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Fri, 7 Jun 2024 16:28:01 -0700 Subject: [PATCH 08/43] -test --- .github/workflows/learn-github-actions.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 6e653cf4..24757e23 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -11,3 +11,11 @@ jobs: node-version: '20' - run: npm install -g bats - run: bats -v + - name: "Overlay current F´ revision" + uses: actions/checkout@v4 + with: + submodules: true + path: ${{ inputs.fprime_location }} + - name: "install requirements.txt" + run: pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt + shell: bash From 79bfd81f9c385b441bea25454a1c5b8e212984a3 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 10:54:09 -0700 Subject: [PATCH 09/43] - test --- .github/workflows/learn-github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 24757e23..b85fd324 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is learning GitHub Actions on: [push] jobs: check-bats-version: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 840b3f267401b6370d4a603d41eec86e8bba309b Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 11:25:41 -0700 Subject: [PATCH 10/43] - self hosting test. --- .github/workflows/learn-github-actions.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index b85fd324..ebcf8ce2 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -2,20 +2,16 @@ name: learn-github-actions run-name: ${{ github.actor }} is learning GitHub Actions on: [push] jobs: - check-bats-version: + baremetal: runs-on: self-hosted steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20' - - run: npm install -g bats - - run: bats -v - - name: "Overlay current F´ revision" + - name: "Checkout F' Repository" uses: actions/checkout@v4 with: submodules: true path: ${{ inputs.fprime_location }} + - uses: ./fprime/.github/actions/setup - name: "install requirements.txt" run: pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt shell: bash From 031770dc5dda47d4e8c0fe1c80ed29f4407d1fe6 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 11:35:55 -0700 Subject: [PATCH 11/43] - self host test. --- .github/workflows/learn-github-actions.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index ebcf8ce2..4d8ffffe 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -12,6 +12,11 @@ jobs: submodules: true path: ${{ inputs.fprime_location }} - uses: ./fprime/.github/actions/setup - - name: "install requirements.txt" + - name: "Install requirements.txt" run: pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt shell: bash + - name: "Generate build cache" + working-direcotry: ${{ inputs.build_location}} + run: | + fprime-util generate ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }} + shell: bash From 70e709eb329a847bdd0628f2284c4315a6a6b80f Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 11:40:11 -0700 Subject: [PATCH 12/43] - testing 123. --- .github/workflows/learn-github-actions.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 4d8ffffe..365dc63c 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -2,7 +2,7 @@ name: learn-github-actions run-name: ${{ github.actor }} is learning GitHub Actions on: [push] jobs: - baremetal: + baremetal-int: runs-on: self-hosted steps: - uses: actions/checkout@v4 @@ -11,12 +11,16 @@ jobs: with: submodules: true path: ${{ inputs.fprime_location }} - - uses: ./fprime/.github/actions/setup - - name: "Install requirements.txt" - run: pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt + - name: "Build" + run: | + python3 -m venv ./fprime-venv + . ./fprime-venv/bin/activate + pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=. sh + git clone https://github.com/SterlingPeet/arduino-cli-cmake-wrapper.git + cd arduino-cli-cmake-wrapper + git checkout update/refactor + pip install . + cd .. + fprime-util generate shell: bash - - name: "Generate build cache" - working-direcotry: ${{ inputs.build_location}} - run: | - fprime-util generate ${{ runner.debug == '1' && '--verbose' || '' }} ${{ inputs.target_platform }} - shell: bash From 896218540ad9c6445c10919aa74040fafa3d4dbc Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 12:43:54 -0700 Subject: [PATCH 13/43] - build time. --- .github/workflows/learn-github-actions.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 365dc63c..f197f86a 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -23,4 +23,5 @@ jobs: pip install . cd .. fprime-util generate + fprime-util build shell: bash From 293fbd74785e4b241e85206546fe45a6b839698b Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 13:06:04 -0700 Subject: [PATCH 14/43] - burn. --- .github/workflows/learn-github-actions.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index f197f86a..50ebf8a0 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -25,3 +25,7 @@ jobs: fprime-util generate fprime-util build shell: bash + - name: "Burn" + run: | + arduino-cli upload --fqbn teensy:avr:teensy:41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex + shell: bash From bb0f56919c6ad04b6d25ed73fc39ebe75e1e5faa Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 11 Jun 2024 13:44:12 -0700 Subject: [PATCH 15/43] - add temp step to rename pde to ino. --- .github/workflows/learn-github-actions.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 50ebf8a0..73f5e507 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -25,7 +25,12 @@ jobs: fprime-util generate fprime-util build shell: bash + - 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 + shell: bash - name: "Burn" run: | - arduino-cli upload --fqbn teensy:avr:teensy:41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex + arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex shell: bash From 44977c4d8be276cfce0a3fefa7d8fecc0db2e6a5 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 13 Jun 2024 08:03:28 -0700 Subject: [PATCH 16/43] - start gds --- .github/workflows/learn-github-actions.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 73f5e507..65470b66 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -25,7 +25,7 @@ jobs: fprime-util generate fprime-util build shell: bash - - name: "Temp step, file renaming " + - 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 @@ -34,3 +34,6 @@ jobs: run: | arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex shell: bash + - name: "Start GDS" + run: fprime-gds -n --dictionary ./build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 & + shell: bash From 3b66681f2b6163d082800028a970e02eb9cb7917 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 13 Jun 2024 09:11:22 -0700 Subject: [PATCH 17/43] - run fit. --- .github/workflows/learn-github-actions.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 65470b66..ed53edb2 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -35,5 +35,9 @@ jobs: arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex shell: bash - name: "Start GDS" - run: fprime-gds -n --dictionary ./build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 & + run: fprime-gds -n --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 & shell: bash + - name: "Run Integration tests" + run: | + sleep 10 + pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -rP From 16571e28c2fae01810e14818b1ae8bc6a8f7556a Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 13 Jun 2024 10:50:42 -0700 Subject: [PATCH 18/43] - int --- BaremetalReference/test/int/baremetal_ref_integration_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py index 97214577..910fd111 100644 --- a/BaremetalReference/test/int/baremetal_ref_integration_test.py +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -53,6 +53,7 @@ def test_telemetry_update(fprime_test_api): for i in range(cmdsCount): result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') result = fprime_test_api.await_telemetry('cmdDisp.CommandsDispatched', expectedVal) + assert 3==6 def test_event_filter(fprime_test_api): """Test that events can be filtered by type From 589ab2fcd301e3696893604e8bec03da302b1acb Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 17 Jun 2024 09:32:35 -0700 Subject: [PATCH 19/43] integration-test-2611 - Update test_telemetry_update test to use assert_telemetry for final verification. --- BaremetalReference/test/int/baremetal_ref_integration_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py index fe58ffac..f1880224 100644 --- a/BaremetalReference/test/int/baremetal_ref_integration_test.py +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -52,7 +52,8 @@ def test_telemetry_update(fprime_test_api): for i in range(cmdsCount): result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') - result = fprime_test_api.await_telemetry('cmdDisp.CommandsDispatched', expectedVal) + time.sleep(3) + result = fprime_test_api.assert_telemetry('cmdDisp.CommandsDispatched', expectedVal, timeout = 5) def test_event_filter(fprime_test_api): """Test that events can be filtered by type From 95018ca56621604c3ef210770e2b2673ab6828e2 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 18 Jun 2024 09:08:20 -0700 Subject: [PATCH 20/43] integration-test-2611 PR updates: - re-enable logger but on Serial1. - Topology cleanup. Cleaner Serial Comm with Radio Comm separate. --- BaremetalReference/Main.cpp | 7 +++-- BaremetalReference/Top/topology.fpp | 43 +++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/BaremetalReference/Main.cpp b/BaremetalReference/Main.cpp index efbe39eb..165815be 100644 --- a/BaremetalReference/Main.cpp +++ b/BaremetalReference/Main.cpp @@ -30,10 +30,11 @@ Os::TaskRunner taskrunner; void setup() { // Setup Serial - Serial.begin(115200); - //Os::setArduinoStreamLogHandler(&Serial); //***Turn off for Uart Comm + Serial.begin(115200); //Uart Comm + Serial1.begin(115200); //logging + Os::setArduinoStreamLogHandler(&Serial1); delay(1000); - //Fw::Logger::logMsg("Program Started\n"); //***Turn off for Uart Comm + Fw::Logger::logMsg("Program Started\n"); // Object for communicating state to the reference topology BaremetalReference::TopologyState inputs; diff --git a/BaremetalReference/Top/topology.fpp b/BaremetalReference/Top/topology.fpp index 85edbadf..93941779 100644 --- a/BaremetalReference/Top/topology.fpp +++ b/BaremetalReference/Top/topology.fpp @@ -78,28 +78,21 @@ module BaremetalReference { eventLogger.FatalAnnounce -> fatalHandler.FatalReceive } - connections Comms { + connections SerialComms { # Downlink - tlmSend.PktSend -> commQueue.comQueueIn[0] - eventLogger.PktSend -> commQueue.comQueueIn[1] - commQueue.comQueueSend -> framer.comIn + tlmSend.PktSend -> framer.comIn + eventLogger.PktSend -> framer.comIn framer.framedAllocate -> bufferManager.bufferGetCallee - framer.framedOut -> rfm69.comDataIn - #rfm69.deallocate -> bufferManager.bufferSendIn ### //Turn off for Uart Comm + framer.framedOut -> comDriver.$send comDriver.deallocate -> bufferManager.bufferSendIn - comDriver.ready -> rfm69.drvConnected - rfm69.comStatus -> commQueue.comStatusIn - rfm69.drvDataOut -> comDriver.$send # Uplink - #rfm69.allocate -> bufferManager.bufferGetCallee - comDriver.$recv -> rfm69.drvDataIn + comDriver.$recv ->deframer.framedIn comDriver.allocate -> bufferManager.bufferGetCallee - rfm69.comDataOut -> deframer.framedIn deframer.framedDeallocate -> bufferManager.bufferSendIn deframer.comOut -> cmdDisp.seqCmdBuff @@ -109,6 +102,32 @@ module BaremetalReference { deframer.bufferDeallocate -> bufferManager.bufferSendIn } + #Uncomment RadioComms and comment SerialComms to swap to radio + #connections RadioComms { + # Downlink + #tlmSend.PktSend -> commQueue.comQueueIn[0] + #eventLogger.PktSend -> commQueue.comQueueIn[1] + + #commQueue.comQueueSend -> framer.comIn + + #framer.framedAllocate -> bufferManager.bufferGetCallee + #framer.framedOut -> rfm69.comDataIn + #rfm69.deallocate -> bufferManager.bufferSendIn + + #rfm69.comStatus -> commQueue.comStatusIn + + # Uplink + #rfm69.allocate -> bufferManager.bufferGetCallee + #rfm69.comDataOut -> deframer.framedIn + #deframer.framedDeallocate -> bufferManager.bufferSendIn + + #deframer.comOut -> cmdDisp.seqCmdBuff + #cmdDisp.seqCmdStatus -> deframer.cmdResponseIn + + #deframer.bufferAllocate -> bufferManager.bufferGetCallee + #deframer.bufferDeallocate -> bufferManager.bufferSendIn + #} + connections I2c { imu.read -> i2cDriver.read imu.write -> i2cDriver.write From a044bed4fcd469c6cd6e5740c423c4deb88ab725 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Tue, 18 Jun 2024 10:31:42 -0700 Subject: [PATCH 21/43] integration-test-2611 - Further topology instance cleanup, remove rfm69 instance that use ComStub. --- BaremetalReference/Top/instances.fpp | 1 - BaremetalReference/Top/topology.fpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/BaremetalReference/Top/instances.fpp b/BaremetalReference/Top/instances.fpp index 8e0b772c..3d377ade 100644 --- a/BaremetalReference/Top/instances.fpp +++ b/BaremetalReference/Top/instances.fpp @@ -74,7 +74,6 @@ module BaremetalReference { instance blinker: Components.LedBlinker base id 0x10000 #instance rfm69: Radio.RFM69 base id 0x10100 ###//Turn off for Uart Comm - instance rfm69: Svc.ComStub base id 0x10100 instance comDriver: Arduino.StreamDriver base id 0x10200 diff --git a/BaremetalReference/Top/topology.fpp b/BaremetalReference/Top/topology.fpp index 93941779..0fb5d4d8 100644 --- a/BaremetalReference/Top/topology.fpp +++ b/BaremetalReference/Top/topology.fpp @@ -33,7 +33,7 @@ module BaremetalReference { instance rateGroup1 instance rateGroup2 instance rateGroupDriver - instance rfm69 + #instance rfm69 ## enable when using radio instance systemResources instance systemTime instance textLogger From 4e66ad556791d8d5e52ecd30d5498ee4e6110ba5 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 24 Jun 2024 13:29:28 -0700 Subject: [PATCH 22/43] - workflow test. --- .github/workflows/learn-github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index ed53edb2..92894966 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -35,7 +35,7 @@ jobs: arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex shell: bash - name: "Start GDS" - run: fprime-gds -n --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 & + run: fprime-gds -n --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --gui none --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 & shell: bash - name: "Run Integration tests" run: | From 10f4abc02a82fb2ff0a2bfa5a0ad3d3ca720c264 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Wed, 26 Jun 2024 16:16:03 -0700 Subject: [PATCH 23/43] - add test artifacts. --- .github/workflows/learn-github-actions.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/learn-github-actions.yml index 92894966..f0a5d4ba 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/learn-github-actions.yml @@ -40,4 +40,5 @@ jobs: - name: "Run Integration tests" run: | sleep 10 - pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -rP + pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -rP | tee ../test_artifacts/test_run_$(date '+%Y-%m-%d-%H-%M').txt + From 2232ebf5b3d7dd18587ea93c9f46f2e928b7c674 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Wed, 3 Jul 2024 08:59:46 -0700 Subject: [PATCH 24/43] workflow-2612 - rename workflow file to baremetal_ci.yml. --- .../{learn-github-actions.yml => baremetal_ci.yml} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{learn-github-actions.yml => baremetal_ci.yml} (91%) diff --git a/.github/workflows/learn-github-actions.yml b/.github/workflows/baremetal_ci.yml similarity index 91% rename from .github/workflows/learn-github-actions.yml rename to .github/workflows/baremetal_ci.yml index f0a5d4ba..85966b88 100644 --- a/.github/workflows/learn-github-actions.yml +++ b/.github/workflows/baremetal_ci.yml @@ -1,5 +1,5 @@ -name: learn-github-actions -run-name: ${{ github.actor }} is learning GitHub Actions +name: baremetal-ci-actions +run-name: ${{ github.actor }} running Baremetal CI actions on: [push] jobs: baremetal-int: @@ -39,6 +39,6 @@ jobs: shell: bash - name: "Run Integration tests" run: | - sleep 10 - pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -rP | tee ../test_artifacts/test_run_$(date '+%Y-%m-%d-%H-%M').txt + sleep 13 + pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -rP | tee ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt From 607d4cd1a1eb0086f8f0abead0c64c3ef66eaf1e Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 8 Jul 2024 15:34:11 -0700 Subject: [PATCH 25/43] workflow-2612 - Split single job into multiple. --- .github/workflows/baremetal_ci.yml | 36 +++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index 85966b88..7c49c72d 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -1,8 +1,16 @@ name: baremetal-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions on: [push] + +env: + baremetal-bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex + baremetal-dict: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml + upload-addr: usb:3120000 + serial-gds-args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 + log-path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt + jobs: - baremetal-int: + build: runs-on: self-hosted steps: - uses: actions/checkout@v4 @@ -24,21 +32,27 @@ jobs: cd .. fprime-util generate fprime-util build - shell: bash - 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 - shell: bash - - name: "Burn" - run: | - arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex - shell: bash + upload: + runs-on: self-hosted + needs: build + steps: + - name: "Load FSW onto Teensy41" + run: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload-addr }} -i ${{ env.baremetal-bin }} + gds: + runs-on: self-hosted + needs: [build, upload] + steps: - name: "Start GDS" - run: fprime-gds -n --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml --gui none --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 & - shell: bash + run: fprime-gds -n --dictionary ${{ env.baremetal-dict }} --gui none ${{ env.serial-gds-args }} & + fit: + runs-on: self-hosted + needs: [build, upload, gds] + steps: - name: "Run Integration tests" run: | sleep 13 - pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml -rP | tee ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt - + pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ env.baremetal-dict }} -rP | tee ${{ env.log-path }} From 2de20a3b5ee285316397dc28ce82abc12f13785d Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 11 Jul 2024 07:53:41 -0700 Subject: [PATCH 26/43] workflow-2612 - Add turn on temp_ci to test reusable workflow. --- .github/workflows/baremetal_ci.yml | 2 +- .github/workflows/reusable_fit.yml | 57 ++++++++++++++++++++++++++++++ .github/workflows/temp_ci.yml | 28 +++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/reusable_fit.yml create mode 100644 .github/workflows/temp_ci.yml diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index 7c49c72d..f3524d8b 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -1,6 +1,6 @@ name: baremetal-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -on: [push] +#on: [push] env: baremetal-bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml new file mode 100644 index 00000000..74f1c38d --- /dev/null +++ b/.github/workflows/reusable_fit.yml @@ -0,0 +1,57 @@ +name: resuable-fit + +on: + workflow_call: + inputs: + runs_on: + required: false + type: string + default: "ubuntu-latest" + gds_args: + required: true + type: string + log_path: + required: true + type: string + dict_path: + required: true + type: string + start_cmd: + required: false + type: string + default: "start fsw cmd" + fsw_first: + required: false + type: boolean + default: true +jobs: +# Either jobs below gets run before starting FIT: fsw-gds (start FSW first and then GDS) or gds-fsw (start GDS first and then FSW) + fsw-gds: + if: ${{ inputs.fsw_first }} + runs-on: ${{ inputs.runs_on}} + steps: + - name: "Start FSW" + run: echo ${{ inputs.start_cmd }} + - name: "Start GDS" + run: | + echo ${{ inputs.gds_args }} + sleep 10 + gds-fsw: + if: ${{ inputs.fsw_first == false }} + runs-on: ${{ inputs.runs_on }} + steps: + - name: "Start GDS" + run: echo ${{ inputs.gds_args }} + - name: "Start FSW" + run: | + echo ${{ inputs.start_cmd }} + sleep 10 + + fit: + runs-on: ${{ inputs.runs_on }} + if: ${{ always() }} + needs: [fsw-gds, gds-fsw] + steps: + - name: "Run Integration tests" + run: | + echo ${{ inputs.dict-path }} ${{ inputs.log_path }} diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml new file mode 100644 index 00000000..011efdb4 --- /dev/null +++ b/.github/workflows/temp_ci.yml @@ -0,0 +1,28 @@ +name: temp-ci-actions +run-name: ${{ github.actor }} running Baremetal CI actions +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: "Checkout F' Repository" + uses: actions/checkout@v4 + with: + submodules: true + path: ${{ inputs.fprime_location }} + - name: "Build" + run: | + echo "hello" + + fit: + needs: [build] + uses: ./.github/workflows/reusable_fit.yml + with: + runs_on: ubuntu-latest + start_cmd: "arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex" + gds_args: "--comm-adapter uart --uart-device /dev/tty.usbmodem159910601" + log_path: "../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt" + dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml + fsw_first: false \ No newline at end of file From 390eff99654172fe46bcb5467cf7aa6e0419e3ff Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 15 Jul 2024 08:49:48 -0700 Subject: [PATCH 27/43] workflow-2612 - add non embedded option in reusable_fit. --- .github/workflows/baremetal_ci.yml | 5 +--- .github/workflows/reusable_fit.yml | 47 +++++++++++++++++++++--------- .github/workflows/temp_ci.yml | 6 ++-- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index f3524d8b..eb4229bc 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -3,9 +3,7 @@ run-name: ${{ github.actor }} running Baremetal CI actions #on: [push] env: - baremetal-bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex baremetal-dict: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml - upload-addr: usb:3120000 serial-gds-args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 log-path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt @@ -41,7 +39,7 @@ jobs: needs: build steps: - name: "Load FSW onto Teensy41" - run: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload-addr }} -i ${{ env.baremetal-bin }} + run: arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex gds: runs-on: self-hosted needs: [build, upload] @@ -54,5 +52,4 @@ jobs: steps: - name: "Run Integration tests" run: | - sleep 13 pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ env.baremetal-dict }} -rP | tee ${{ env.log-path }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index 74f1c38d..9d818c36 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -7,28 +7,49 @@ on: required: false type: string default: "ubuntu-latest" - gds_args: - required: true - type: string log_path: required: true type: string - dict_path: + non_embedded: required: true - type: string + type: boolean + # following are labelled as not required but are needed if non_embedded is false + fsw_first: + required: false + type: boolean + default: true start_cmd: required: false type: string default: "start fsw cmd" - fsw_first: + gds_args: required: false - type: boolean - default: true + type: string + dict_path: + required: false + type: string + jobs: -# Either jobs below gets run before starting FIT: fsw-gds (start FSW first and then GDS) or gds-fsw (start GDS first and then FSW) +# Following 3 jobs are on a switch, only one will run based on 2 conditionals: non_embedded and fsw_first. +# job 1 start fsw gds together: if non_embedded is true. +# job 2 start fsw first and then gds: if not non_embedded and fsw_first is true +# job 3 start gds and then fsw: if not non_embedded and not fsw_first +# after one of these 3 jobs run, fit job will run. +# +# / non-embedded \ +# build --->| fsw-gds |---> fit +# \ gds-fsw / + + non-embedded: + if: ${{ inputs.non_embedded }} + runs-on: ${{ inputs.runs_on }} + steps: + - name: "Start FSW and GDS" + run: echo ${{ inputs.start_cmd }} + fsw-gds: - if: ${{ inputs.fsw_first }} - runs-on: ${{ inputs.runs_on}} + if: ${{ !inputs.non_embedded && inputs.fsw_first }} + runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW" run: echo ${{ inputs.start_cmd }} @@ -37,7 +58,7 @@ jobs: echo ${{ inputs.gds_args }} sleep 10 gds-fsw: - if: ${{ inputs.fsw_first == false }} + if: ${{ !inputs.non_embedded && !inputs.fsw_first }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start GDS" @@ -50,7 +71,7 @@ jobs: fit: runs-on: ${{ inputs.runs_on }} if: ${{ always() }} - needs: [fsw-gds, gds-fsw] + needs: [non-embedded, fsw-gds, gds-fsw] steps: - name: "Run Integration tests" run: | diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml index 011efdb4..ddc9cf9f 100644 --- a/.github/workflows/temp_ci.yml +++ b/.github/workflows/temp_ci.yml @@ -21,8 +21,10 @@ jobs: uses: ./.github/workflows/reusable_fit.yml with: runs_on: ubuntu-latest + log_path: "../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt" + non_embedded: false + fsw_first: true start_cmd: "arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex" gds_args: "--comm-adapter uart --uart-device /dev/tty.usbmodem159910601" - log_path: "../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt" dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml - fsw_first: false \ No newline at end of file + From 3e0a5768965a70a2b9910543c542a6b8ae6a6b68 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 15 Jul 2024 15:41:17 -0700 Subject: [PATCH 28/43] workflow-2612 - Update env variables and make them passable to reusable workflow. - Turn baremetal_ci back on and turn off temp_ci. --- .github/workflows/baremetal_ci.yml | 49 ++++++++++++++++-------------- .github/workflows/reusable_fit.yml | 30 ++++++++++-------- .github/workflows/temp_ci.yml | 36 ++++++++++++++++------ 3 files changed, 71 insertions(+), 44 deletions(-) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index eb4229bc..f41c3f26 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -1,15 +1,25 @@ name: baremetal-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -#on: [push] +on: [push] env: - baremetal-dict: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml - serial-gds-args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 - log-path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt + baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex + upload_addr: usb:3120000 + gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 + log_path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt + dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml + test_path: BaremetalReference/test/int/baremetal_ref_integration_test.py jobs: + build: runs-on: self-hosted + outputs: + log_path: ${{ env.log_path }} + start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} + gds_args: ${{ env.gds_args }} + dict_path: ${{ env.dict_path }} + test_path: ${{ env.test_path }} steps: - uses: actions/checkout@v4 - name: "Checkout F' Repository" @@ -34,22 +44,17 @@ jobs: 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 - upload: - runs-on: self-hosted - needs: build - steps: - - name: "Load FSW onto Teensy41" - run: arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex - gds: - runs-on: self-hosted - needs: [build, upload] - steps: - - name: "Start GDS" - run: fprime-gds -n --dictionary ${{ env.baremetal-dict }} --gui none ${{ env.serial-gds-args }} & + - run: echo "Expose env vars for reusable workflow." + fit: - runs-on: self-hosted - needs: [build, upload, gds] - steps: - - name: "Run Integration tests" - run: | - pytest BaremetalReference/test/int/baremetal_ref_integration_test.py --dictionary ${{ env.baremetal-dict }} -rP | tee ${{ env.log-path }} + needs: build + uses: ./.github/workflows/reusable_fit.yml + with: + runs_on: self-hosted + log_path: ${{ needs.build.outputs.log_path }} + non_embedded: false + fsw_first: true + 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 }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index 9d818c36..c7f2a37c 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -21,13 +21,16 @@ on: start_cmd: required: false type: string - default: "start fsw cmd" + default: "fprime-gds" gds_args: required: false type: string dict_path: required: false type: string + test_path: + required: false + type: string jobs: # Following 3 jobs are on a switch, only one will run based on 2 conditionals: non_embedded and fsw_first. @@ -45,34 +48,35 @@ jobs: runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW and GDS" - run: echo ${{ inputs.start_cmd }} + run: ${{ inputs.start_cmd }} + - name: "Run Integration tests" + run: | + pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} fsw-gds: if: ${{ !inputs.non_embedded && inputs.fsw_first }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW" - run: echo ${{ inputs.start_cmd }} + run: ${{ inputs.start_cmd }} - name: "Start GDS" run: | - echo ${{ inputs.gds_args }} + fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & sleep 10 + - name: "Run Integration tests" + run: | + pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + gds-fsw: if: ${{ !inputs.non_embedded && !inputs.fsw_first }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start GDS" - run: echo ${{ inputs.gds_args }} + run: fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & - name: "Start FSW" run: | - echo ${{ inputs.start_cmd }} + ${{ inputs.start_cmd }} sleep 10 - - fit: - runs-on: ${{ inputs.runs_on }} - if: ${{ always() }} - needs: [non-embedded, fsw-gds, gds-fsw] - steps: - name: "Run Integration tests" run: | - echo ${{ inputs.dict-path }} ${{ inputs.log_path }} + pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml index ddc9cf9f..925e6d10 100644 --- a/.github/workflows/temp_ci.yml +++ b/.github/workflows/temp_ci.yml @@ -1,8 +1,27 @@ name: temp-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -on: [push] +#on: [push] + +env: + baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex + upload_addr: usb:3120000 + gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 + log_path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt + dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml + test_path: BaremetalReference/test/int/baremetal_ref_integration_test.py jobs: + vars: + runs-on: ubuntu-latest + outputs: + log_path: ${{ env.log_path }} + start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} + gds_args: ${{ env.gds_args }} + dict_path: ${{ env.dict_path }} + test_path: ${{ env.test_path }} + steps: + - run: echo "Expose env vars for reusable workflow." + build: runs-on: ubuntu-latest steps: @@ -13,18 +32,17 @@ jobs: submodules: true path: ${{ inputs.fprime_location }} - name: "Build" - run: | - echo "hello" + run: echo ${{ github.workspace }} fit: - needs: [build] + needs: [build, vars] uses: ./.github/workflows/reusable_fit.yml with: runs_on: ubuntu-latest - log_path: "../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt" + log_path: ${{ needs.vars.outputs.log_path }} non_embedded: false fsw_first: true - start_cmd: "arduino-cli upload --fqbn teensy:avr:teensy41 -p usb:3120000 -i ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex" - gds_args: "--comm-adapter uart --uart-device /dev/tty.usbmodem159910601" - dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml - + start_cmd: ${{ needs.vars.outputs.start_cmd }} + gds_args: ${{ needs.vars.outputs.gds_args }} + dict_path: ${{ needs.vars.outputs.dict_path }} + test_path: ${{ needs.vars.outputs.test_path }} From 39812cfb2b93aaf1f7843ea7ba73b8a5dddd3b9b Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 18 Jul 2024 11:35:48 -0700 Subject: [PATCH 29/43] workflow-2612 - testing out composite action to reduce duplication of fit step in the reusable workflow. --- .github/actions/fit_composite_action.yml | 15 +++++++++++++++ .github/workflows/reusable_fit.yml | 18 ++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/actions/fit_composite_action.yml diff --git a/.github/actions/fit_composite_action.yml b/.github/actions/fit_composite_action.yml new file mode 100644 index 00000000..c76d50f3 --- /dev/null +++ b/.github/actions/fit_composite_action.yml @@ -0,0 +1,15 @@ +name: 'FIT composite action' + +inputs: + dict_path: + description: 'FSW dictionary path' + required: true + log_path: + description: 'output log path for FIT run' + required: true + +runs: + using: "composite" + steps: + - name: "Run Integration tests" + run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index c7f2a37c..3e650d25 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -63,9 +63,14 @@ jobs: run: | fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & sleep 10 + - uses: actions/checkout@v4 - name: "Run Integration tests" - run: | - pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + uses: ./.github/actions/fit_composite_action.yml + with: + dict_path: ${{ inputs.dict_path }} + log_path: ${{ inputs.log_path }} + #run: ${{ github.action_path }} + # pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} gds-fsw: if: ${{ !inputs.non_embedded && !inputs.fsw_first }} @@ -80,3 +85,12 @@ jobs: - name: "Run Integration tests" run: | pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + +# fit: +# runs-on: ${{ inputs.runs_on }} +# if: ${{ always() }} +# needs: [non-embedded, fsw-gds, gds-fsw] +# steps: +# - name: "Run Integration tests" +# run: | +# pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} From a16ab3edd2ca316c28af9050c7b4c8949accc7cb Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 18 Jul 2024 15:11:53 -0700 Subject: [PATCH 30/43] workflow-2612 - Undo composite action. --- .github/actions/fit_composite_action.yml | 15 --------------- .github/workflows/reusable_fit.yml | 18 ++++++------------ 2 files changed, 6 insertions(+), 27 deletions(-) delete mode 100644 .github/actions/fit_composite_action.yml diff --git a/.github/actions/fit_composite_action.yml b/.github/actions/fit_composite_action.yml deleted file mode 100644 index c76d50f3..00000000 --- a/.github/actions/fit_composite_action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'FIT composite action' - -inputs: - dict_path: - description: 'FSW dictionary path' - required: true - log_path: - description: 'output log path for FIT run' - required: true - -runs: - using: "composite" - steps: - - name: "Run Integration tests" - run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index 3e650d25..dbc2d1d4 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -37,7 +37,7 @@ jobs: # job 1 start fsw gds together: if non_embedded is true. # job 2 start fsw first and then gds: if not non_embedded and fsw_first is true # job 3 start gds and then fsw: if not non_embedded and not fsw_first -# after one of these 3 jobs run, fit job will run. +# after one of these 3 jobs run, fit job step will run. # # / non-embedded \ # build --->| fsw-gds |---> fit @@ -51,6 +51,7 @@ jobs: run: ${{ inputs.start_cmd }} - name: "Run Integration tests" run: | + sleep 12 pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} fsw-gds: @@ -62,15 +63,9 @@ jobs: - name: "Start GDS" run: | fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & - sleep 10 - - uses: actions/checkout@v4 + sleep 12 - name: "Run Integration tests" - uses: ./.github/actions/fit_composite_action.yml - with: - dict_path: ${{ inputs.dict_path }} - log_path: ${{ inputs.log_path }} - #run: ${{ github.action_path }} - # pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} gds-fsw: if: ${{ !inputs.non_embedded && !inputs.fsw_first }} @@ -81,10 +76,9 @@ jobs: - name: "Start FSW" run: | ${{ inputs.start_cmd }} - sleep 10 + sleep 12 - name: "Run Integration tests" - run: | - pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} # fit: # runs-on: ${{ inputs.runs_on }} From 929c62bd2373b68cf0c5f54368221ad6a4fae76f Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Wed, 24 Jul 2024 16:03:51 -0700 Subject: [PATCH 31/43] workflow-2612 - Update resuable workflow to be cleaner, single env to select resource_type job instead of 2 booleans. --- .github/workflows/baremetal_ci.yml | 8 +++----- .github/workflows/reusable_fit.yml | 25 +++++++++---------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index f41c3f26..ca3782b4 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -3,10 +3,10 @@ run-name: ${{ github.actor }} running Baremetal CI actions on: [push] env: + resource_type: "fsw-gds" baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex upload_addr: usb:3120000 gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 - log_path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml test_path: BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -15,7 +15,7 @@ jobs: build: runs-on: self-hosted outputs: - log_path: ${{ env.log_path }} + resource_type: ${{ env.resource_type }} start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} gds_args: ${{ env.gds_args }} dict_path: ${{ env.dict_path }} @@ -51,9 +51,7 @@ jobs: uses: ./.github/workflows/reusable_fit.yml with: runs_on: self-hosted - log_path: ${{ needs.build.outputs.log_path }} - non_embedded: false - fsw_first: true + resource_type: ${{ needs.build.outputs.resource_type }} start_cmd: ${{ needs.build.outputs.start_cmd }} gds_args: ${{ needs.build.outputs.gds_args }} dict_path: ${{ needs.build.outputs.dict_path }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index dbc2d1d4..4809cd71 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -7,17 +7,10 @@ on: required: false type: string default: "ubuntu-latest" - log_path: + resource_type: required: true type: string - non_embedded: - required: true - type: boolean - # following are labelled as not required but are needed if non_embedded is false - fsw_first: - required: false - type: boolean - default: true + default: "non_embedded" start_cmd: required: false type: string @@ -44,7 +37,7 @@ jobs: # \ gds-fsw / non-embedded: - if: ${{ inputs.non_embedded }} + if: ${{ inputs.resource_type == 'non-embedded' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW and GDS" @@ -52,10 +45,10 @@ jobs: - name: "Run Integration tests" run: | sleep 12 - pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP fsw-gds: - if: ${{ !inputs.non_embedded && inputs.fsw_first }} + if: ${{ inputs.resource_type == 'fsw-gds' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW" @@ -65,10 +58,10 @@ jobs: fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & sleep 12 - name: "Run Integration tests" - run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP gds-fsw: - if: ${{ !inputs.non_embedded && !inputs.fsw_first }} + if: ${{ inputs.resource_type == 'gds-fsw' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start GDS" @@ -78,7 +71,7 @@ jobs: ${{ inputs.start_cmd }} sleep 12 - name: "Run Integration tests" - run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} + run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP # fit: # runs-on: ${{ inputs.runs_on }} @@ -87,4 +80,4 @@ jobs: # steps: # - name: "Run Integration tests" # run: | -# pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP | tee ${{ inputs.log_path }} +# pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP From d51ade46a3c299fda632d955b325865ec16c1338 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Wed, 24 Jul 2024 16:25:37 -0700 Subject: [PATCH 32/43] workflow-2612 - Add timeouts to FIT test to be more robust less false positive failures when running CI. --- .../int/baremetal_ref_integration_test.py | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/BaremetalReference/test/int/baremetal_ref_integration_test.py b/BaremetalReference/test/int/baremetal_ref_integration_test.py index f1880224..971fd289 100644 --- a/BaremetalReference/test/int/baremetal_ref_integration_test.py +++ b/BaremetalReference/test/int/baremetal_ref_integration_test.py @@ -16,8 +16,8 @@ def test_send_command(fprime_test_api): Tests command send, dispatch, and receipt using a pair of NO_OP commands. """ result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP') - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP", max_delay=10.0) #Note: send_and_assert_command has issues finding both displatched and completed EVRs. It can only find them if you @@ -30,8 +30,8 @@ def test_send_command_with_args(fprime_test_api): Test command send, dispatch, and receipt using a pair of NO_OP_STRING commands. """ result = fprime_test_api.send_command('cmdDisp.CMD_NO_OP_STRING', ['hello']) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_and_assert_command('cmdDisp.CMD_NO_OP_STRING', ['hola'], max_delay=10.0) @@ -65,28 +65,28 @@ def test_event_filter(fprime_test_api): 4. Re-enable activity hi evrs and send BLINKING_ON_OFF back to on, verify evr is no longer filtered. """ result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) - result = fprime_test_api.assert_event('SetBlinkingState', timeout = 3) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('SetBlinkingState', timeout = 5) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('eventLogger.SET_EVENT_FILTER', ['ACTIVITY_HI', 'DISABLED']) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['OFF']) result = fprime_test_api.await_event_count(0, 'SetBlinkingState') - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) #tear down steps. set EVR back to enable and LED back to on. result = fprime_test_api.send_command('eventLogger.SET_EVENT_FILTER', ['ACTIVITY_HI', 'ENABLED']) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) result = fprime_test_api.await_event_count(1, 'SetBlinkingState') - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) def test_id_filter(fprime_test_api): """Test that event can be filtered by ID. @@ -99,31 +99,31 @@ def test_id_filter(fprime_test_api): 5. Remove SetBlinkState EVR from the filter list and send BLINKING_ON_OFF back to on. """ result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) - result = fprime_test_api.assert_event('SetBlinkingState', timeout = 3) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('SetBlinkingState', timeout = 5) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x10001', 'ENABLED']) - result = fprime_test_api.assert_event('eventLogger.ID_FILTER_ENABLED', timeout = 3) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('eventLogger.ID_FILTER_ENABLED', timeout = 5) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) result = fprime_test_api.await_event_count(0, 'SetBlinkingState') - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x10001', 'DISABLED']) - result = fprime_test_api.assert_event('eventLogger.ID_FILTER_REMOVED', timeout = 3) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('eventLogger.ID_FILTER_REMOVED', timeout = 5) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('eventLogger.SET_ID_FILTER', ['0x100', 'DISABLED']) - result = fprime_test_api.assert_event('eventLogger.ID_FILTER_NOT_FOUND', timeout = 3) - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeError') + result = fprime_test_api.assert_event('eventLogger.ID_FILTER_NOT_FOUND', timeout = 5) + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeError', timeout = 5) time.sleep(3) result = fprime_test_api.send_command('blinker.BLINKING_ON_OFF', ['ON']) result = fprime_test_api.await_event_count(1, 'SetBlinkingState') - result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 3) - result = fprime_test_api.assert_event('OpCodeCompleted') + result = fprime_test_api.assert_event('OpCodeDispatched', timeout = 5) + result = fprime_test_api.assert_event('OpCodeCompleted', timeout = 5) From 3b64be4b2a542c0c4477114970f5b94bbb47e62e Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 25 Jul 2024 09:25:47 -0700 Subject: [PATCH 33/43] workflow-2612 - test reusable paths via temp_ci. --- .github/workflows/baremetal_ci.yml | 8 ++++---- .github/workflows/reusable_fit.yml | 10 +++++----- .github/workflows/temp_ci.yml | 21 ++++++++------------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index ca3782b4..eaac8214 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -1,9 +1,9 @@ name: baremetal-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -on: [push] +#on: [push] env: - resource_type: "fsw-gds" + platform_setup: "fsw-gds" baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex upload_addr: usb:3120000 gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 @@ -15,7 +15,7 @@ jobs: build: runs-on: self-hosted outputs: - resource_type: ${{ env.resource_type }} + platform_setup: ${{ env.platform_setup }} start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} gds_args: ${{ env.gds_args }} dict_path: ${{ env.dict_path }} @@ -51,7 +51,7 @@ jobs: uses: ./.github/workflows/reusable_fit.yml with: runs_on: self-hosted - resource_type: ${{ needs.build.outputs.resource_type }} + 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 }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index 4809cd71..954aa61e 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -7,10 +7,10 @@ on: required: false type: string default: "ubuntu-latest" - resource_type: + platform_setup: required: true type: string - default: "non_embedded" + default: "non-embedded" start_cmd: required: false type: string @@ -37,7 +37,7 @@ jobs: # \ gds-fsw / non-embedded: - if: ${{ inputs.resource_type == 'non-embedded' }} + if: ${{ inputs.platform_setup == 'non-embedded' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW and GDS" @@ -48,7 +48,7 @@ jobs: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP fsw-gds: - if: ${{ inputs.resource_type == 'fsw-gds' }} + if: ${{ inputs.platform_setup == 'fsw-gds' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW" @@ -61,7 +61,7 @@ jobs: run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP gds-fsw: - if: ${{ inputs.resource_type == 'gds-fsw' }} + if: ${{ inputs.platform_setup == 'gds-fsw' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start GDS" diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml index 925e6d10..0e455069 100644 --- a/.github/workflows/temp_ci.yml +++ b/.github/workflows/temp_ci.yml @@ -1,29 +1,25 @@ name: temp-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -#on: [push] +on: [push] env: + platform_setup: 'gds-fsw' baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex upload_addr: usb:3120000 gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 - log_path: ../test_artifacts/test_run_$(date +'%Y-%m-%dT%H%M%S').txt dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/BaremetalReferenceTopologyAppDictionary.xml test_path: BaremetalReference/test/int/baremetal_ref_integration_test.py jobs: - vars: + + build: runs-on: ubuntu-latest outputs: - log_path: ${{ env.log_path }} + platform_setup: ${{ env.platform_setup }} start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} gds_args: ${{ env.gds_args }} dict_path: ${{ env.dict_path }} test_path: ${{ env.test_path }} - steps: - - run: echo "Expose env vars for reusable workflow." - - build: - runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: "Checkout F' Repository" @@ -33,15 +29,14 @@ jobs: path: ${{ inputs.fprime_location }} - name: "Build" run: echo ${{ github.workspace }} + - run: echo "Expose env vars for reusable workflow." fit: - needs: [build, vars] + needs: build uses: ./.github/workflows/reusable_fit.yml with: runs_on: ubuntu-latest - log_path: ${{ needs.vars.outputs.log_path }} - non_embedded: false - fsw_first: true + platform_setup: ${{ needs.build.outputs.platform_setup }} start_cmd: ${{ needs.vars.outputs.start_cmd }} gds_args: ${{ needs.vars.outputs.gds_args }} dict_path: ${{ needs.vars.outputs.dict_path }} From 051e07147df51e61a2035f0e3a683b4ece3d8e91 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 25 Jul 2024 13:15:38 -0700 Subject: [PATCH 34/43] workflow-2612 - Back to testing on baremetal_ci, enable logging. --- .github/workflows/baremetal_ci.yml | 2 +- .github/workflows/reusable_fit.yml | 2 +- .github/workflows/temp_ci.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci.yml index eaac8214..eeb77c4b 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci.yml @@ -1,6 +1,6 @@ name: baremetal-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -#on: [push] +on: [push] env: platform_setup: "fsw-gds" diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit.yml index 954aa61e..e2027a19 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit.yml @@ -58,7 +58,7 @@ jobs: fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & sleep 12 - name: "Run Integration tests" - run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP + run: pytest ${{ inputs.test_path }} -rP --dictionary ${{ inputs.dict_path }} --logs ./ gds-fsw: if: ${{ inputs.platform_setup == 'gds-fsw' }} diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml index 0e455069..57f4d352 100644 --- a/.github/workflows/temp_ci.yml +++ b/.github/workflows/temp_ci.yml @@ -1,6 +1,6 @@ name: temp-ci-actions run-name: ${{ github.actor }} running Baremetal CI actions -on: [push] +#on: [push] env: platform_setup: 'gds-fsw' From d8380637cddfe0c2bf9cdd2ec529438ea6457a5c Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 29 Jul 2024 08:15:04 -0700 Subject: [PATCH 35/43] workflow-2612 - logging testing. - update workflow file names. add comments. --- ...remetal_ci.yml => baremetal_ci_teensy.yml} | 5 ++- .../{reusable_fit.yml => reusable_fit_ci.yml} | 40 ++++++++++++------- .github/workflows/temp_ci.yml | 15 ++++--- 3 files changed, 39 insertions(+), 21 deletions(-) rename .github/workflows/{baremetal_ci.yml => baremetal_ci_teensy.yml} (92%) rename .github/workflows/{reusable_fit.yml => reusable_fit_ci.yml} (58%) diff --git a/.github/workflows/baremetal_ci.yml b/.github/workflows/baremetal_ci_teensy.yml similarity index 92% rename from .github/workflows/baremetal_ci.yml rename to .github/workflows/baremetal_ci_teensy.yml index eeb77c4b..89581763 100644 --- a/.github/workflows/baremetal_ci.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -9,6 +9,7 @@ env: gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 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 }} jobs: @@ -20,6 +21,7 @@ jobs: 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" @@ -48,7 +50,7 @@ jobs: fit: needs: build - uses: ./.github/workflows/reusable_fit.yml + uses: ./.github/workflows/reusable_fit_ci.yml with: runs_on: self-hosted platform_setup: ${{ needs.build.outputs.platform_setup }} @@ -56,3 +58,4 @@ jobs: 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 }} diff --git a/.github/workflows/reusable_fit.yml b/.github/workflows/reusable_fit_ci.yml similarity index 58% rename from .github/workflows/reusable_fit.yml rename to .github/workflows/reusable_fit_ci.yml index e2027a19..76a07dff 100644 --- a/.github/workflows/reusable_fit.yml +++ b/.github/workflows/reusable_fit_ci.yml @@ -24,16 +24,18 @@ on: test_path: required: false type: string + workspace_path: + required: true + type: string jobs: -# Following 3 jobs are on a switch, only one will run based on 2 conditionals: non_embedded and fsw_first. -# job 1 start fsw gds together: if non_embedded is true. -# job 2 start fsw first and then gds: if not non_embedded and fsw_first is true -# job 3 start gds and then fsw: if not non_embedded and not fsw_first -# after one of these 3 jobs run, fit job step will run. +# 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 |---> fit +# build --->| fsw-gds |---> upload-fit-artifacts # \ gds-fsw / non-embedded: @@ -73,11 +75,21 @@ jobs: - name: "Run Integration tests" run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP -# fit: -# runs-on: ${{ inputs.runs_on }} -# if: ${{ always() }} -# needs: [non-embedded, fsw-gds, gds-fsw] -# steps: -# - name: "Run Integration tests" -# run: | -# pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -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. + #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. + run: | + cd ${{ inputs.workspace_path }} + cd "$(ls -td -- */ | head -n 1)" + mv TestLog*.xlsx TestLog.xlsx + echo "TEST_LOG_PATH=$(realpath -s *.xlsx)" >> $GITHUB_ENV + - uses: actions/upload-artifact@v4 + with: + name: TestLog + path: ${{ env.TEST_LOG_PATH }} diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml index 57f4d352..88f08f7a 100644 --- a/.github/workflows/temp_ci.yml +++ b/.github/workflows/temp_ci.yml @@ -3,12 +3,13 @@ run-name: ${{ github.actor }} running Baremetal CI actions #on: [push] env: - platform_setup: 'gds-fsw' + platform_setup: 'fsw-gds' baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex upload_addr: usb:3120000 gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 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 }} jobs: @@ -20,6 +21,7 @@ jobs: 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" @@ -33,11 +35,12 @@ jobs: fit: needs: build - uses: ./.github/workflows/reusable_fit.yml + uses: ./.github/workflows/reusable_fit_ci.yml with: runs_on: ubuntu-latest platform_setup: ${{ needs.build.outputs.platform_setup }} - start_cmd: ${{ needs.vars.outputs.start_cmd }} - gds_args: ${{ needs.vars.outputs.gds_args }} - dict_path: ${{ needs.vars.outputs.dict_path }} - test_path: ${{ needs.vars.outputs.test_path }} + 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 }} From 5d8dc77ada2463103a14c0e3a1d5aa12dffb356f Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 22 Aug 2024 13:50:51 -0700 Subject: [PATCH 36/43] workflow-2612 - Update baremetal_cit_teensy with ports from Odroid self runner. --- .github/workflows/baremetal_ci_teensy.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/baremetal_ci_teensy.yml b/.github/workflows/baremetal_ci_teensy.yml index 89581763..e2edcc64 100644 --- a/.github/workflows/baremetal_ci_teensy.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -5,8 +5,7 @@ on: [push] env: platform_setup: "fsw-gds" baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex - upload_addr: usb:3120000 - gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 + 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 }} @@ -17,7 +16,7 @@ jobs: runs-on: self-hosted outputs: platform_setup: ${{ env.platform_setup }} - start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} + start_cmd: teensy_loader_cli --mcu=TEENSY41 -v -s ${{ env.baremetal_bin }} gds_args: ${{ env.gds_args }} dict_path: ${{ env.dict_path }} test_path: ${{ env.test_path }} From 11ac3303d6d911b72c172a7e7c47596f9a228b8e Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 26 Aug 2024 09:01:12 -0700 Subject: [PATCH 37/43] workflow-2612 - Add pip install line into build job. - Remove arduino-cli install in build job, using teensy_cli instead. --- .github/workflows/baremetal_ci_teensy.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/baremetal_ci_teensy.yml b/.github/workflows/baremetal_ci_teensy.yml index e2edcc64..50895c3b 100644 --- a/.github/workflows/baremetal_ci_teensy.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -32,13 +32,8 @@ jobs: 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 - curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=. sh - git clone https://github.com/SterlingPeet/arduino-cli-cmake-wrapper.git - cd arduino-cli-cmake-wrapper - git checkout update/refactor - pip install . - cd .. fprime-util generate fprime-util build - name: "Temp step, file renaming" From 22bdc56f7b3b4f583c4b05160dfcf35442406ba5 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 26 Aug 2024 10:15:49 -0700 Subject: [PATCH 38/43] workflow-2612 - Remove temp_ci.yml. --- .github/workflows/baremetal_ci_teensy.yml | 2 +- .github/workflows/temp_ci.yml | 46 ----------------------- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 .github/workflows/temp_ci.yml diff --git a/.github/workflows/baremetal_ci_teensy.yml b/.github/workflows/baremetal_ci_teensy.yml index 50895c3b..a72b1a38 100644 --- a/.github/workflows/baremetal_ci_teensy.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -16,7 +16,7 @@ jobs: runs-on: self-hosted outputs: platform_setup: ${{ env.platform_setup }} - start_cmd: teensy_loader_cli --mcu=TEENSY41 -v -s ${{ env.baremetal_bin }} + start_cmd: /home/odroid/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY41 -v -s ${{ env.baremetal_bin }} gds_args: ${{ env.gds_args }} dict_path: ${{ env.dict_path }} test_path: ${{ env.test_path }} diff --git a/.github/workflows/temp_ci.yml b/.github/workflows/temp_ci.yml deleted file mode 100644 index 88f08f7a..00000000 --- a/.github/workflows/temp_ci.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: temp-ci-actions -run-name: ${{ github.actor }} running Baremetal CI actions -#on: [push] - -env: - platform_setup: 'fsw-gds' - baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex - upload_addr: usb:3120000 - gds_args: --comm-adapter uart --uart-device /dev/tty.usbmodem159910601 - 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 }} - -jobs: - - build: - runs-on: ubuntu-latest - outputs: - platform_setup: ${{ env.platform_setup }} - start_cmd: arduino-cli upload --fqbn teensy:avr:teensy41 -p ${{ env.upload_addr }} -i ${{ env.baremetal_bin }} - 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" - run: echo ${{ github.workspace }} - - run: echo "Expose env vars for reusable workflow." - - fit: - needs: build - uses: ./.github/workflows/reusable_fit_ci.yml - with: - runs_on: ubuntu-latest - 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 }} From 4ee39ced578578a18694876e85a82cc99bc79cea Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 26 Aug 2024 11:06:41 -0700 Subject: [PATCH 39/43] workflow-2612 - Activate fprime venv in reusable workflow before every venv related call. Each step in workflow file runs in a separate shell. --- .github/workflows/reusable_fit_ci.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable_fit_ci.yml b/.github/workflows/reusable_fit_ci.yml index 76a07dff..650e9b62 100644 --- a/.github/workflows/reusable_fit_ci.yml +++ b/.github/workflows/reusable_fit_ci.yml @@ -43,9 +43,12 @@ jobs: runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW and GDS" - run: ${{ inputs.start_cmd }} + run: | + . ./fprime-venv/bin/activate + ${{ inputs.start_cmd }} - name: "Run Integration tests" run: | + . ./fprime-venv/bin/activate sleep 12 pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP @@ -57,23 +60,30 @@ jobs: run: ${{ inputs.start_cmd }} - name: "Start GDS" run: | + . ./fprime-venv/bin/activate fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & sleep 12 - name: "Run Integration tests" - run: pytest ${{ inputs.test_path }} -rP --dictionary ${{ inputs.dict_path }} --logs ./ + run: | + . ./fprime-venv/bin/activate + pytest ${{ inputs.test_path }} -rP --dictionary ${{ inputs.dict_path }} --logs ./ gds-fsw: if: ${{ inputs.platform_setup == 'gds-fsw' }} runs-on: ${{ inputs.runs_on }} steps: - name: "Start GDS" - run: fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & + run: | + . ./fprime-venv/bin/activate + fprime-gds -n --dictionary ${{ inputs.dict_path }} --gui none ${{ inputs.gds_args }} & - name: "Start FSW" run: | ${{ inputs.start_cmd }} sleep 12 - name: "Run Integration tests" - run: pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP + run: | + . ./fprime-venv/bin/activate + pytest ${{ inputs.test_path }} --dictionary ${{ inputs.dict_path }} -rP upload-fit-artifact: runs-on: ${{ inputs.runs_on }} From db381f72242609cfea8d5b7b30e4e0d9db54e477 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 26 Aug 2024 13:36:29 -0700 Subject: [PATCH 40/43] workflow-2612 - update run-baremetal-reference.md for alternative to fsw upload. --- docs/run-baremetal-reference.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/run-baremetal-reference.md b/docs/run-baremetal-reference.md index 69e12366..e1bf3861 100644 --- a/docs/run-baremetal-reference.md +++ b/docs/run-baremetal-reference.md @@ -24,6 +24,14 @@ Note: It has to be the full path to the BaremetalReference.hex file for arduino- 4. While programming the red led will be brighter and then flash. Once done the board will get out of HalfKay bootloader mode (red led off) and run the BaremetalReference application. You should now see an orange flashing led by the button. +### Alternate option for hex file upload +Instead of using arduino-cli, you can also use teensy_loader_cli. This alternative is best if you are running on a headless machine / SBC and using SSH. teensy_loader_cli requires compiling on the host machine but usage is simpler. + +1. After building the hex file, simply call: +``` +teensy_loader_cli --mcu=TEENSY41 -v -s /full_path/fprime-baremetal-reference/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex +``` + ## Using GDS via serial 1. Find the serial port, this varies by your host system but it should show up as a `/dev/tty*` device. On the mac, it's /dev/tty.usbmodem*(9 digit number). 2. Launch GDS: From e1aeeae91283abc169821a7890e8694183320ef6 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Wed, 18 Sep 2024 10:41:32 -0700 Subject: [PATCH 41/43] workflow-2612 - build using github's servers and upload build artifacts: binary and dictionary. --- .github/workflows/baremetal_ci_teensy.yml | 58 ++++++++++++++++------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/.github/workflows/baremetal_ci_teensy.yml b/.github/workflows/baremetal_ci_teensy.yml index a72b1a38..c9efa8a7 100644 --- a/.github/workflows/baremetal_ci_teensy.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -13,7 +13,7 @@ env: jobs: build: - runs-on: self-hosted + runs-on: ubuntu-latest outputs: platform_setup: ${{ env.platform_setup }} start_cmd: /home/odroid/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY41 -v -s ${{ env.baremetal_bin }} @@ -34,22 +34,48 @@ jobs: . ./fprime-venv/bin/activate pip3 install -U setuptools wheel pip pip3 install -r ${{ inputs.fprime_location }}./fprime/requirements.txt + + mkdir -p ~/.local/bin + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/.local/bin sh + cd ~/.local/bin + git clone https://github.com/SterlingPeet/arduino-cli-cmake-wrapper.git + cd arduino-cli-cmake-wrapper + git checkout update/refactor + pip3 install . + export PATH=~/.local/bin:$PATH + cd ${{ github.workspace }} + arduino-cli config init + 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 + + . ./fprime-venv/bin/activate fprime-util generate fprime-util build - - 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 + - name: "Upload build binary" + uses: actions/upload-artifact@v4 + with: + name: BaremetalReference.hex + path: ${{ env.baremetal_bin }} + - name: "Upload dictionary" + uses: actions/upload-artifact@v4 + with: + name: BaremetalReferenceTopologyAppDictionary.xml + path: ${{ env.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: - 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 }} +# fit: +# needs: build +# uses: ./.github/workflows/reusable_fit_ci.yml +# with: +# 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 }} From 8c91a740328c49ad50db8192b73826db9b007be0 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 19 Sep 2024 13:22:33 -0700 Subject: [PATCH 42/43] workflow-2612 - Update resauble_fit_ci to download build artifacts. - Add setup job to reusable_fit_ci. --- .github/workflows/baremetal_ci_teensy.yml | 38 +++++++++++++---------- .github/workflows/reusable_fit_ci.yml | 33 ++++++++++++++++++-- 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/.github/workflows/baremetal_ci_teensy.yml b/.github/workflows/baremetal_ci_teensy.yml index c9efa8a7..db0d6299 100644 --- a/.github/workflows/baremetal_ci_teensy.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -9,6 +9,8 @@ env: 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_dict_path: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/dict/dictionary.xml jobs: @@ -16,7 +18,7 @@ jobs: runs-on: ubuntu-latest outputs: platform_setup: ${{ env.platform_setup }} - start_cmd: /home/odroid/teensy_loader_cli/teensy_loader_cli --mcu=TEENSY41 -v -s ${{ env.baremetal_bin }} + 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 }} @@ -52,30 +54,34 @@ jobs: . ./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.dict_path}} ${{ env.new_dict_path}} - name: "Upload build binary" uses: actions/upload-artifact@v4 with: - name: BaremetalReference.hex - path: ${{ env.baremetal_bin }} + name: build_binary + path: ${{ env.new_baremetal_bin }} - name: "Upload dictionary" uses: actions/upload-artifact@v4 with: - name: BaremetalReferenceTopologyAppDictionary.xml - path: ${{ env.dict_path }} + 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: -# 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 }} + fit: + needs: build + uses: ./.github/workflows/reusable_fit_ci.yml + with: + 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 }} diff --git a/.github/workflows/reusable_fit_ci.yml b/.github/workflows/reusable_fit_ci.yml index 650e9b62..cdea6248 100644 --- a/.github/workflows/reusable_fit_ci.yml +++ b/.github/workflows/reusable_fit_ci.yml @@ -38,9 +38,34 @@ jobs: # build --->| fsw-gds |---> upload-fit-artifacts # \ gds-fsw / + setup: + runs-on: ${{ inputs.runs_on }} + steps: + - uses: actions/checkout@v4 + - name: "Checkout F' Repository" + uses: actions/checkout@v4 + with: + submodules: true + path: ${{ inputs.fprime_location }} + - name: "Build" + 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" + uses: actions/download-artifact@v4 + with: + name: build_binary + - name: "Download dictionary" + uses: actions/download-artifact@v4 + with: + name: dictionary.xml + non-embedded: if: ${{ inputs.platform_setup == 'non-embedded' }} runs-on: ${{ inputs.runs_on }} + needs: setup steps: - name: "Start FSW and GDS" run: | @@ -54,6 +79,7 @@ jobs: fsw-gds: if: ${{ inputs.platform_setup == 'fsw-gds' }} + needs: setup runs-on: ${{ inputs.runs_on }} steps: - name: "Start FSW" @@ -61,15 +87,16 @@ 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 }} & sleep 12 - name: "Run Integration tests" run: | . ./fprime-venv/bin/activate - pytest ${{ inputs.test_path }} -rP --dictionary ${{ inputs.dict_path }} --logs ./ + pytest ${{ inputs.test_path }} -rP --dictionary ./dictionary.xml --logs ./ gds-fsw: if: ${{ inputs.platform_setup == 'gds-fsw' }} + needs: setup runs-on: ${{ inputs.runs_on }} steps: - name: "Start GDS" @@ -94,8 +121,8 @@ jobs: #Navigate to workspace path. nagigate 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 ${{ inputs.workspace_path }} cd "$(ls -td -- */ | head -n 1)" mv TestLog*.xlsx TestLog.xlsx echo "TEST_LOG_PATH=$(realpath -s *.xlsx)" >> $GITHUB_ENV From 363f2638685130618bacd65315f0aa5fbb08e100 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Mon, 23 Sep 2024 08:40:43 -0700 Subject: [PATCH 43/43] workflow-2612 - Update / cleanup interface input/output between build job and reusable workflow. --- .github/workflows/baremetal_ci_teensy.yml | 34 +++++------- .github/workflows/reusable_fit_ci.yml | 63 +++++++++++------------ 2 files changed, 43 insertions(+), 54 deletions(-) diff --git a/.github/workflows/baremetal_ci_teensy.yml b/.github/workflows/baremetal_ci_teensy.yml index db0d6299..f55488cc 100644 --- a/.github/workflows/baremetal_ci_teensy.yml +++ b/.github/workflows/baremetal_ci_teensy.yml @@ -3,13 +3,12 @@ run-name: ${{ github.actor }} running Baremetal CI actions on: [push] env: - platform_setup: "fsw-gds" - baremetal_bin: ${{ github.workspace }}/build-artifacts/teensy41/BaremetalReference/bin/BaremetalReference.hex + run_job_select: "fsw-gds" + 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: @@ -17,12 +16,10 @@ jobs: build: runs-on: ubuntu-latest outputs: - platform_setup: ${{ env.platform_setup }} + run_job_select: ${{ env.run_job_select }} 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" @@ -30,13 +27,13 @@ jobs: 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 @@ -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 }} + run_job_select: ${{ needs.build.outputs.run_job_select }} 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 }} diff --git a/.github/workflows/reusable_fit_ci.yml b/.github/workflows/reusable_fit_ci.yml index cdea6248..24733c41 100644 --- a/.github/workflows/reusable_fit_ci.yml +++ b/.github/workflows/reusable_fit_ci.yml @@ -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 + run_job_select: + required: false type: string default: "non-embedded" start_cmd: @@ -18,25 +21,20 @@ 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. -# 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. +# Setup job will run first by creating the virtual environment and then downloading the +# FSW binary and dictionary created in the build job step of the caller workflow to this +# workflow. After that the following run jobs are on a switch, only one will run based +# on run_job_select string. Each run job has a different method of starting FSW, FIT is +# run at the end of each job. If adding a new run job 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 -# \ gds-fsw / +# / run-non-embedded \ +# setup --->| run-fsw-gds |---> upload-fit-artifacts +# \ run-gds-fsw / setup: runs-on: ${{ inputs.runs_on }} @@ -47,23 +45,23 @@ 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: - if: ${{ inputs.platform_setup == 'non-embedded' }} + run-non-embedded: + if: ${{ inputs.run_job_select == 'non-embedded' }} runs-on: ${{ inputs.runs_on }} needs: setup steps: @@ -75,10 +73,10 @@ 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' }} + run-fsw-gds: + if: ${{ inputs.run_job_select == 'fsw-gds' }} needs: setup runs-on: ${{ inputs.runs_on }} steps: @@ -94,15 +92,15 @@ jobs: . ./fprime-venv/bin/activate pytest ${{ inputs.test_path }} -rP --dictionary ./dictionary.xml --logs ./ - gds-fsw: - if: ${{ inputs.platform_setup == 'gds-fsw' }} + run-gds-fsw: + if: ${{ inputs.run_job_select == '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 }} @@ -110,18 +108,17 @@ jobs: - 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