Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce testing with Unity #80

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/platformio-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PlatformIO Test

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Copy secrets template
run: |
cp secrets.ini.template secrets.ini

- name: Set up Python
uses: actions/[email protected]
with:
python-version-file: '.python-version'

- name: Cache PlatformIO
uses: actions/[email protected]
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio-${{ hashFiles('**/requirements.txt') }}

- name: Install PlatformIO
shell: bash
run: |
#!/bin/bash
pip install --upgrade platformio

- name: PlatformIO Test
shell: bash
run: |
#!/bin/bash
pio test -e unit_test
3 changes: 3 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ build_type = debug
build_flags =
-D DEBUG
${common.build_flags}

[env:unit_test]
platform = native
29 changes: 29 additions & 0 deletions test/dummy-test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <unity.h>

Check notice on line 1 in test/dummy-test.cpp

View workflow job for this annotation

GitHub Actions / cpp-lint

Run clang-format on test/dummy-test.cpp

File test/dummy-test.cpp does not conform to Custom style guidelines. (lines 3, 8, 13, 14, 15, 18, 19, 20, 23)

Check failure on line 1 in test/dummy-test.cpp

View workflow job for this annotation

GitHub Actions / cpp-lint

test/dummy-test.cpp:1:10 [clang-diagnostic-error]

'unity.h' file not found

void setUp(void)

Check warning on line 3 in test/dummy-test.cpp

View workflow job for this annotation

GitHub Actions / cpp-lint

test/dummy-test.cpp:3:12 [modernize-redundant-void-arg]

redundant void argument list in function definition
{
// set stuff up here
}

void tearDown(void)

Check warning on line 8 in test/dummy-test.cpp

View workflow job for this annotation

GitHub Actions / cpp-lint

test/dummy-test.cpp:8:15 [modernize-redundant-void-arg]

redundant void argument list in function definition
{
// clean stuff up here
}

void should_always_succeed()
{
TEST_ASSERT_TRUE(true);
}

void should_always_fail()
{
TEST_ASSERT_TRUE(false);
}

int main(int argc, char **argv)

Check warning on line 23 in test/dummy-test.cpp

View workflow job for this annotation

GitHub Actions / cpp-lint

test/dummy-test.cpp:23:5 [modernize-use-trailing-return-type]

use a trailing return type for this function
{
UNITY_BEGIN();
RUN_TEST(should_always_succeed);
// RUN_TEST(should_always_fail);
UNITY_END();
}
Loading