Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 30-system-implement-r…
Browse files Browse the repository at this point in the history
…ide-task
  • Loading branch information
ntlhui committed Nov 1, 2024
2 parents c29055f + 02d3b80 commit 0c9cc2d
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 67 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
name: Compile Firmware
name: Compile Firmware and Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up environment
run: |
sudo apt-get update && sudo apt-get install -y cmake build-essential
- name: Build and run tests
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cd build
make
cd ..
./build/googletests | tee googletest.log
- name: Upload test log
uses: actions/upload-artifact@v4
with:
name: test_artifact
path: |
build/googletests
googletest.log
compile:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -35,7 +63,7 @@ jobs:
docs/html
doxygen.log
release:
needs: [compile]
needs: [compile, test]
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -50,6 +78,7 @@ jobs:
fetch-depth: 0
submodules: recursive
ref: main
token: ${{ secrets.RELEASER }}

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -73,6 +102,6 @@ jobs:
- name: Run Semantic Release
id: release
env:
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN : ${{ secrets.RELEASER }}
run: |
npx semantic-release@23
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## [3.2.3](https://github.com/UCSD-E4E/smartfin-fw3/compare/v3.2.2...v3.2.3) (2024-11-01)


### Bug Fixes

* Updates components ([57f59da](https://github.com/UCSD-E4E/smartfin-fw3/commit/57f59da218af8e4a61e9b8c8711fad65c7e0aa09))

## [3.2.2](https://github.com/UCSD-E4E/smartfin-fw3/compare/v3.2.1...v3.2.2) (2024-10-30)


### Bug Fixes

* add brief & details to chargetask documentation ([42ed2e6](https://github.com/UCSD-E4E/smartfin-fw3/commit/42ed2e678e276cd26609116464ea40163d388323))
* add brief & details to ChargeTask documentation ([#105](https://github.com/UCSD-E4E/smartfin-fw3/issues/105)) ([0c004d8](https://github.com/UCSD-E4E/smartfin-fw3/commit/0c004d8c552b7aadc827b1e97362f7a6ce7d9de0))

## [3.2.1](https://github.com/UCSD-E4E/smartfin-fw3/compare/v3.2.0...v3.2.1) (2024-06-23)


Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_compile_definitions(TEST_VERSION)

add_subdirectory(external/googletest )
add_subdirectory(external/googletest)
include_directories(external/googletest/googletest/include src/ tests)

set(GTEST_SOURCE_FILES
tests/test_endianness.cpp
tests/scheduler_test_system.cpp
tests/test_ensembles.cpp
tests/fixed_google_tests.cpp
Expand All @@ -19,6 +20,7 @@ set(GTEST_SOURCE_FILES
tests/test_file_system.cpp
src/states.cpp
)

set(EXAMINE_BEHAVIOR_SOURCE_FILES
tests/scheduler_test_system.cpp
tests/test_ensembles.cpp
Expand Down
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jupyter
numpy
matplotlib
schema
262 changes: 200 additions & 62 deletions docs/sampling_algorithm.ipynb

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/chargeTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#define CHARGE_RGB_LED_PERIOD 0
#define CHARGE_RGB_LED_PRIORITY LED_PRIORITY_IMPORTANT

/**
* @brief Handles charging process
* @details Contains methods for starting charging task (setting LEDs, etc), detecting if charger is connected, and ending charging task
*/
class ChargeTask : public Task{
public:
/**
Expand Down
2 changes: 1 addition & 1 deletion src/vers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#define FW_MAJOR_VERSION 3
#define FW_MINOR_VERSION 2
#define FW_BUILD_NUM 1
#define FW_BUILD_NUM 3
#define FW_BRANCH ""

#if PRODUCT_VERSION_USE_HEX == 1
Expand Down
4 changes: 4 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Test Suites

See https://google.github.io/googletest/

# Overview
The folder `tests` contains tests monatomic tests for the scheduler in the
`src` directory. There is a bash script to manage the tests at
Expand Down
31 changes: 31 additions & 0 deletions tests/test_endianness.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @file Endianness utility functions unit tests
* @author Nathan Hui ([email protected])
* @brief
* @version 0.1
* @date 2024-10-31
*
* @copyright Copyright (c) 2024
*
*/
#include "util.hpp"

#include <gtest/gtest.h>

TEST(EndiannessTests, EndiannessConsistency)
{
uint16_t test_value2 = 0xf00d;
ASSERT_EQ(test_value2, N_TO_B_ENDIAN_2(B_TO_N_ENDIAN_2(test_value2)));

uint32_t test_value4 = 0xbaadf00d;
ASSERT_EQ(test_value4, N_TO_B_ENDIAN_4(B_TO_N_ENDIAN_4(test_value4)));
}

TEST(EndiannessTests, OneWayTest)
{
uint16_t test_value2 = 0xf00d;
ASSERT_EQ(0x0df0, N_TO_B_ENDIAN_2(test_value2));

uint32_t test_value4 = 0xbaadf00d;
ASSERT_EQ(0x0df0adba, N_TO_B_ENDIAN_4(test_value4));
}

0 comments on commit 0c9cc2d

Please sign in to comment.