CI with custom board and custom lib

Hello,

I am discovering continuous integration and I want to try platformio CI with gitlab.

I follow this documentation : GitLab — PlatformIO latest documentation

My project use a custom board called KZV3 that has its own json under a folder called board.
I also have some custom under a lib/ folder.

pio run -d project/tsl2591 -c project/tsl2591/platformio.ini

I am using the command above which is working on local but with gitlab I got this error

`Error: Unknown board ID 'KZV3'`

My .gitlab-ci.yml file :


image: python:3.9

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
  PLATFORMIO_CACHE_DIR: "$CI_PROJECT_DIR/.platformio-cache"

cache:
  paths:
    - .pip-cache/
    - .platformio-cache/

stages:
 - tsl2591

before_script:
  - "pip install -U platformio"

job:
  stage: tsl2591
  script: "pio run -d project/tsl2591 -c project/tsl2591/platformio.ini"

My platformio.ini precise where to found the board and lib folders that why i am using the -c argument.

Is there any example of syntax for the yml file with platformio custom board or lib ?

Note : I assume that gitlab execute the command pio run -d -c in the root of the project.
I am also not very famillar with docker but my example should be easy enough to not special setup outside of platformio command.

I don’t think this is necessary when you already specify -d.

Is boards under project/ or in the root? Can you post the tree of the directory?

Board is in the root ans also my file .yml is in root.

C:.
platform
├───board (here is KZV3)
├───data
├───datasheet
│.gitlab-ci.yml
├───lib ( All the lib here )
│   ├─── tsl2591
│   ├───BoardDefinitionV3
│   ├───BoardSetup
└───project
    ├───ds18b20
    │    ├───include
    │    ├───lib (empty)
    │    ├───src
    │    └───test
    │   
    └───tsl2591
        ├───include
        ├───lib(empty)
        ├───src
        └───test

I added -c for my project conf to be sure that I give the correct custom location of board which is specificied in platformio.ini of each project.
But you are right without -c I still find my board and lib when i do a local execution.

Platformio.ini

[platformio]
default_envs = KZV3
boards_dir =..\..\board
lib_dir =..\..\lib

[common_env_data]
platform = atmelavr
framework = arduino

[env:uno]
board = uno
platform = ${common_env_data.platform}
framework =${common_env_data.framework}

[env:KZV3] 
platform = ${common_env_data.platform}
framework =${common_env_data.framework}
board = KZV3
board_hardware.oscillator = external

Is there a place where I can found documentation for giving path for platformio CI.
Maybe …\…\lib and …\…\board are not a way to give path for CI because it is relative path. And lib/ and board/ which are absolute path from root are better ?
I look for example with custom board and lib but didn’t found much.

In my early tried I used pio ci because I wasn’t sure my project configuration was really standard.

pio ci project/tsl2591/src/ -c ‘project/tsl2591/platformio.ini’

With pio ci I got the same issue I don’t go to the right place for lib and board.

This will break in Linux won’t it? It uses / as path separator, not \.

1 Like

Ok I will try the other way around.
Thanks a lot, you fixed my CI.

Is there a ressource that I can read to stop making this mistake with path like using \ instead of /.
Because both works on windows with platformio so guideline should be avoid \ to give path even on windows.

Both work on you locall on your Windows machine, right? Or are you on Linux?

Yes on windows machine.

Probably does some autoconversion or the programs which are given these type of paths internally autoconvert them. It’s safe to put / as path separator even in Windows on PlatformIO in my experience, and results in buildable firmwares accross Linux and Windows.