arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.28k stars 371 forks source link

arduino-cli v1.0.x breaks arduino/compile-sketches action for Teensy boards #2658

Closed tfry-git closed 1 month ago

tfry-git commented 1 month ago

Describe the problem

Around early June, the arduino/compile-sketches-action (https://github.com/arduino/compile-sketches/) fails for the Teensy core (https://www.pjrc.com/teensy/package_teensy_index.json). The error message is:

The compilation itself seems to work, as before, but always ends with:

Opening Teensy Loader... Unable find Teensy Loader. (p) Is the Teensy Loader application running? quit

Both the above message, and the unsuccessful exit are new.

Testing the various components involved, this is neither due to updates in compile-sketches, nor it the core. However, downgrading arduino-cli to v0.35.3 fixes the issue.

It should be noted that an upload is absolutely not required at this point. We're essentially just running arduino-cli compile, here.

Further resources:

To reproduce

This probably needs to be run inside a github-action, where the Teensy loader is not available.

An example workflow shall contain:

steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Compile examples
        uses: arduino/compile-sketches@v1
        with:
          cli-version: 0.35.3  # may or may not be given, to toggle triggering the bug
          github-token: ${{ secrets.GITHUB_TOKEN }}
          fqbn: teensy:avr:teensy36
          platforms: |
              - name: teensy:avr
                source-url: https://www.pjrc.com/teensy/package_teensy_index.json
          sketch-paths: |
            - examples

Expected behavior

arduino-cli compile should compile, only, not attempt to contact the upload daemon.

Arduino CLI version

v1.0.x

Operating system

Linux

Operating system version

Ubuntu (via github actions docker)

Additional context

No response

Issue checklist

per1234 commented 1 month ago

Here is a more simplified demo workflow that reproduces the fault by using Arduino CLI directly rather than depending on the arduino/compile-sketches action:

on:
  push:

jobs:
  demo:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          repository: arduino/arduino-cli

      - uses: actions/setup-go@v5
        with:
          go-version: 1.21

      - uses: arduino/setup-task@v2
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          version: 3.x

      - run: |
          task build

      - run: |
          ./arduino-cli core install --additional-urls https://www.pjrc.com/teensy/package_teensy_index.json teensy:avr
          ./arduino-cli sketch new "${{ runner.temp }}/Foo"

      - run: |
          ./arduino-cli compile --fqbn teensy:avr:teensy36 "${{ runner.temp }}/Foo"
cmaglie commented 1 month ago

@tfry-git thanks for the bug report, and thanks @per1234 for the slimmed-down example.

After some testing, I found that while running under CI the latest CLI runs the Teensy loader, while the 0.35.x does not. Instead in a desktop environment, the Teensy loader is always executed.

Investigating...

cmaglie commented 1 month ago

Fixed by #2669, it will be released on Arduino CLI 1.0.3.

cmaglie commented 1 month ago

Arduino CLI 1.0.3 has been released, the gh action should run without issues now.