-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from arduino/development
Create GitHub Actions action to run Arduino Lint
- Loading branch information
Showing
18 changed files
with
4,525 additions
and
4,790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[codespell] | ||
# In the event of a false positive, add the problematic word, in all lowercase, here: | ||
ignore-words-list = afterall | ||
check-filenames = | ||
check-hidden = | ||
skip = ./.git,./dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Development | ||
|
||
To work on the codebase you have to install all the dependencies: | ||
|
||
```sh | ||
# npm install | ||
``` | ||
|
||
To run tests set the environment variable `GITHUB_TOKEN` with a valid Personal Access Token and then: | ||
|
||
```sh | ||
# npm run test | ||
``` | ||
|
||
See the [official Github documentation][pat-docs] to learn more about Personal Access Tokens. | ||
|
||
## Release | ||
|
||
1. `npm install` to add all the dependencies, included development. | ||
1. `npm run build` to build the Action under the `./lib` folder. | ||
1. `npm run test` to see everything works as expected. | ||
1. `npm run pack` to package for distribution | ||
1. `git add src dist` to check in the code that matters. | ||
1. If the release will increment the major version, update the action refs in the examples in README.md | ||
(e.g., `uses: arduino/arduino-lint-action@v1` -> `uses: arduino/arduino-lint-action@v2`). | ||
1. open a PR and request a review. | ||
1. After PR is merged, create a release, following the `vX.X.X` tag name convention. | ||
1. After the release, rebase the release branch for that major version (e.g., `v1` branch for the v1.x.x tags) on the | ||
tag. If no branch exists for the release's major version, create one. | ||
|
||
[pat-docs]: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
schedule: # Scheduled trigger checks for breakage caused by changes to arduino-lint | ||
# run every Tuesday at 3 AM UTC | ||
- cron: "0 3 * * 2" | ||
# workflow_dispatch event allows the workflow to be triggered manually | ||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch | ||
workflow_dispatch: | ||
# repository_dispatch event allows the workflow to be triggered via the GitHub API | ||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch | ||
repository_dispatch: | ||
|
||
jobs: | ||
defaults: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout local repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build action | ||
run: | | ||
npm install | ||
npm run build | ||
npm run pack | ||
# Run the action using default values as much as possible. | ||
- name: Run action | ||
uses: ./ # Use the action from the local path. | ||
with: | ||
path: .github/workflows/testdata/SpecificationSketch | ||
|
||
expected-pass: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
REPORT_FILE_PATH: /tmp/report.json | ||
steps: | ||
- name: Checkout local repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build action | ||
run: | | ||
npm install | ||
npm run build | ||
npm run pack | ||
# The contents of the test data path are structured so that the step will fail if arduino-lint is not run with the configuration according to these inputs. | ||
- name: Run action | ||
uses: ./ | ||
with: | ||
path: .github/workflows/testdata/some-projects | ||
compliance: permissive | ||
library-manager: false | ||
project-type: library | ||
recursive: true | ||
report-file: ${{ env.REPORT_FILE_PATH }} | ||
official: true | ||
|
||
- name: Verify report file exists | ||
run: | | ||
[ -e "${{ env.REPORT_FILE_PATH }}" ] | ||
expected-fail: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout local repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build action | ||
run: | | ||
npm install | ||
npm run build | ||
npm run pack | ||
# The contents of the test data path are structured so that the step will fail if arduino-lint is run with the default configuration. | ||
- name: Run action | ||
id: arduino-lint | ||
continue-on-error: true | ||
uses: ./ | ||
with: | ||
path: .github/workflows/testdata/projects | ||
|
||
- name: Fail the job if the action run succeeded | ||
if: steps.arduino-lint.outcome == 'success' | ||
run: | | ||
echo "::error::The action run was expected to fail, but passed!" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Spell Check | ||
|
||
on: | ||
pull_request: | ||
push: | ||
schedule: # Schedule trigger for catching new misspelling detections resulting from dictionary updates. | ||
# Run every Saturday at 3 AM UTC. | ||
- cron: "0 3 * * 2" | ||
# workflow_dispatch event allows the workflow to be triggered manually | ||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch | ||
workflow_dispatch: | ||
# repository_dispatch event allows the workflow to be triggered via the GitHub API | ||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch | ||
repository_dispatch: | ||
|
||
jobs: | ||
spellcheck: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# See: https://github.com/codespell-project/actions-codespell/blob/master/README.md | ||
- name: Spell check | ||
uses: codespell-project/actions-codespell@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
.github/workflows/testdata/SpecificationSketch/SpecificationSketch.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
void setup() {} | ||
void loop() {} |
2 changes: 2 additions & 0 deletions
2
.github/workflows/testdata/some-projects/InvalidSketch/Invalid Sketch.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
void setup() {} | ||
void loop() {} |
Empty file.
11 changes: 11 additions & 0 deletions
11
.github/workflows/testdata/some-projects/PermissiveLibrary/library.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name=ArduinoGraphics | ||
version=1.0.0 | ||
author=Cristian Maglie <c.maglie@example.com>, Pippo Pluto <pippo@example.com> | ||
maintainer=Cristian Maglie <c.maglie@example.com> | ||
sentence=A library that requires the permissive compliance setting to pass the checks. | ||
paragraph= | ||
category=Other | ||
url=http://example.com/ | ||
architectures=avr | ||
# Invalid permissive value only allowed in permissive compliance mode | ||
permissive=foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,124 @@ | ||
# setup-arduino-cli | ||
# `arduino/arduino-lint-action` | ||
|
||
[![Actions Status](https://github.com/arduino/setup-arduino-cli/workflows/Test%20Action/badge.svg)](https://github.com/arduino/setup-arduino-cli/actions) | ||
[![Tests Status](https://github.com/arduino/arduino-lint-action/workflows/Test%20Action/badge.svg)](https://github.com/arduino/arduino-lint-action/actions?workflow=Test+Action) | ||
[![Integration Tests Status](https://github.com/arduino/arduino-lint-action/workflows/Integration%20Tests/badge.svg)](https://github.com/arduino/arduino-lint-action/actions?workflow=Integration+Tests) | ||
[![Spellcheck Status](https://github.com/arduino/arduino-lint-action/workflows/Spell%20Check/badge.svg)](https://github.com/arduino/arduino-lint-action/actions?workflow=Spell+Check) | ||
|
||
This action makes the `arduino-cli` tool available to Workflows. | ||
[GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions) action that uses | ||
[Arduino Lint](https://github.com/arduino/arduino-lint) to check for problems with [Arduino](https://www.arduino.cc/) | ||
projects: | ||
|
||
## Usage | ||
- Libraries | ||
- Sketches | ||
- Boards platforms | ||
|
||
To get the latest stable version of `arduino-cli` just add this step: | ||
## Table of contents | ||
|
||
```yaml | ||
- name: Install Arduino CLI | ||
uses: arduino/setup-arduino-cli@v1.1.1 | ||
``` | ||
<!-- toc --> | ||
|
||
If you want to pin a major or minor version you can use the `.x` wildcard: | ||
- [Inputs](#inputs) | ||
- [`path`](#path) | ||
- [`version`](#version) | ||
- [`compliance`](#compliance) | ||
- [`format`](#format) | ||
- [`library-manager`](#library-manager) | ||
- [`project-type`](#project-type) | ||
- [`recursive`](#recursive) | ||
- [`report-file`](#report-file) | ||
- [`token`](#token) | ||
- [Usage](#usage) | ||
|
||
```yaml | ||
- name: Install Arduino CLI | ||
uses: arduino/setup-arduino-cli@v1.1.1 | ||
with: | ||
version: "0.x" | ||
``` | ||
<!-- tocstop --> | ||
|
||
To pin the exact version: | ||
## Inputs | ||
|
||
```yaml | ||
- name: Install Arduino CLI | ||
uses: arduino/setup-arduino-cli@v1.1.1 | ||
with: | ||
version: "0.5.0" | ||
``` | ||
### `path` | ||
|
||
## Examples | ||
Path containing Arduino project(s). | ||
|
||
[Here][example] there is a good example on how to use the action. | ||
See also the [Arduino on GitHub Actions blogpost][blogpost] to learn more. | ||
**Default**: `./` | ||
|
||
## Development | ||
### `version` | ||
|
||
To work on the codebase you have to install all the dependencies: | ||
The version of [Arduino Lint](https://github.com/arduino/arduino-lint) to use. | ||
Can be an exact version (e.g., `1.0.0`) or a version range (e.g., `1.x`). | ||
|
||
```sh | ||
# npm install | ||
``` | ||
**Default**: `1.x` | ||
|
||
To run tests set the environment variable `GITHUB_TOKEN` with a valid Personal Access Token and then: | ||
### `compliance` | ||
|
||
```sh | ||
# npm run test | ||
``` | ||
Configure how strict the tool is about which checks are considered errors vs warnings if they don't pass. | ||
|
||
#### Supported values | ||
|
||
- `strict` - enforces best practices, above and beyond the minimum requirements for specification compliance. Use this setting to ensure the best experience for the users of the project. | ||
- `specification` - enforces compliance with the official Arduino project specifications. | ||
- `permissive` - will cause the checks to fail only when severe problems are found. Although a project that passes at the permissive setting will work with the current Arduino development software versions, it may not be fully specification-compliant, risking incompatibility or a poor experience for the users. | ||
|
||
**Default**: `specification` | ||
|
||
### `library-manager` | ||
|
||
Configure the checks for libraries in the [Arduino Library Manager](https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ) index. | ||
|
||
#### Supported values | ||
|
||
- `submit` - Also run additional checks required to pass before a library is accepted for inclusion in the index. | ||
- `update`- Also run additional checks required to pass before a library is accepted for inclusion in the index. | ||
- `false` - Don't run any Library Manager-specific checks. | ||
|
||
**Default**: `submit` for libraries, `false` for other project types | ||
|
||
### `project-type` | ||
|
||
Configures which types of projects to check, along with their subprojects. | ||
|
||
See the [official Github documentation][pat-docs] to know more about Personal Access Tokens. | ||
#### Supported values | ||
|
||
- `sketch` | ||
- `library` | ||
- `all` - Run checks on any type of project that is detected | ||
|
||
**Default**: `all` | ||
|
||
### `recursive` | ||
|
||
Set to `true` to search path recursively for Arduino projects to check. | ||
|
||
**Default**: `false` | ||
|
||
### `report-file` | ||
|
||
Save a JSON formatted report on the checks to this file. | ||
|
||
### `verbose` | ||
|
||
Set to `true` to show more information in the log about the checks being run. | ||
|
||
**Default**: `false` | ||
|
||
### `token` | ||
|
||
GitHub access token used to get information from the GitHub API. | ||
|
||
**Default**: [`GITHUB_TOKEN`](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow) | ||
|
||
## Usage | ||
|
||
The minimal workflow to run the default checks on the projects in the repository: | ||
|
||
```yaml | ||
on: [push, pull_request] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: arduino/arduino-lint-action@v1 | ||
``` | ||
## Release | ||
## Contributing | ||
1. `npm install` to add all the dependencies, included development. | ||
2. `npm run build` to build the Action under the `./lib` folder. | ||
3. `npm run test` to see everything works as expected. | ||
4. `npm run pack` to package for distribution | ||
5. `git add src dist` to check in the code that matters. | ||
6. open a PR and request a review. | ||
To report bugs or make feature requests, please submit an issue: https://github.com/arduino/arduino-lint-action/issues | ||
[pat-docs]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token | ||
[example]: https://github.com/arduino/arduino-cli-example/blob/master/.github/workflows/test.yaml | ||
[blogpost]: https://blog.arduino.cc/2019/11/14/arduino-on-github-actions/ | ||
Pull requests are welcome! Please see the [contribution guidelines](.github/CONTRIBUTING.md) for information. |
Oops, something went wrong.