The Arduino Boards Manager system installs tool dependencies along with a platform. When you specify a Boards Manager-sourced platform dependency via the action's platforms
input the managed platform dependencies are installed automatically.
If an alternative platform dependency source is used this automatic tool dependency installation does not occur. The convenient way to install the tool dependencies in this case is to install a Boards Manager-sourced platform that has a dependency on the required tools in addition to the target platform from the alternative source.
Example:
- uses: arduino/compile-sketches@v1
with:
platforms: |
# Use Boards Manager to install the latest release of the platform to get the toolchain.
- name: arduino:avr
# Overwrite the Boards Manager installation with the development version of the platform.
- source-url: https://github.com/arduino/ArduinoCore-avr.git
name: arduino:avr
Arduino boards platforms typically bundle all dependencies. However, there are some platforms that require the user to manually install dependencies on their system in order to use the platform.
The arduino/compile-sketches action runs in the same environment as the rest of the steps of the workflow job, which means you can simply perform the dependency installation in a prior step of the job.
Example:
- run: <some dependency installation command>
- uses: arduino/compile-sketches@v1
The arduino/compile-sketches action uses a Python virtual environment. In order to enable user installation of Python package dependencies of boards platforms, the packages installed in the "user site-packages" folder are included in this virtual environment.
In order to be certain your installation of a package dependency will be available to the platform, add the --ignore-installed
and --user
flags to the pip command used to install the package.
Example:
- run: pip install --ignore-installed --user pyserial
- uses: arduino/compile-sketches@v1
The arduino/compile-sketches action supports installing platform and library dependencies of the sketches by cloning the repository specified via the source-url
field of the platforms
or libraries
inputs.
With a public repository, the dependency definition will look something like this:
libraries: |
- source-url: https://github.com/arduino-libraries/Servo.git
However, if arduino-libraries/Servo
was a private repository the installation of this library by the action would fail:
fatal: could not read Username for 'https://github.com': No such device or address
In this case is necessary to configure the repository URL to provide the authentication required for Git to clone the repository, as documented here. For private GitHub repositories, the following URL format can be used:
https://<token>@github.com/<repo slug>.git
where <token>
is a "personal access token" with repo
scope from the account of a user with access to the private repository.
ⓘ You might find it convenient to create the token under a "machine user" account.
In order to avoid leaking the token, it must be stored in a secret, and that secret referenced in the URL.
Example:
- uses: arduino/compile-sketches@v1
with:
libraries: |
- source-url: https://${{ secrets.REPO_SCOPE_TOKEN }}@github.com/octocat/SomePrivateLib.git
ⓘ The automatically generated GITHUB_TOKEN
secret can not be used for this purpose as it lacks the necessary permissions.