Skip to content

Files

Latest commit

 

History

History

cicd-setup

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CI&CD example project setup

Project that contains: platformio setup, arduino framework, unit test, integration tests and pipeline for CI & CD (Github Actions)

Requirements

Platformio Agent setup (command line)

Step 1

In order to run integration tests, you will need to login to your platformio account:

$ platformio account login

Step 2

Connect your arduino board via USB and start the remote agent

$ platformio remote agent start

If everything is ok, you should get the following info on your terminal:

2020-12-13 23:07:38 [info] Connecting to PlatformIO Remote Development Cloud
2020-12-13 23:07:39 [info] Successfully connected
2020-12-13 23:07:39 [info] Authenticating
2020-12-13 23:07:40 [info] Successfully authorized

Step 3

Generate an platformio account token:

$ platformio account token

You should see on your terminal the token generated, then as the final step to allow the pipeline (github actions) to connect with your arduino board you should save the token as a secret on your github repository: On your repository > Settings > Secrets > New repository secret: Use next environment variable: PLATFORMIOAGENT

Running tests

You can run your unit or integration tests using Platformio IDE or Platformio CLI (terminal)

Unit tests

  • Platformio IDE: Platformio option > env:native > Advanced > Test
  • Platformio CLI:
$ platformio test --environment native -f unit -v

Integration tests

Be sure that you have connected your Arduino board before run integration tests:

  • Platformio IDE: Platformio option > env:uno > Advanced > Test
  • Platformio CLI:
$ platformio test --environment uno -f integration -v

Pipeline (GitHub Actions)

The jobs that the pipeline will be executing after you do a push on your repository are on: .github/workflows/main.yml and those are:

  • build-and-tests (unit and integration tests)
  • deploy-firmware

Make sure that you have configured the secret variable and running the platformio agent before executing the pipeline.

Platforms supported

  • atmelavr (uno tested)
  • native

External Libraries

  • ArduinoFake