platformio / platform-native

Native: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/native
Apache License 2.0
21 stars 27 forks source link

Can't run on gitlab CI #12

Closed marfanjr closed 3 years ago

marfanjr commented 3 years ago

I'm trying to run my test code on gitlab CI but i'm getting the following error:

Running with gitlab-runner 13.9.0-rc2 (69c049fd)
  on docker-auto-scale 0277ea0f
  feature flags: FF_GITLAB_REGISTRY_HELPER_IMAGE:true
Preparing the "docker+machine" executor
Using Docker executor with image python:3.8.1 ...
Pulling docker image python:3.8.1 ...
Using docker image sha256:efdecc2e377a2438af1cf9e07286b5f7ee3f418c43b4bbb540b3752fdc0e008b for python:3.8.1 with digest python@sha256:7be36bd79ab0d754c2a6db5351b7bf91ebe7161cd0d80a15e47ab2c211a0828b ...
Preparing environment
00:03
Running on runner-0277ea0f-project-12613734-concurrent-0 via runner-0277ea0f-srm-1616087785-3fde39e8...
Getting source from Git repository
00:01
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes...
Initialized empty Git repository in /builds/marfan1/favo-firmware/.git/
Created fresh repository.
Checking out 38e98115 as release/1.13.0...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:11
Using docker image sha256:efdecc2e377a2438af1cf9e07286b5f7ee3f418c43b4bbb540b3752fdc0e008b for python:3.8.1 with digest python@sha256:7be36bd79ab0d754c2a6db5351b7bf91ebe7161cd0d80a15e47ab2c211a0828b ...
$ pip install --upgrade pip
Collecting pip
  Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
Successfully installed pip-21.0.1
$ pip install -U platformio
Collecting platformio
  Downloading platformio-5.1.1.tar.gz (215 kB)
Collecting bottle==0.12.*
  Downloading bottle-0.12.19-py3-none-any.whl (89 kB)
Collecting click<8,>=5
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting colorama
  Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting marshmallow<4,>=2
  Downloading marshmallow-3.10.0-py2.py3-none-any.whl (46 kB)
Collecting pyelftools<1,>=0.27
  Downloading pyelftools-0.27-py2.py3-none-any.whl (151 kB)
Collecting pyserial==3.*
  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting requests==2.*
  Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
Collecting semantic_version==2.8.*
  Downloading semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
Collecting tabulate==0.8.*
  Downloading tabulate-0.8.9-py3-none-any.whl (25 kB)
Collecting zeroconf==0.28.*
  Downloading zeroconf-0.28.8-py3-none-any.whl (55 kB)
Collecting aiofiles==0.6.*
  Downloading aiofiles-0.6.0-py3-none-any.whl (11 kB)
Collecting ajsonrpc==1.1.*
  Downloading ajsonrpc-1.1.0-py3-none-any.whl (22 kB)
Collecting starlette==0.14.*
  Downloading starlette-0.14.2-py3-none-any.whl (60 kB)
Collecting uvicorn==0.13.*
  Downloading uvicorn-0.13.4-py3-none-any.whl (46 kB)
Collecting wsproto==1.0.*
  Downloading wsproto-1.0.0-py3-none-any.whl (24 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
Collecting chardet<5,>=3.0.2
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting h11>=0.8
  Downloading h11-0.12.0-py3-none-any.whl (54 kB)
Collecting ifaddr>=0.1.7
  Downloading ifaddr-0.1.7-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: platformio
  Building wheel for platformio (setup.py): started
  Building wheel for platformio (setup.py): finished with status 'done'
  Created wheel for platformio: filename=platformio-5.1.1-py3-none-any.whl size=332815 sha256=aba998ed7eee133a65645e3b8bc22502e5c6284efab682e4c9353f522ba8af7a
  Stored in directory: /root/.cache/pip/wheels/2f/63/89/c2dada8b07ccffcb202706137906675e8ae40262183ff173c5
Successfully built platformio
Installing collected packages: urllib3, ifaddr, idna, h11, click, chardet, certifi, zeroconf, wsproto, uvicorn, tabulate, starlette, semantic-version, requests, pyserial, pyelftools, marshmallow, colorama, bottle, ajsonrpc, aiofiles, platformio
Successfully installed aiofiles-0.6.0 ajsonrpc-1.1.0 bottle-0.12.19 certifi-2020.12.5 chardet-4.0.0 click-7.1.2 colorama-0.4.4 h11-0.12.0 idna-2.10 ifaddr-0.1.7 marshmallow-3.10.0 platformio-5.1.1 pyelftools-0.27 pyserial-3.5 requests-2.25.1 semantic-version-2.8.5 starlette-0.14.2 tabulate-0.8.9 urllib3-1.26.4 uvicorn-0.13.4 wsproto-1.0.0 zeroconf-0.28.8
$ pio test -e native
********************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for embedded development > https://platformio.org/platformio-ide
********************************************************************************
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items
Processing Native in native environment
--------------------------------------------------------------------------------
Error: Unknown development platform 'native'
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1

My files:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp01_1m

[env:esp01_1m]
platform = espressif8266@2.6.3
board = esp01_1m
framework = arduino
build_flags = -Wl,-Tesp8266.flash.1m64.ld -I$PROJECTSRC_DIR
upload_speed = 115200
monitor_speed = 115200
board_build.flash_mode = dout
lib_deps =
  AsyncMqttClient@0.8.2
  NTPClient@3.1.0
  ArduinoJson@6.13.0
  ESP8266Ping@1.0
  Adafruit Unified Sensor@1.1.3
  DHT sensor library@1.3.10
  paulstoffregen/OneWire @ 2.3.5
  milesburton/DallasTemperature @ 3.9.1

[env:native]
platform = native
image: python:3.8.1

stages:
 - build
 - test

before_script:
  - "pip install --upgrade pip"
  - "pip install -U platformio"

build:
  stage: build
  script: "pio run -e esp01_1m"

test:
  stage: test
  script: "pio test -e native"

A few weeks ago I was able to run. But now it is giving that error.

Can someone help me?

mcspr commented 3 years ago

It looks like just running pio test no longer install the platform, and I think it did before? Which makes this a https://github.com/platformio/platformio-core/issues issue?

With the following platformio.ini: https://github.com/xoseperez/espurna/blob/f013e04e2206be7b2cd7fa86e65021630337808a/code/test/platformio.ini

> pio --version
PlatformIO Core, version 5.2.0a3
> pio test
Verbose mode can be enabled via `-v, --verbose` option
Collected 6 items

Processing basic in test environment
-----------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'
> pio run -e test
Processing test (platform: native)
-----------------------------------------------------------------------------------------------------------------------
Platform Manager: Installing native
Platform Manager: native @ 1.1.3 has been installed!
The platform 'native' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
...
roosemberth commented 3 years ago

@marfanjr I saw this post from the issue linked above. I have a working CI, you can take a look at the yaml here.

marfanjr commented 3 years ago

Hi guys,

I'm sorry for the delay in responding.

First of all thank you very much for your time and availability!

In fact, I think it may be related to the issue commented on by @mcspr.

My tests is working fine now!

@roosemberth, your repository helped me a lot in my studies on gitlab ci, thank you very much!