clean and add first iteration of gitlab yaml for CI test

This commit is contained in:
Aurélien Gauthier 2025-12-10 11:12:08 +01:00
parent ba186eed2f
commit 17e9f30f34
3 changed files with 45 additions and 12 deletions

35
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,35 @@
stages:
- build
- test
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PLATFORMIO_CACHE_DIR: "$CI_PROJECT_DIR/.cache/platformio"
ARDUINO_ENV: "megaADK"
cache:
paths:
- .cache/pip
- .cache/platformio
key: "$CI_COMMIT_REF_SLUG"
pio_build:
image: python:latest
stage: build
before_script:
- pip install -U platformio
script:
- "pio run -e $ARDUINO_ENV"
pio_test:
image: python:latest
stage: test
before_script:
- pip install -U platformio
script:
- "pio test -e $ARDUINO_ENV --list-result"
- "pio ci --lib='.' --board=$ARDUINO_ENV"

View file

@ -322,12 +322,12 @@ void setup(void)
//WARNING: Tests are not exhaustive and do not cover all possibilities.
int main( int argc, char **argv) {
UNITY_BEGIN();
// The following commented test is here for faciltate the debug "test_get_measure_at", test_get_measure is private function for the storage_interface class
// Maybe removed later
// RUN_TEST(test_get_measure);
RUN_TEST(test_get_measure_at);
RUN_TEST(test_add_measure);
RUN_TEST(test_get_struct);
RUN_TEST(test_set_struct);
// RUN_TEST(test_put_measure);
RUN_TEST(test_set_struct);
UNITY_END();
}

View file

@ -1,11 +1,9 @@
# Project tests
The project was classic for sensor management, for the treatment and for the main file.
However, the data measure storage (**storage_interface** class), use the EEPROM persistant memory with ordered dynamic storage structure leading to most of the project's complexity who need's to be test.
The [EEPROM_test_struct.cpp](EEPROM_test_struct.cpp) is made for this.
This directory is intended for PlatformIO Test Runner and project tests.
## storage_interface test
The file mainly contain unit test for **getter setter** function and **structure** functions.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
**TODO** : Ideally add integration test for globally test project on simple use case.