GitHub action fails with No such file or directory

I am trying a very basic GitHub CI actions with my PlatformIO project. I am using almost the official Workflow provided by the documentation, the difference is that my PIO project is located in a sub folder in the repository. Here below is my main.yml (probably the most interesting part is the last one):

name: PlatformIO CI

on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  build:
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - name: Cache pip
        uses: actions/cache@v2
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      - name: Cache PlatformIO
        uses: actions/cache@v2
        with:
          path: ~/.platformio
          key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

      - name: Set up Python
        uses: actions/setup-python@v2

      - name: Install PlatformIO
        run: |
          python -m pip install --upgrade pip
          pip install --upgrade platformio

      - name: Run PlatformIO
        working-directory: ./firmware
        run: pio run -e debug -v

However, the workflow always fails when running PIO with the following error:

##[debug]Evaluating condition for step: 'Run PlatformIO'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run PlatformIO
##[debug]Loading inputs
##[debug]Loading env
Run pio run -e debug -v
##[debug]/usr/bin/bash -e /home/runner/work/_temp/957a9010-906c-485a-90c4-d7821ce1e555.sh
Error: No such file or directory
##[debug]System.ComponentModel.Win32Exception (2): No such file or directory
##[debug]   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
##[debug]   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
##[debug]   at System.Diagnostics.Process.Start()
##[debug]   at GitHub.Runner.Sdk.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Channel`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
##[debug]   at GitHub.Runner.Common.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Channel`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
##[debug]   at GitHub.Runner.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
##[debug]   at GitHub.Runner.Worker.Handlers.ScriptHandler.RunAsync(ActionRunStage stage)
##[debug]   at GitHub.Runner.Worker.ActionRunner.RunAsync()
##[debug]   at GitHub.Runner.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
##[debug]Finishing: Run PlatformIO

Could anyone please support me to fix it? The error is totally not clear, so I am not sure what is missing.

Using windows-latest as runs-on works properly! Anyway, I would very much like to get it working also using Ubuntu as well.

Here is my platformio.ini (in case it is needed):

; PlatformIO Project Configuration File

[platformio]
default_envs = debug

[common]
framework = arduino
lib_ldf_mode = chain
monitor_speed = 115200
build_unflags =
	-std=c++11
	-fno-exceptions
build_flags =
	-std=c++17
	-fexceptions
	-D SERIAL_BAUD_RATE=${common.monitor_speed}
	; -D NO_GLOBAL_INSTANCES
board_build.filesystem = littlefs
;extra_scripts =
;	./littlefsbuilder.py
lib_deps =
	bblanchon/ArduinoJson @ ^6.17.2
	https://github.com/lorol/LITTLEFS.git#fe1369cc504a280ead022970ccecd5b8fe3e31b8
	https://github.com/Links2004/arduinoWebSockets.git#a14b6b73b4f05e189ca49d6e84202c2b55db528a
	madhephaestus/ESP32Servo @ ^0.9.0
	https://github.com/MohammedNoureldin/CmdParser.git#e07f25fdf1bb9ddb135307e2ffafea7124a0e624
firmware_version = '"0.1.0+${UNIX_TIME}"'

[esp32_base]
platform = espressif32
board = esp32dev
platform_packages = 
	; Uses new tool chain with a non-released Arduino package to be able to compile with C++17 (C++17 may become the default in the future, therefore this may be soon not necessary).
	toolchain-xtensa@~5.100200.0
	framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#93bcf5f2502dbc448ddb93cdcfb789ce14e574b9
board_build.partitions = default.csv 
board_build.f_cpu = 80000000L

[env:release]
extends = esp32_base, common
build_flags =
	${common.build_flags}
	-D RELEASE
	-D FIRMWARE_VERSION=${common.firmware_version}
	-D FIRMWARE_URL='"https://XXX.execute-api.eu-central-1.amazonaws.com/dev/firmware-file-if-newer/${common.firmware_version}"'
	-D MESSAGING_ENDPOINT_HOST='"XXX.execute-api.eu-central-1.amazonaws.com"'
	-D MESSAGING_ENDPOINT_PORT="443"
	-D MESSAGING_ENDPOINT_URL='"/dev"'

[env:debug]
extends = env:release
build_type = debug
build_flags =
	${common.build_flags}
	-D DEBUG
	-D DEBUG_ESP_PORT=Serial
	-D CORE_DEBUG_LEVEL=4
	-D FIRMWARE_VERSION=${common.firmware_version}
	-D FIRMWARE_URL='"https://XXX.execute-api.eu-central-1.amazonaws.com/dev/firmware-file-if-newer/${common.firmware_version}"'
	-D MESSAGING_ENDPOINT_HOST='"XXX.amazonaws.com"'
	-D MESSAGING_ENDPOINT_PORT="443"
	-D MESSAGING_ENDPOINT_URL='"/dev"'

[env:native_test]
platform = native
lib_compat_mode = off
lib_extra_dirs =
	test/ESP8266-Arduino-GMocks
lib_deps =
	${common.lib_deps}
	google/googletest @ ^1.10.0
build_flags =
	; -I "${platformio.test_dir}/ESP8266-Arduino-GMocks/"

Hm maybe it can’t find PlatformIO at all in the path? Is there a way you can run just pio --version first to see if you can get an output from that? It doesn’t look to me as if PlatformIO is executed at all, otherwise it would surely say more than “No such file or directory”.

Actually this was the first error that it cannot find platformio.ini, I fixed it by changing the working-directory, and since that I get the error shown in my question, which means it can find platformio.ini file.

Can you still make absolutely sure of that by adding another action before the build with like

      - name: Check PlatformIO
        run: |
          pio system info

?

Check PlatformIO step worked properly.

Strange. But the exception trace talk about a System.Component.Win32Exception (2): No such file or directory and that doesn’t seem to come from PlatformIO – this looks like an exception in C# code. PlatformIO is written in Python.

Can you maybe try that without ./ or an absolute path? Or with -d as mentioned above?

That is exactly what confused me, that C# exception.

Sorry but I did not understand exactly what you mean by -d?

Instead of

Try something like

      - name: Run PlatformIO
        run: pio run -d firmware -e debug -v

to pass the working-directory / project path differently.

hmm, this is yet again weird, this cannot find firmware folder:

Ah so it 100% has to do something with the path. Then the error message before comes probably from the Github actions logic not being able to change into the working-directory you gave it.

You can execute some basic pwd and dir / ls -lha commands to figure out where your current path is?

Hmm, this is the current output:

And this is the structure of my repo:

image

Ah but Firmware is in capital here. Linux has a case-sensitive filesystem, unlike Windows. Have you tried Firmware as the working-directory or the value for -d?

1 Like

OMG, that’s embarrassing. Thanks a lot max! You saw what my eyes didn’t. Thanks god that I showed you the structure of my project.

That explains why it worked with windows-latest.

Now I have another error but after it spent a while building. I will debug the problem by myself and then let you know.

Thanks a lot again Max!

1 Like

This is a bit not relevant, but do you have any idea why is this happening? It cannot find LittleFS (though it is installed successfully and it compiled on windows-latest as shown before).

UPDATE:

Well this seems also to have something to do with capital letters. I am still doing some further investigations.

1 Like

Yuhu, now it builds! I used somewhere also some wrong letter cases which was not a problem on Windows, but on Ubuntu. Fixing it solved all problems. Thanks again Max for your support!

image

1 Like