Skip to content

Pin to last compatible action version in sketch compile workflow #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Sep 22, 2021

This library requires a modified "arduino_threads" variant of Arduino CLI. Since the time that variant was made, there was a breaking change to the key names of Arduino CLI's JSON format output (arduino/arduino-cli#1223). The arduino/compile-sketches action uses some of the affected keys and so had to be updated to use the new keys (arduino/compile-sketches#20). A translation system was put in place to provide backwards compatibility. However, this translation system requires that the Arduino CLI version specified via the action's cli-version input be semver-compliant so that it can determine whether it came before or after the breaking change.

The "arduino_threads" variant of Arduino CLI has the fatal combination of the old keys and non-semver version, meaning it is not compatible with versions of the arduino/compile-sketches action that came after the fix for the key name changes, which results in a spurious failure of the workflow runs.
For example:
https://github.com/bcmi-labs/Arduino_Threads/pull/19/checks?check_run_id=3674417845#step:6:198

Installing platform from path: extras/ArduinoCore-mbed
Traceback (most recent call last):
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 1717, in <module>
    main()  # pragma: no cover
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 56, in main
    compile_sketches.compile_sketches()
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 198, in compile_sketches
    self.install_platforms()
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 311, in install_platforms
    self.install_platforms_from_path(platform_list=platform_list.path)
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 493, in install_platforms_from_path
    platform_installation_path = self.get_platform_installation_path(platform=platform)
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 532, in get_platform_installation_path
    if installed_platform[self.cli_json_key("core list", "ID")] == platform[self.dependency_name_key]:
KeyError: 'id'

The workaround is to pin version of the arduino/compile-sketches action used in the "Compile Examples" workflow to the
last compatible ref
. Fortunately, that is quite recent in the action's revision history and none of the changes that came since should be relevant for this application.

This library requires a modified "arduino_threads" variant of Arduino CLI. Since the time that variant was made, there
was a breaking change to the key names of Arduino CLI's JSON format output. The `arduino/compile-sketches` action uses
some of the affected keys and so had to be updated to use the new keys. A translation system was put in place to provide
backwards compatibility. However, this translation system requires that the Arduino CLI version specified via the
action's `cli-version` input be semver-compliant so that it can determine whether it came before or after the breaking
change.

The "arduino_threads" variant of Arduino CLI has the fatal combination of the old keys and non-semver version, meaning it is not compatible with versions of the `arduino/compile-sketches` action that came after the fix for the key name changes:

```
Installing platform from path: extras/ArduinoCore-mbed
Traceback (most recent call last):
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 1717, in <module>
    main()  # pragma: no cover
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 56, in main
    compile_sketches.compile_sketches()
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 198, in compile_sketches
    self.install_platforms()
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 311, in install_platforms
    self.install_platforms_from_path(platform_list=platform_list.path)
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 493, in install_platforms_from_path
    platform_installation_path = self.get_platform_installation_path(platform=platform)
  File "/home/runner/work/_actions/arduino/compile-sketches/main/compilesketches/compilesketches.py", line 532, in get_platform_installation_path
    if installed_platform[self.cli_json_key("core list", "ID")] == platform[self.dependency_name_key]:
KeyError: 'id'
```

The workaround is to pin version of the `arduino/compile-sketches` action used in the "Compile Examples" workflow to the
last compatible ref. Fortunately, that is quite recent in the action's revision history and none of the changes that came
since should be relevant for this application.
@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 requested a review from aentinger September 22, 2021 13:21
@facchinm
Copy link
Collaborator

I'll try to forward-port the patch on newer arduino-cli in the next few days 😉

@aentinger
Copy link
Contributor

I'll try to forward-port the patch on newer arduino-cli in the next few days wink

That would be terrific, @facchinm 🚀

Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you @per1234 🚀

@aentinger aentinger merged commit 15bdb40 into master Sep 23, 2021
@aentinger aentinger deleted the pin-action branch September 23, 2021 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants