Skip to content

Add GitHub Actions workflow to run unit tests and check code coverage #121

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

Merged
merged 2 commits into from
May 6, 2020
Merged

Add GitHub Actions workflow to run unit tests and check code coverage #121

merged 2 commits into from
May 6, 2020

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented May 5, 2020

On every pull request or push that changes relevant files (anything under extras/test/ or src/):

  • Run unit tests
  • Print coverage report to the workflow log
  • Upload coverage report to Codecov

This PR is dependent on #118. The workflow is currently expected to fail because the unit tests won't be added until #118 is merged.

Demonstration:
https://github.com/per1234/ArduinoIoTCloud/runs/646210541?check_suite_focus=true

https://codecov.io/github/per1234/ArduinoIoTCloud/commit/77fe90bb786f3e0843cb03b2839d1fd58c94995e

Fixes #119

@arduino-libraries arduino-libraries deleted a comment from github-actions bot May 5, 2020
@arduino-libraries arduino-libraries deleted a comment from github-actions bot May 5, 2020
@arduino-libraries arduino-libraries deleted a comment from github-actions bot May 5, 2020
@aentinger
Copy link
Contributor

Good morning 👋 Merging #122 in I created a small conflict on the README. Can you please rebase and resolve? I've also been thinking - as a matter of fact we can merge this now and I just rebase the #118 OTA branch. Another possibility would be to merge this directly into the OTA #118 branch. This has the added benefit of not showing a "broken-build" badge on the README as long as the OTA branch is not merged. What are your thoughts on this?

@per1234
Copy link
Contributor Author

per1234 commented May 6, 2020

Can you please rebase and resolve?

I have now done this.

I've also been thinking - as a matter of fact we can merge this now and I just rebase the #118 OTA branch.

I wouldn't want the broken badge in the readme for a long period of time, but if it's only a short period, then no big deal.

Another possibility would be to merge this directly into the OTA #118 branch. This has the added benefit of not showing a "broken-build" badge on the README as long as the OTA branch is not merged. What are your thoughts on this?

It's fine with me if you want it in that PR. That would cause it to be merged when it's needed. Since #118 is from a branch (rather than a fork as in this PR), I believe it will also allow the Unit Test workflow to run on the PR so you can verify the workflow is working correctly.

@arduino-libraries arduino-libraries deleted a comment from github-actions bot May 6, 2020
@aentinger
Copy link
Contributor

It's fine with me if you want it in that PR. That would cause it to be merged when it's needed. Since #118 is from a branch (rather than a fork as in this PR), I believe it will also allow the Unit Test workflow to run on the PR so you can verify the workflow is working correctly.

That's great! Can you readjust this PR so it can be merged to https://github.com/arduino-libraries/ArduinoIoTCloud/tree/ota instead of master?

@per1234 per1234 changed the base branch from master to ota May 6, 2020 07:17
@arduino-libraries arduino-libraries deleted a comment from github-actions bot May 6, 2020
@github-actions
Copy link

github-actions bot commented May 6, 2020

Memory usage change @72e6cae0022e47a420591fa418e56ad984e062b0

FQBN Flash Usage RAM For Global Variables
arduino:samd:mkr1000 0 0
arduino:samd:mkrgsm1400 0 0
arduino:samd:mkrnb1500 0 0
arduino:samd:mkrwan1300 0 0
arduino:samd:mkrwifi1010 0 0
arduino:samd:nano_33_iot 0 0
esp8266:esp8266:huzzah 0 0

@per1234
Copy link
Contributor Author

per1234 commented May 6, 2020

I have now changed the base branch to ota. It brought in aa1fb95, since I had rebased the PR on master after #122 was merged, but I figure #118 will need to rebase on that commit before merging anyway.

The "Check code coverage" step of the Unit Tests workflow is currently failing because CMakeLists.txt doesn't add the --coverage flags needed to output the coverage data:

set(CMAKE_C_FLAGS   ${CMAKE_C_FLAGS}   "--coverage")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--coverage")

Would you like me to add those lines to CMakeLists.txt?

On every pull request or push that changes relevant files:
- Run unit tests
- Print coverage report to the workflow log
- Upload coverage report to Codecov
@aentinger
Copy link
Contributor

Would you like me to add those lines to CMakeLists.txt?

Yes please 😉 👍

@aentinger aentinger merged commit 43850db into arduino-libraries:ota May 6, 2020
@per1234 per1234 deleted the ci-unit-tests branch May 6, 2020 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build and run unit tests during CI
2 participants