├── .gitignore ├── go.mod ├── .prettierignore ├── .markdownlintignore ├── .npmrc ├── .prettierrc.yml ├── .ecrc ├── globals └── globals.go ├── .markdown-link-check.json ├── package.json ├── .codespellrc ├── pyproject.toml ├── version └── version.go ├── .github ├── dependabot.yml └── workflows │ ├── check-workflows-task.yml │ ├── spell-check-task.yml │ ├── check-general-formatting-task.yml │ ├── check-poetry-task.yml │ ├── check-taskfiles.yml │ ├── check-markdown-task.yml │ ├── check-yaml-task.yml │ ├── check-license.yml │ ├── check-npm-task.yml │ ├── check-go-dependencies-task.yml │ ├── sync-labels-npm.yml │ ├── check-go-task.yml │ ├── check-prettier-formatting-task.yml │ └── release-go-crosscompile-task.yml ├── .markdownlint.yml ├── .yamllint.yml ├── .licensed.yml ├── README.md ├── DistTasks.yml ├── main.go ├── Taskfile.yml └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /arduinoOTA 2 | /arduinoOTA.exe 3 | /node_modules/ 4 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/arduino/arduinoOTA 2 | 3 | go 1.17 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .licenses/ 2 | __pycache__/ 3 | node_modules/ 4 | poetry.lock 5 | -------------------------------------------------------------------------------- /.markdownlintignore: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown/.markdownlintignore 2 | .licenses/ 3 | __pycache__/ 4 | node_modules/ 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm/.npmrc 2 | # See: https://docs.npmjs.com/cli/configuring-npm/npmrc 3 | 4 | engine-strict=true 5 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting/toml/.prettierrc.yml 2 | plugins: 3 | - prettier-plugin-toml 4 | -------------------------------------------------------------------------------- /.ecrc: -------------------------------------------------------------------------------- 1 | { 2 | "Exclude": [ 3 | "^\\.git[/\\\\]", 4 | "^\\.licenses[/\\\\]", 5 | "__pycache__[/\\\\]", 6 | "node_modules[/\\\\]", 7 | "^LICENSE\\.txt$", 8 | "^poetry\\.lock$" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /globals/globals.go: -------------------------------------------------------------------------------- 1 | package globals 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | 7 | "github.com/arduino/arduinoOTA/version" 8 | ) 9 | 10 | var ( 11 | // VersionInfo contains all info injected during build 12 | VersionInfo = version.NewInfo(filepath.Base(os.Args[0])) 13 | ) 14 | -------------------------------------------------------------------------------- /.markdown-link-check.json: -------------------------------------------------------------------------------- 1 | { 2 | "httpHeaders": [ 3 | { 4 | "urls": ["https://docs.github.com/"], 5 | "headers": { 6 | "Accept-Encoding": "gzip, deflate, br" 7 | } 8 | } 9 | ], 10 | "retryOn429": true, 11 | "timeout": "30s", 12 | "retryCount": 3, 13 | "aliveStatusCodes": [200, 206] 14 | } 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "ajv-cli": "^5.0.0", 4 | "ajv-formats": "^3.0.1", 5 | "github-label-sync": "3.0.0", 6 | "markdown-link-check": "^3.14.2", 7 | "markdownlint-cli": "^0.47.0", 8 | "prettier": "^3.7.4", 9 | "prettier-plugin-toml": "2.0.6" 10 | }, 11 | "engines": { 12 | "node": "22.x" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc 2 | # See: https://github.com/codespell-project/codespell#using-a-config-file 3 | [codespell] 4 | # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: 5 | ignore-words-list = , 6 | skip = ./.licenses,.git,__pycache__,node_modules,go.mod,go.sum,package-lock.json,poetry.lock,yarn.lock,./arduinoOTA,./arduinoOTA.exe 7 | builtin = clear,informal,en-GB_to_en-US 8 | check-filenames = 9 | check-hidden = 10 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry/pyproject.toml 2 | 3 | [tool.poetry] 4 | package-mode = false 5 | 6 | [tool.poetry.dependencies] 7 | python = "~3.9" 8 | 9 | [tool.poetry.group.dev.dependencies] 10 | yamllint = "^1.37.1" 11 | codespell = "^2.4.1" 12 | 13 | # The dependencies in this group are installed using pipx; NOT Poetry. The use of the `tool.poetry.group` super-table 14 | # is a hack required in order to be able to manage updates of these dependencies via Dependabot. 15 | [tool.poetry.group.pipx] 16 | optional = true 17 | 18 | [tool.poetry.group.pipx.dependencies] 19 | poetry = "2.2.1" 20 | 21 | [build-system] 22 | requires = ["poetry-core>=1.0.0"] 23 | build-backend = "poetry.core.masonry.api" 24 | -------------------------------------------------------------------------------- /version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import "fmt" 4 | 5 | var ( 6 | defaultVersionString = "0.0.0-git" 7 | versionString = "" 8 | commit = "" 9 | date = "" 10 | ) 11 | 12 | // Info is a struct that contains information about the application 13 | type Info struct { 14 | Application string `json:"Application"` 15 | VersionString string `json:"VersionString"` 16 | Commit string `json:"Commit"` 17 | Date string `json:"Date"` 18 | } 19 | 20 | // NewInfo returns a pointer to an updated Info struct 21 | func NewInfo(application string) *Info { 22 | return &Info{ 23 | Application: application, 24 | VersionString: versionString, 25 | Commit: commit, 26 | Date: date, 27 | } 28 | } 29 | 30 | func (i *Info) String() string { 31 | return fmt.Sprintf("%[1]s Version: %[2]s Commit: %[3]s Date: %[4]s", i.Application, i.VersionString, i.Commit, i.Date) 32 | } 33 | 34 | //nolint:gochecknoinits 35 | func init() { 36 | if versionString == "" { 37 | versionString = defaultVersionString 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # See: https://docs.github.com/code-security/dependabot/working-with-dependabot/dependabot-options-reference#about-the-dependabotyml-file 2 | version: 2 3 | 4 | updates: 5 | # Configure check for outdated GitHub Actions actions in workflows. 6 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/dependabot/README.md 7 | # See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 8 | - package-ecosystem: github-actions 9 | directory: /.github/workflows 10 | assignees: 11 | - per1234 12 | open-pull-requests-limit: 100 13 | schedule: 14 | cronjob: 0 12 * * * 15 | interval: cron 16 | labels: 17 | - "topic: infrastructure" 18 | 19 | - package-ecosystem: npm 20 | directory: / 21 | open-pull-requests-limit: 100 22 | schedule: 23 | cronjob: 0 14 * * * 24 | interval: cron 25 | labels: 26 | - "topic: infrastructure" 27 | assignees: 28 | - per1234 29 | 30 | - package-ecosystem: pip 31 | directory: / 32 | open-pull-requests-limit: 100 33 | schedule: 34 | cronjob: 0 15 * * * 35 | interval: cron 36 | labels: 37 | - "topic: infrastructure" 38 | assignees: 39 | - per1234 40 | -------------------------------------------------------------------------------- /.github/workflows/check-workflows-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-workflows-task.md 2 | name: Check Workflows 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | push: 7 | paths: 8 | - ".github/workflows/*.ya?ml" 9 | - ".npmrc" 10 | - "package.json" 11 | - "package-lock.json" 12 | - "Taskfile.ya?ml" 13 | pull_request: 14 | paths: 15 | - ".github/workflows/*.ya?ml" 16 | - ".npmrc" 17 | - "package.json" 18 | - "package-lock.json" 19 | - "Taskfile.ya?ml" 20 | schedule: 21 | # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. 22 | - cron: "0 8 * * TUE" 23 | workflow_dispatch: 24 | repository_dispatch: 25 | 26 | jobs: 27 | validate: 28 | runs-on: ubuntu-latest 29 | permissions: 30 | contents: read 31 | 32 | steps: 33 | - name: Checkout repository 34 | uses: actions/checkout@v6 35 | 36 | - name: Setup Node.js 37 | uses: actions/setup-node@v6 38 | with: 39 | node-version-file: package.json 40 | 41 | - name: Install Task 42 | uses: arduino/setup-task@v2 43 | with: 44 | repo-token: ${{ secrets.GITHUB_TOKEN }} 45 | version: 3.x 46 | 47 | - name: Validate workflows 48 | run: | 49 | task \ 50 | --silent \ 51 | ci:validate 52 | -------------------------------------------------------------------------------- /.markdownlint.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown/.markdownlint.yml 2 | # See: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md 3 | # The code style defined in this file is the official standardized style to be used in all Arduino projects and should 4 | # not be modified. 5 | # Note: Rules disabled solely because they are redundant to Prettier are marked with a "Prettier" comment. 6 | 7 | default: false 8 | MD001: false 9 | MD002: false 10 | MD003: false # Prettier 11 | MD004: false # Prettier 12 | MD005: false # Prettier 13 | MD006: false # Prettier 14 | MD007: false # Prettier 15 | MD008: false # Prettier 16 | MD009: 17 | br_spaces: 0 18 | strict: true 19 | list_item_empty_lines: false # Prettier 20 | MD010: false # Prettier 21 | MD011: true 22 | MD012: false # Prettier 23 | MD013: false 24 | MD014: false 25 | MD018: true 26 | MD019: false # Prettier 27 | MD020: true 28 | MD021: false # Prettier 29 | MD022: false # Prettier 30 | MD023: false # Prettier 31 | MD024: false 32 | MD025: 33 | level: 1 34 | front_matter_title: '^\s*"?title"?\s*[:=]' 35 | MD026: false 36 | MD027: false # Prettier 37 | MD028: false 38 | MD029: 39 | style: one 40 | MD030: 41 | ul_single: 1 42 | ol_single: 1 43 | ul_multi: 1 44 | ol_multi: 1 45 | MD031: false # Prettier 46 | MD032: false # Prettier 47 | MD033: false 48 | MD034: false 49 | MD035: false # Prettier 50 | MD036: false 51 | MD037: true 52 | MD038: true 53 | MD039: true 54 | MD040: false 55 | MD041: false 56 | MD042: true 57 | MD043: false 58 | MD044: false 59 | MD045: true 60 | MD046: 61 | style: fenced 62 | MD047: false # Prettier 63 | -------------------------------------------------------------------------------- /.github/workflows/spell-check-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md 2 | name: Spell Check 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | pull_request: 9 | schedule: 10 | # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. 11 | - cron: "0 8 * * TUE" 12 | workflow_dispatch: 13 | repository_dispatch: 14 | 15 | jobs: 16 | run-determination: 17 | runs-on: ubuntu-latest 18 | permissions: {} 19 | outputs: 20 | result: ${{ steps.determination.outputs.result }} 21 | steps: 22 | - name: Determine if the rest of the workflow should run 23 | id: determination 24 | run: | 25 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 26 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 27 | if [[ 28 | "${{ github.event_name }}" != "create" || 29 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 30 | ]]; then 31 | # Run the other jobs. 32 | RESULT="true" 33 | else 34 | # There is no need to run the other jobs. 35 | RESULT="false" 36 | fi 37 | 38 | echo "result=$RESULT" >>$GITHUB_OUTPUT 39 | 40 | spellcheck: 41 | needs: run-determination 42 | if: needs.run-determination.outputs.result == 'true' 43 | runs-on: ubuntu-latest 44 | permissions: 45 | contents: read 46 | 47 | steps: 48 | - name: Checkout repository 49 | uses: actions/checkout@v6 50 | 51 | - name: Install Python 52 | uses: actions/setup-python@v6 53 | with: 54 | python-version-file: pyproject.toml 55 | 56 | - name: Install Task 57 | uses: arduino/setup-task@v2 58 | with: 59 | repo-token: ${{ secrets.GITHUB_TOKEN }} 60 | version: 3.x 61 | 62 | - name: Spell check 63 | run: task general:check-spelling 64 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-yaml/.yamllint.yml 2 | # See: https://yamllint.readthedocs.io/en/stable/configuration.html 3 | # The code style defined in this file is the official standardized style to be used in all Arduino tooling projects and 4 | # should not be modified. 5 | # Note: Rules disabled solely because they are redundant to Prettier are marked with a "Prettier" comment. 6 | 7 | rules: 8 | braces: 9 | level: error 10 | forbid: non-empty 11 | min-spaces-inside: -1 # Prettier 12 | max-spaces-inside: -1 # Prettier 13 | min-spaces-inside-empty: -1 # Prettier 14 | max-spaces-inside-empty: -1 # Prettier 15 | brackets: 16 | level: error 17 | forbid: non-empty 18 | min-spaces-inside: -1 # Prettier 19 | max-spaces-inside: -1 # Prettier 20 | min-spaces-inside-empty: -1 # Prettier 21 | max-spaces-inside-empty: -1 # Prettier 22 | colons: disable # Prettier 23 | commas: disable # Prettier 24 | comments: disable # Prettier 25 | comments-indentation: disable # Prettier 26 | document-end: disable # Prettier 27 | document-start: disable 28 | empty-lines: disable # Prettier 29 | empty-values: disable 30 | hyphens: disable # Prettier 31 | indentation: disable # Prettier 32 | key-duplicates: disable # Prettier 33 | key-ordering: disable 34 | line-length: 35 | level: warning 36 | max: 120 37 | allow-non-breakable-words: true 38 | allow-non-breakable-inline-mappings: true 39 | new-line-at-end-of-file: disable # Prettier 40 | new-lines: disable # Prettier 41 | octal-values: 42 | level: warning 43 | forbid-implicit-octal: true 44 | forbid-explicit-octal: false 45 | quoted-strings: disable 46 | trailing-spaces: disable # Prettier 47 | truthy: 48 | level: error 49 | allowed-values: 50 | - "true" 51 | - "false" 52 | - "on" # Used by GitHub Actions as a workflow key. 53 | check-keys: true 54 | 55 | yaml-files: 56 | # Source: https://github.com/ikatyang-collab/linguist-languages/blob/main/data/YAML.js (used by Prettier) 57 | - ".clang-format" 58 | - ".clang-tidy" 59 | - ".gemrc" 60 | - ".yamllint" 61 | - "glide.lock" 62 | - "*.yml" 63 | - "*.mir" 64 | - "*.reek" 65 | - "*.rviz" 66 | - "*.sublime-syntax" 67 | - "*.syntax" 68 | - "*.yaml" 69 | - "*.yaml-tmlanguage" 70 | - "*.yaml.sed" 71 | - "*.yml.mysql" 72 | 73 | ignore: | 74 | /.git/ 75 | __pycache__/ 76 | node_modules/ 77 | -------------------------------------------------------------------------------- /.licensed.yml: -------------------------------------------------------------------------------- 1 | # See: https://github.com/licensee/licensed/blob/main/docs/configuration.md 2 | sources: 3 | go: true 4 | 5 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies/GPL-3.0/.licensed.yml 6 | allowed: 7 | # The following are based on: https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses 8 | - gpl-1.0-or-later 9 | - gpl-1.0+ # Deprecated ID for `gpl-1.0-or-later` 10 | - gpl-2.0-or-later 11 | - gpl-2.0+ # Deprecated ID for `gpl-2.0-or-later` 12 | - gpl-3.0-only 13 | - gpl-3.0 # Deprecated ID for `gpl-3.0-only` 14 | - gpl-3.0-or-later 15 | - gpl-3.0+ # Deprecated ID for `gpl-3.0-or-later` 16 | - lgpl-2.0-or-later 17 | - lgpl-2.0+ # Deprecated ID for `lgpl-2.0-or-later` 18 | - lgpl-2.1-only 19 | - lgpl-2.1 # Deprecated ID for `lgpl-2.1-only` 20 | - lgpl-2.1-or-later 21 | - lgpl-2.1+ # Deprecated ID for `lgpl-2.1-or-later` 22 | - lgpl-3.0-only 23 | - lgpl-3.0 # Deprecated ID for `lgpl-3.0-only` 24 | - lgpl-3.0-or-later 25 | - lgpl-3.0+ # Deprecated ID for `lgpl-3.0-or-later` 26 | - fsfap 27 | - apache-2.0 28 | - artistic-2.0 29 | - clartistic 30 | - sleepycat 31 | - bsl-1.0 32 | - bsd-3-clause 33 | - cecill-2.0 34 | - bsd-3-clause-clear 35 | # "Cryptix General License" - no SPDX ID (https://github.com/spdx/license-list-XML/issues/456) 36 | - ecos-2.0 37 | - ecl-2.0 38 | - efl-2.0 39 | - eudatagrid 40 | - mit 41 | - bsd-2-clause # Subsumed by `bsd-2-clause-views` 42 | - bsd-2-clause-netbsd # Deprecated ID for `bsd-2-clause` 43 | - bsd-2-clause-views # This is the version linked from https://www.gnu.org/licenses/license-list.html#FreeBSD 44 | - bsd-2-clause-freebsd # Deprecated ID for `bsd-2-clause-views` 45 | - ftl 46 | - hpnd 47 | - imatix 48 | - imlib2 49 | - ijg 50 | # "Informal license" - this is a general class of license 51 | - intel 52 | - isc 53 | - mpl-2.0 54 | - ncsa 55 | # "License of Netscape JavaScript" - no SPDX ID 56 | - oldap-2.7 57 | # "License of Perl 5 and below" - possibly `Artistic-1.0-Perl` ? 58 | - cc0-1.0 59 | - cc-pddc 60 | - psf-2.0 61 | - ruby 62 | - sgi-b-2.0 63 | - smlnj 64 | - standardml-nj # Deprecated ID for `smlnj` 65 | - unicode-dfs-2015 66 | - upl-1.0 67 | - unlicense 68 | - vim 69 | - w3c 70 | - wtfpl 71 | - lgpl-2.0-or-later with wxwindows-exception-3.1 72 | - wxwindows # Deprecated ID for `lgpl-2.0-or-later with wxwindows-exception-3.1` 73 | - x11 74 | - xfree86-1.1 75 | - zlib 76 | - zpl-2.0 77 | - zpl-2.1 78 | # The following are based on individual license text 79 | - eupl-1.2 80 | - liliq-r-1.1 81 | - liliq-rplus-1.1 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # arduinoOTA 2 | 3 | [![Check General Formatting status](https://github.com/arduino/arduinoOTA/actions/workflows/check-general-formatting-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-general-formatting-task.yml) 4 | [![Check Go Dependencies status](https://github.com/arduino/arduinoOTA/actions/workflows/check-go-dependencies-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-go-dependencies-task.yml) 5 | [![Check Go status](https://github.com/arduino/arduinoOTA/actions/workflows/check-go-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-go-task.yml) 6 | [![Check npm status](https://github.com/arduino/arduinoOTA/actions/workflows/check-npm-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-npm-task.yml) 7 | [![Check Prettier Formatting status](https://github.com/arduino/arduinoOTA/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-prettier-formatting-task.yml) 8 | [![Spell Check status](https://github.com/arduino/arduinoOTA/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/spell-check-task.yml) 9 | [![Check Markdown status](https://github.com/arduino/arduinoOTA/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-markdown-task.yml) 10 | [![Check Poetry status](https://github.com/arduino/arduinoOTA/actions/workflows/check-poetry-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-poetry-task.yml) 11 | [![Check Taskfiles status](https://github.com/arduino/arduinoOTA/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-taskfiles.yml) 12 | [![Check Workflows status](https://github.com/arduino/arduinoOTA/actions/workflows/check-workflows-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-workflows-task.yml) 13 | [![Check YAML status](https://github.com/arduino/arduinoOTA/actions/workflows/check-yaml-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-yaml-task.yml) 14 | [![Check License status](https://github.com/arduino/arduinoOTA/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/check-license.yml) 15 | [![Sync Labels status](https://github.com/arduino/arduinoOTA/actions/workflows/sync-labels-npm.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/sync-labels-npm.yml) 16 | [![Release status](https://github.com/arduino/arduinoOTA/actions/workflows/release-go-crosscompile-task.yml/badge.svg)](https://github.com/arduino/arduinoOTA/actions/workflows/release-go-crosscompile-task.yml) 17 | 18 | **arduinoOTA** is a tool for uploading programs to [Arduino](https://arduino.cc/) boards over a network. 19 | 20 | ## Usage 21 | 22 | Run the following command for documentation of the command line interface: 23 | 24 | ``` 25 | arduinoOTA --help 26 | ``` 27 | 28 | ## Security 29 | 30 | If you think you found a vulnerability or other security-related bug in this project, please read our 31 | [security policy](https://github.com/arduino/arduino-lint/security/policy) and report the bug to our Security Team 🛡️ 32 | Thank you! 33 | 34 | e-mail contact: security@arduino.cc 35 | -------------------------------------------------------------------------------- /.github/workflows/check-general-formatting-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-general-formatting-task.md 2 | name: Check General Formatting 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | pull_request: 9 | schedule: 10 | # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to tools. 11 | - cron: "0 8 * * TUE" 12 | workflow_dispatch: 13 | repository_dispatch: 14 | 15 | jobs: 16 | run-determination: 17 | runs-on: ubuntu-latest 18 | permissions: {} 19 | outputs: 20 | result: ${{ steps.determination.outputs.result }} 21 | steps: 22 | - name: Determine if the rest of the workflow should run 23 | id: determination 24 | run: | 25 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 26 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 27 | if [[ 28 | "${{ github.event_name }}" != "create" || 29 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 30 | ]]; then 31 | # Run the other jobs. 32 | RESULT="true" 33 | else 34 | # There is no need to run the other jobs. 35 | RESULT="false" 36 | fi 37 | 38 | echo "result=$RESULT" >>$GITHUB_OUTPUT 39 | 40 | check: 41 | needs: run-determination 42 | if: needs.run-determination.outputs.result == 'true' 43 | runs-on: ubuntu-latest 44 | permissions: 45 | contents: read 46 | 47 | steps: 48 | - name: Set environment variables 49 | run: | 50 | # See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable 51 | echo "EC_INSTALL_PATH=${{ runner.temp }}/editorconfig-checker" >>"$GITHUB_ENV" 52 | 53 | - name: Checkout repository 54 | uses: actions/checkout@v6 55 | 56 | - name: Install Task 57 | uses: arduino/setup-task@v2 58 | with: 59 | repo-token: ${{ secrets.GITHUB_TOKEN }} 60 | version: 3.x 61 | 62 | - name: Download latest editorconfig-checker release binary package 63 | id: download 64 | uses: MrOctopus/download-asset-action@1.1 65 | with: 66 | repository: editorconfig-checker/editorconfig-checker 67 | excludes: prerelease, draft 68 | asset: linux-amd64.tar.gz 69 | target: ${{ env.EC_INSTALL_PATH }} 70 | 71 | - name: Install editorconfig-checker 72 | run: | 73 | cd "${{ env.EC_INSTALL_PATH }}" 74 | 75 | tar \ 76 | --extract \ 77 | --file="${{ steps.download.outputs.name }}" 78 | 79 | # Give the binary a standard name 80 | mv \ 81 | "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" \ 82 | "${{ env.EC_INSTALL_PATH }}/bin/ec" 83 | 84 | # Add installation to PATH: 85 | # See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#adding-a-system-path 86 | echo "${{ env.EC_INSTALL_PATH }}/bin" >>"$GITHUB_PATH" 87 | 88 | - name: Check formatting 89 | run: | 90 | task \ 91 | --silent \ 92 | general:check-formatting 93 | -------------------------------------------------------------------------------- /.github/workflows/check-poetry-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-poetry-task.md 2 | name: Check Poetry 3 | 4 | on: 5 | create: 6 | push: 7 | paths: 8 | - ".github/workflows/check-poetry-task.ya?ml" 9 | - "poetry.lock" 10 | - "pyproject.toml" 11 | - "Taskfile.ya?ml" 12 | pull_request: 13 | paths: 14 | - ".github/workflows/check-poetry-task.ya?ml" 15 | - "poetry.lock" 16 | - "pyproject.toml" 17 | - "Taskfile.ya?ml" 18 | schedule: 19 | # Run periodically to catch breakage caused by external changes. 20 | - cron: "0 11 * * THU" 21 | workflow_dispatch: 22 | repository_dispatch: 23 | 24 | jobs: 25 | run-determination: 26 | runs-on: ubuntu-latest 27 | permissions: {} 28 | outputs: 29 | result: ${{ steps.determination.outputs.result }} 30 | steps: 31 | - name: Determine if the rest of the workflow should run 32 | id: determination 33 | run: | 34 | RELEASE_BRANCH_REGEX="^refs/heads/((v[0-9]+)|([0-9]+\.[0-9]+\.x))$" 35 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 36 | if [[ 37 | "${{ github.event_name }}" != "create" || 38 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 39 | ]]; then 40 | # Run the other jobs. 41 | RESULT="true" 42 | else 43 | # There is no need to run the other jobs. 44 | RESULT="false" 45 | fi 46 | 47 | echo "result=$RESULT" >>$GITHUB_OUTPUT 48 | 49 | validate: 50 | needs: run-determination 51 | if: needs.run-determination.outputs.result == 'true' 52 | runs-on: ubuntu-latest 53 | permissions: 54 | contents: read 55 | 56 | steps: 57 | - name: Checkout repository 58 | uses: actions/checkout@v6 59 | 60 | - name: Install Python 61 | uses: actions/setup-python@v6 62 | with: 63 | python-version-file: pyproject.toml 64 | 65 | - name: Install Task 66 | uses: arduino/setup-task@v2 67 | with: 68 | repo-token: ${{ secrets.GITHUB_TOKEN }} 69 | version: 3.x 70 | 71 | - name: Validate configuration 72 | run: | 73 | task \ 74 | --silent \ 75 | poetry:validate 76 | 77 | check-sync: 78 | needs: run-determination 79 | if: needs.run-determination.outputs.result == 'true' 80 | runs-on: ubuntu-latest 81 | permissions: 82 | contents: read 83 | 84 | steps: 85 | - name: Checkout repository 86 | uses: actions/checkout@v6 87 | 88 | - name: Install Python 89 | uses: actions/setup-python@v6 90 | with: 91 | python-version-file: pyproject.toml 92 | 93 | - name: Install Task 94 | uses: arduino/setup-task@v2 95 | with: 96 | repo-token: ${{ secrets.GITHUB_TOKEN }} 97 | version: 3.x 98 | 99 | - name: Sync lockfile 100 | run: | 101 | task \ 102 | --silent \ 103 | poetry:sync 104 | 105 | - name: Check if lockfile was out of sync 106 | run: | 107 | git diff \ 108 | --color \ 109 | --exit-code \ 110 | poetry.lock 111 | -------------------------------------------------------------------------------- /.github/workflows/check-taskfiles.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-taskfiles.md 2 | name: Check Taskfiles 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-taskfiles.ya?ml" 10 | - ".npmrc" 11 | - "package.json" 12 | - "package-lock.json" 13 | - "**/Taskfile.ya?ml" 14 | - "**/DistTasks.ya?ml" 15 | pull_request: 16 | paths: 17 | - ".github/workflows/check-taskfiles.ya?ml" 18 | - ".npmrc" 19 | - "package.json" 20 | - "package-lock.json" 21 | - "**/Taskfile.ya?ml" 22 | - "**/DistTasks.ya?ml" 23 | schedule: 24 | # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. 25 | - cron: "0 8 * * TUE" 26 | workflow_dispatch: 27 | repository_dispatch: 28 | 29 | jobs: 30 | run-determination: 31 | runs-on: ubuntu-latest 32 | permissions: {} 33 | outputs: 34 | result: ${{ steps.determination.outputs.result }} 35 | steps: 36 | - name: Determine if the rest of the workflow should run 37 | id: determination 38 | run: | 39 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 40 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 41 | if [[ 42 | "${{ github.event_name }}" != "create" || 43 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 44 | ]]; then 45 | # Run the other jobs. 46 | RESULT="true" 47 | else 48 | # There is no need to run the other jobs. 49 | RESULT="false" 50 | fi 51 | 52 | echo "result=$RESULT" >>$GITHUB_OUTPUT 53 | 54 | validate: 55 | name: Validate ${{ matrix.file }} 56 | needs: run-determination 57 | if: needs.run-determination.outputs.result == 'true' 58 | runs-on: ubuntu-latest 59 | permissions: 60 | contents: read 61 | 62 | strategy: 63 | fail-fast: false 64 | 65 | matrix: 66 | file: 67 | - ./**/Taskfile.yml 68 | - ./**/DistTasks.yml 69 | 70 | steps: 71 | - name: Checkout repository 72 | uses: actions/checkout@v6 73 | 74 | - name: Setup Node.js 75 | uses: actions/setup-node@v6 76 | with: 77 | node-version-file: package.json 78 | 79 | - name: Download JSON schema for Taskfiles 80 | id: download-schema 81 | uses: carlosperate/download-file-action@v2 82 | with: 83 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json 84 | file-url: https://taskfile.dev/schema.json 85 | location: ${{ runner.temp }}/taskfile-schema 86 | 87 | - name: Install JSON schema validator 88 | run: npm install 89 | 90 | - name: Validate ${{ matrix.file }} 91 | run: | 92 | # See: https://github.com/ajv-validator/ajv-cli#readme 93 | npx \ 94 | --package=ajv-cli \ 95 | --package=ajv-formats \ 96 | ajv validate \ 97 | --all-errors \ 98 | --strict=false \ 99 | -c ajv-formats \ 100 | -s "${{ steps.download-schema.outputs.file-path }}" \ 101 | -d "${{ matrix.file }}" 102 | -------------------------------------------------------------------------------- /.github/workflows/check-markdown-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-markdown-task.md 2 | name: Check Markdown 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-markdown-task.ya?ml" 10 | - ".markdown-link-check.json" 11 | - ".npmrc" 12 | - "package.json" 13 | - "package-lock.json" 14 | - "Taskfile.ya?ml" 15 | - "**/.markdownlint*" 16 | - "**.mdx?" 17 | - "**.mkdn" 18 | - "**.mdown" 19 | - "**.markdown" 20 | pull_request: 21 | paths: 22 | - ".github/workflows/check-markdown-task.ya?ml" 23 | - ".markdown-link-check.json" 24 | - ".npmrc" 25 | - "package.json" 26 | - "package-lock.json" 27 | - "Taskfile.ya?ml" 28 | - "**/.markdownlint*" 29 | - "**.mdx?" 30 | - "**.mkdn" 31 | - "**.mdown" 32 | - "**.markdown" 33 | schedule: 34 | # Run every Tuesday at 8 AM UTC to catch breakage caused by external changes. 35 | - cron: "0 8 * * TUE" 36 | workflow_dispatch: 37 | repository_dispatch: 38 | 39 | jobs: 40 | run-determination: 41 | runs-on: ubuntu-latest 42 | permissions: {} 43 | outputs: 44 | result: ${{ steps.determination.outputs.result }} 45 | steps: 46 | - name: Determine if the rest of the workflow should run 47 | id: determination 48 | run: | 49 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 50 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 51 | if [[ 52 | "${{ github.event_name }}" != "create" || 53 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 54 | ]]; then 55 | # Run the other jobs. 56 | RESULT="true" 57 | else 58 | # There is no need to run the other jobs. 59 | RESULT="false" 60 | fi 61 | 62 | echo "result=$RESULT" >>$GITHUB_OUTPUT 63 | 64 | lint: 65 | needs: run-determination 66 | if: needs.run-determination.outputs.result == 'true' 67 | runs-on: ubuntu-latest 68 | permissions: 69 | contents: read 70 | 71 | steps: 72 | - name: Checkout repository 73 | uses: actions/checkout@v6 74 | 75 | - name: Setup Node.js 76 | uses: actions/setup-node@v6 77 | with: 78 | node-version-file: package.json 79 | 80 | - name: Initialize markdownlint-cli problem matcher 81 | uses: xt0rted/markdownlint-problem-matcher@v3 82 | 83 | - name: Install Task 84 | uses: arduino/setup-task@v2 85 | with: 86 | repo-token: ${{ secrets.GITHUB_TOKEN }} 87 | version: 3.x 88 | 89 | - name: Lint 90 | run: task markdown:lint 91 | 92 | links: 93 | needs: run-determination 94 | if: needs.run-determination.outputs.result == 'true' 95 | runs-on: ubuntu-latest 96 | permissions: 97 | contents: read 98 | 99 | steps: 100 | - name: Checkout repository 101 | uses: actions/checkout@v6 102 | 103 | - name: Setup Node.js 104 | uses: actions/setup-node@v6 105 | with: 106 | node-version-file: package.json 107 | 108 | - name: Install Task 109 | uses: arduino/setup-task@v2 110 | with: 111 | repo-token: ${{ secrets.GITHUB_TOKEN }} 112 | version: 3.x 113 | 114 | - name: Check links 115 | run: | 116 | task \ 117 | --silent \ 118 | markdown:check-links 119 | -------------------------------------------------------------------------------- /.github/workflows/check-yaml-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-yaml-task.md 2 | name: Check YAML 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".yamllint*" 10 | - "poetry.lock" 11 | - "pyproject.toml" 12 | # Source: https://github.com/ikatyang-collab/linguist-languages/blob/main/data/YAML.js (used by Prettier) 13 | - "**/.clang-format" 14 | - "**/.clang-tidy" 15 | - "**/.gemrc" 16 | - "**/glide.lock" 17 | - "**.ya?ml*" 18 | - "**.mir" 19 | - "**.reek" 20 | - "**.rviz" 21 | - "**.sublime-syntax" 22 | - "**.syntax" 23 | pull_request: 24 | paths: 25 | - ".yamllint*" 26 | - "poetry.lock" 27 | - "pyproject.toml" 28 | # Source: https://github.com/ikatyang-collab/linguist-languages/blob/main/data/YAML.js (used by Prettier) 29 | - "**/.clang-format" 30 | - "**/.clang-tidy" 31 | - "**/.gemrc" 32 | - "**/glide.lock" 33 | - "**.ya?ml*" 34 | - "**.mir" 35 | - "**.reek" 36 | - "**.rviz" 37 | - "**.sublime-syntax" 38 | - "**.syntax" 39 | schedule: 40 | # Run periodically to catch breakage caused by external changes. 41 | - cron: "0 9 * * WED" 42 | workflow_dispatch: 43 | repository_dispatch: 44 | 45 | jobs: 46 | run-determination: 47 | runs-on: ubuntu-latest 48 | permissions: {} 49 | outputs: 50 | result: ${{ steps.determination.outputs.result }} 51 | steps: 52 | - name: Determine if the rest of the workflow should run 53 | id: determination 54 | run: | 55 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 56 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 57 | if [[ 58 | "${{ github.event_name }}" != "create" || 59 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 60 | ]]; then 61 | # Run the other jobs. 62 | RESULT="true" 63 | else 64 | # There is no need to run the other jobs. 65 | RESULT="false" 66 | fi 67 | 68 | echo "result=$RESULT" >>$GITHUB_OUTPUT 69 | 70 | check: 71 | name: ${{ matrix.configuration.name }} 72 | needs: run-determination 73 | if: needs.run-determination.outputs.result == 'true' 74 | runs-on: ubuntu-latest 75 | permissions: 76 | contents: read 77 | 78 | strategy: 79 | fail-fast: false 80 | 81 | matrix: 82 | configuration: 83 | - name: Generate problem matcher output 84 | # yamllint's "github" output type produces annotated diffs, but is not useful to humans reading the log. 85 | format: github 86 | # The other matrix job is used to set the result, so this job is configured to always pass. 87 | continue-on-error: true 88 | - name: Check formatting 89 | # yamllint's "colored" output type is most suitable for humans reading the log. 90 | format: colored 91 | continue-on-error: false 92 | 93 | steps: 94 | - name: Checkout repository 95 | uses: actions/checkout@v6 96 | 97 | - name: Install Python 98 | uses: actions/setup-python@v6 99 | with: 100 | python-version-file: pyproject.toml 101 | 102 | - name: Install Task 103 | uses: arduino/setup-task@v2 104 | with: 105 | repo-token: ${{ secrets.GITHUB_TOKEN }} 106 | version: 3.x 107 | 108 | - name: Check YAML 109 | continue-on-error: ${{ matrix.configuration.continue-on-error }} 110 | run: | 111 | task yaml:lint \ 112 | YAMLLINT_FORMAT=${{ matrix.configuration.format }} 113 | -------------------------------------------------------------------------------- /.github/workflows/check-license.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-license.md 2 | name: Check License 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-license.ya?ml" 10 | # See: https://github.com/licensee/licensee/blob/master/docs/what-we-look-at.md#detecting-the-license-file 11 | - "[cC][oO][pP][yY][iI][nN][gG]*" 12 | - "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*" 13 | - "[lL][iI][cC][eE][nN][cCsS][eE]*" 14 | - "[oO][fF][lL]*" 15 | - "[pP][aA][tT][eE][nN][tT][sS]*" 16 | pull_request: 17 | paths: 18 | - ".github/workflows/check-license.ya?ml" 19 | - "[cC][oO][pP][yY][iI][nN][gG]*" 20 | - "[cC][oO][pP][yY][rR][iI][gG][hH][tH]*" 21 | - "[lL][iI][cC][eE][nN][cCsS][eE]*" 22 | - "[oO][fF][lL]*" 23 | - "[pP][aA][tT][eE][nN][tT][sS]*" 24 | schedule: 25 | # Run periodically to catch breakage caused by external changes. 26 | - cron: "0 6 * * WED" 27 | workflow_dispatch: 28 | repository_dispatch: 29 | 30 | jobs: 31 | run-determination: 32 | runs-on: ubuntu-latest 33 | permissions: {} 34 | outputs: 35 | result: ${{ steps.determination.outputs.result }} 36 | steps: 37 | - name: Determine if the rest of the workflow should run 38 | id: determination 39 | run: | 40 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 41 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 42 | if [[ 43 | "${{ github.event_name }}" != "create" || 44 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 45 | ]]; then 46 | # Run the other jobs. 47 | RESULT="true" 48 | else 49 | # There is no need to run the other jobs. 50 | RESULT="false" 51 | fi 52 | 53 | echo "result=$RESULT" >>$GITHUB_OUTPUT 54 | 55 | check-license: 56 | name: ${{ matrix.check-license.path }} 57 | needs: run-determination 58 | if: needs.run-determination.outputs.result == 'true' 59 | runs-on: ubuntu-latest 60 | permissions: 61 | contents: read 62 | 63 | strategy: 64 | fail-fast: false 65 | 66 | matrix: 67 | check-license: 68 | - path: . 69 | expected-filename: LICENSE.txt 70 | # SPDX identifier: https://spdx.org/licenses/ 71 | expected-type: GPL-3.0 72 | 73 | steps: 74 | - name: Checkout repository 75 | uses: actions/checkout@v6 76 | 77 | - name: Install Ruby 78 | uses: ruby/setup-ruby@v1 79 | with: 80 | ruby-version: ruby # Install latest version 81 | 82 | - name: Install licensee 83 | run: | 84 | gem install \ 85 | licensee 86 | 87 | - name: Check license file for ${{ matrix.check-license.path }} 88 | run: | 89 | EXIT_STATUS=0 90 | 91 | # Go into folder path 92 | cd ./${{ matrix.check-license.path }} 93 | 94 | # See: https://github.com/licensee/licensee 95 | LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)" 96 | 97 | DETECTED_LICENSE_FILE="$( 98 | echo "$LICENSEE_OUTPUT" \ 99 | | \ 100 | jq .matched_files[0].filename \ 101 | | \ 102 | tr --delete '\r' 103 | )" 104 | echo "Detected license file: $DETECTED_LICENSE_FILE" 105 | if [ "$DETECTED_LICENSE_FILE" != "\"${{ matrix.check-license.expected-filename }}\"" ]; then 106 | echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: ${{ matrix.check-license.expected-filename }}" 107 | EXIT_STATUS=1 108 | fi 109 | 110 | DETECTED_LICENSE_TYPE="$( 111 | echo "$LICENSEE_OUTPUT" \ 112 | | \ 113 | jq .matched_files[0].matched_license \ 114 | | \ 115 | tr --delete '\r' 116 | )" 117 | echo "Detected license type: $DETECTED_LICENSE_TYPE" 118 | if [ "$DETECTED_LICENSE_TYPE" != "\"${{ matrix.check-license.expected-type }}\"" ]; then 119 | echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${{ matrix.check-license.expected-type }}\"" 120 | EXIT_STATUS=1 121 | fi 122 | 123 | exit $EXIT_STATUS 124 | -------------------------------------------------------------------------------- /.github/workflows/check-npm-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-npm-task.md 2 | name: Check npm 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-npm-task.ya?ml" 10 | - "**/.npmrc" 11 | - "**/package.json" 12 | - "**/package-lock.json" 13 | - "Taskfile.ya?ml" 14 | pull_request: 15 | paths: 16 | - ".github/workflows/check-npm-task.ya?ml" 17 | - "**/.npmrc" 18 | - "**/package.json" 19 | - "**/package-lock.json" 20 | - "Taskfile.ya?ml" 21 | schedule: 22 | # Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema. 23 | - cron: "0 8 * * TUE" 24 | workflow_dispatch: 25 | repository_dispatch: 26 | 27 | jobs: 28 | run-determination: 29 | runs-on: ubuntu-latest 30 | permissions: {} 31 | outputs: 32 | result: ${{ steps.determination.outputs.result }} 33 | steps: 34 | - name: Determine if the rest of the workflow should run 35 | id: determination 36 | run: | 37 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 38 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 39 | if [[ 40 | "${{ github.event_name }}" != "create" || 41 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 42 | ]]; then 43 | # Run the other jobs. 44 | RESULT="true" 45 | else 46 | # There is no need to run the other jobs. 47 | RESULT="false" 48 | fi 49 | 50 | echo "result=$RESULT" >>$GITHUB_OUTPUT 51 | 52 | validate: 53 | name: validate (${{ matrix.project.path }}) 54 | needs: run-determination 55 | if: needs.run-determination.outputs.result == 'true' 56 | runs-on: ubuntu-latest 57 | permissions: 58 | contents: read 59 | 60 | strategy: 61 | fail-fast: false 62 | matrix: 63 | project: 64 | - path: . 65 | 66 | steps: 67 | - name: Checkout repository 68 | uses: actions/checkout@v6 69 | 70 | - name: Setup Node.js 71 | uses: actions/setup-node@v6 72 | with: 73 | node-version-file: package.json 74 | 75 | - name: Install Task 76 | uses: arduino/setup-task@v2 77 | with: 78 | repo-token: ${{ secrets.GITHUB_TOKEN }} 79 | version: 3.x 80 | 81 | - name: Validate package.json 82 | run: | 83 | task \ 84 | --silent \ 85 | npm:validate \ 86 | PROJECT_PATH="${{ matrix.project.path }}" 87 | 88 | check-sync: 89 | name: check-sync (${{ matrix.project.path }}) 90 | needs: run-determination 91 | if: needs.run-determination.outputs.result == 'true' 92 | runs-on: ubuntu-latest 93 | permissions: 94 | contents: read 95 | 96 | strategy: 97 | fail-fast: false 98 | matrix: 99 | project: 100 | - path: . 101 | 102 | steps: 103 | - name: Checkout repository 104 | uses: actions/checkout@v6 105 | 106 | - name: Setup Node.js 107 | uses: actions/setup-node@v6 108 | with: 109 | node-version-file: "${{ matrix.project.path }}/package.json" 110 | 111 | - name: Install Task 112 | uses: arduino/setup-task@v2 113 | with: 114 | repo-token: ${{ secrets.GITHUB_TOKEN }} 115 | version: 3.x 116 | 117 | - name: Install npm dependencies 118 | run: | 119 | task npm:install-deps \ 120 | PROJECT_PATH="${{ matrix.project.path }}" 121 | 122 | - name: Check package-lock.json 123 | run: | 124 | git diff \ 125 | --color \ 126 | --exit-code \ 127 | "${{ matrix.project.path }}/package-lock.json" 128 | 129 | check-config: 130 | name: check-config (${{ matrix.project.path }}) 131 | needs: run-determination 132 | if: needs.run-determination.outputs.result == 'true' 133 | runs-on: ubuntu-latest 134 | permissions: 135 | contents: read 136 | 137 | strategy: 138 | fail-fast: false 139 | matrix: 140 | project: 141 | # TODO: add paths of all npm-managed projects in the repository here. 142 | - path: . 143 | 144 | steps: 145 | - name: Checkout repository 146 | uses: actions/checkout@v6 147 | 148 | - name: Setup Node.js 149 | uses: actions/setup-node@v6 150 | with: 151 | node-version-file: "${{ matrix.project.path }}/package.json" 152 | 153 | - name: Install Task 154 | uses: arduino/setup-task@v2 155 | with: 156 | repo-token: ${{ secrets.GITHUB_TOKEN }} 157 | version: 3.x 158 | 159 | - name: Fix problems in npm configuration file 160 | run: | 161 | task npm:fix-config \ 162 | PROJECT_PATH="${{ matrix.project.path }}" 163 | 164 | - name: Check if fixes are needed in npm configuration file 165 | run: | 166 | git diff \ 167 | --color \ 168 | --exit-code \ 169 | "${{ matrix.project.path }}/.npmrc" 170 | -------------------------------------------------------------------------------- /.github/workflows/check-go-dependencies-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md 2 | name: Check Go Dependencies 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-go-dependencies-task.ya?ml" 10 | - ".licenses/**" 11 | - ".licensed.json" 12 | - ".licensed.ya?ml" 13 | - "Taskfile.ya?ml" 14 | - "**/.gitmodules" 15 | - "**/go.mod" 16 | - "**/go.sum" 17 | pull_request: 18 | paths: 19 | - ".github/workflows/check-go-dependencies-task.ya?ml" 20 | - ".licenses/**" 21 | - ".licensed.json" 22 | - ".licensed.ya?ml" 23 | - "Taskfile.ya?ml" 24 | - "**/.gitmodules" 25 | - "**/go.mod" 26 | - "**/go.sum" 27 | schedule: 28 | # Run periodically to catch breakage caused by external changes. 29 | - cron: "0 8 * * WED" 30 | workflow_dispatch: 31 | repository_dispatch: 32 | 33 | jobs: 34 | run-determination: 35 | runs-on: ubuntu-latest 36 | permissions: {} 37 | outputs: 38 | result: ${{ steps.determination.outputs.result }} 39 | steps: 40 | - name: Determine if the rest of the workflow should run 41 | id: determination 42 | run: | 43 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 44 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 45 | if [[ 46 | "${{ github.event_name }}" != "create" || 47 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 48 | ]]; then 49 | # Run the other jobs. 50 | RESULT="true" 51 | else 52 | # There is no need to run the other jobs. 53 | RESULT="false" 54 | fi 55 | 56 | echo "result=$RESULT" >>$GITHUB_OUTPUT 57 | 58 | check-cache: 59 | needs: run-determination 60 | if: needs.run-determination.outputs.result == 'true' 61 | runs-on: ubuntu-latest 62 | permissions: 63 | contents: read 64 | 65 | steps: 66 | - name: Checkout repository 67 | uses: actions/checkout@v6 68 | with: 69 | submodules: recursive 70 | 71 | # This is required to allow licensee/setup-licensed to install Licensed via Ruby gem. 72 | - name: Install Ruby 73 | uses: ruby/setup-ruby@v1 74 | with: 75 | ruby-version: ruby # Install latest version 76 | 77 | - name: Install licensed 78 | uses: licensee/setup-licensed@v1.3.2 79 | with: 80 | github_token: ${{ secrets.GITHUB_TOKEN }} 81 | version: 5.x 82 | 83 | - name: Install Go 84 | uses: actions/setup-go@v6 85 | with: 86 | go-version-file: go.mod 87 | 88 | - name: Install Task 89 | uses: arduino/setup-task@v2 90 | with: 91 | repo-token: ${{ secrets.GITHUB_TOKEN }} 92 | version: 3.x 93 | 94 | - name: Update dependencies license metadata cache 95 | run: | 96 | task \ 97 | --silent \ 98 | general:cache-dep-licenses 99 | 100 | - name: Check for outdated cache 101 | id: diff 102 | run: | 103 | git add . 104 | if 105 | ! git diff \ 106 | --cached \ 107 | --color \ 108 | --exit-code 109 | then 110 | echo 111 | echo "::error::Dependency license metadata out of sync. See: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md#metadata-cache" 112 | exit 1 113 | fi 114 | 115 | # Some might find it convenient to have CI generate the cache rather than setting up for it locally 116 | - name: Upload cache to workflow artifact 117 | if: failure() && steps.diff.outcome == 'failure' 118 | uses: actions/upload-artifact@v6 119 | with: 120 | if-no-files-found: error 121 | include-hidden-files: true 122 | name: dep-licenses-cache 123 | path: .licenses/ 124 | 125 | check-deps: 126 | needs: run-determination 127 | if: needs.run-determination.outputs.result == 'true' 128 | runs-on: ubuntu-latest 129 | permissions: 130 | contents: read 131 | 132 | steps: 133 | - name: Checkout repository 134 | uses: actions/checkout@v6 135 | with: 136 | submodules: recursive 137 | 138 | # This is required to allow licensee/setup-licensed to install Licensed via Ruby gem. 139 | - name: Install Ruby 140 | uses: ruby/setup-ruby@v1 141 | with: 142 | ruby-version: ruby # Install latest version 143 | 144 | - name: Install licensed 145 | uses: licensee/setup-licensed@v1.3.2 146 | with: 147 | github_token: ${{ secrets.GITHUB_TOKEN }} 148 | version: 5.x 149 | 150 | - name: Install Go 151 | uses: actions/setup-go@v6 152 | with: 153 | go-version-file: go.mod 154 | 155 | - name: Install Task 156 | uses: arduino/setup-task@v2 157 | with: 158 | repo-token: ${{ secrets.GITHUB_TOKEN }} 159 | version: 3.x 160 | 161 | - name: Check for dependencies with unapproved licenses 162 | run: | 163 | task \ 164 | --silent \ 165 | general:check-dep-licenses 166 | -------------------------------------------------------------------------------- /.github/workflows/sync-labels-npm.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels-npm.md 2 | name: Sync Labels 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | push: 7 | paths: 8 | - ".github/workflows/sync-labels-npm.ya?ml" 9 | - ".github/label-configuration-files/*.ya?ml" 10 | - ".npmrc" 11 | - "package.json" 12 | - "package-lock.json" 13 | pull_request: 14 | paths: 15 | - ".github/workflows/sync-labels-npm.ya?ml" 16 | - ".github/label-configuration-files/*.ya?ml" 17 | - ".npmrc" 18 | - "package.json" 19 | - "package-lock.json" 20 | schedule: 21 | # Run daily at 8 AM UTC to sync with changes to shared label configurations. 22 | - cron: "0 8 * * *" 23 | workflow_dispatch: 24 | repository_dispatch: 25 | 26 | env: 27 | CONFIGURATIONS_FOLDER: .github/label-configuration-files 28 | CONFIGURATIONS_ARTIFACT_PREFIX: label-configuration-file- 29 | 30 | jobs: 31 | check: 32 | runs-on: ubuntu-latest 33 | permissions: 34 | contents: read 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v6 39 | 40 | - name: Setup Node.js 41 | uses: actions/setup-node@v6 42 | with: 43 | node-version-file: package.json 44 | 45 | - name: Download JSON schema for labels configuration file 46 | id: download-schema 47 | uses: carlosperate/download-file-action@v2 48 | with: 49 | file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json 50 | location: ${{ runner.temp }}/label-configuration-schema 51 | 52 | - name: Install JSON schema validator 53 | run: npm install 54 | 55 | - name: Validate local labels configuration 56 | run: | 57 | # See: https://github.com/ajv-validator/ajv-cli#readme 58 | npx \ 59 | --package=ajv-cli \ 60 | --package=ajv-formats \ 61 | ajv validate \ 62 | --all-errors \ 63 | -c ajv-formats \ 64 | -s "${{ steps.download-schema.outputs.file-path }}" \ 65 | -d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}" 66 | 67 | download: 68 | needs: check 69 | runs-on: ubuntu-latest 70 | permissions: {} 71 | 72 | strategy: 73 | matrix: 74 | filename: 75 | # Filenames of the shared configurations to apply to the repository in addition to the local configuration. 76 | # https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels 77 | - universal.yml 78 | - tooling.yml 79 | 80 | steps: 81 | - name: Download 82 | uses: carlosperate/download-file-action@v2 83 | with: 84 | file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} 85 | 86 | - name: Pass configuration files to next job via workflow artifact 87 | uses: actions/upload-artifact@v6 88 | with: 89 | path: ${{ matrix.filename }} 90 | if-no-files-found: error 91 | name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}${{ matrix.filename }} 92 | 93 | sync: 94 | needs: download 95 | runs-on: ubuntu-latest 96 | permissions: 97 | contents: read 98 | issues: write 99 | 100 | steps: 101 | - name: Set environment variables 102 | run: | 103 | # See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable 104 | echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >>"$GITHUB_ENV" 105 | 106 | - name: Determine whether to dry run 107 | id: dry-run 108 | if: > 109 | github.event_name == 'pull_request' || 110 | ( 111 | ( 112 | github.event_name == 'push' || 113 | github.event_name == 'workflow_dispatch' 114 | ) && 115 | github.ref != format('refs/heads/{0}', github.event.repository.default_branch) 116 | ) 117 | run: | 118 | # Use of this flag in the github-label-sync command will cause it to only check the validity of the 119 | # configuration. 120 | echo "flag=--dry-run" >>$GITHUB_OUTPUT 121 | 122 | - name: Checkout repository 123 | uses: actions/checkout@v6 124 | 125 | - name: Download configuration file artifacts 126 | uses: actions/download-artifact@v7 127 | with: 128 | merge-multiple: true 129 | pattern: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}* 130 | path: ${{ env.CONFIGURATIONS_FOLDER }} 131 | 132 | - name: Remove unneeded artifacts 133 | uses: geekyeggo/delete-artifact@v5 134 | with: 135 | name: ${{ env.CONFIGURATIONS_ARTIFACT_PREFIX }}* 136 | 137 | - name: Setup Node.js 138 | uses: actions/setup-node@v6 139 | with: 140 | node-version-file: package.json 141 | 142 | - name: Merge label configuration files 143 | run: | 144 | # Merge all configuration files 145 | shopt -s extglob 146 | cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) >"${{ env.MERGED_CONFIGURATION_PATH }}" 147 | 148 | - name: Install github-label-sync 149 | run: npm install 150 | 151 | - name: Sync labels 152 | env: 153 | GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} 154 | run: | 155 | # See: https://github.com/Financial-Times/github-label-sync 156 | npx \ 157 | github-label-sync \ 158 | --labels "${{ env.MERGED_CONFIGURATION_PATH }}" \ 159 | ${{ steps.dry-run.outputs.flag }} \ 160 | ${{ github.repository }} 161 | -------------------------------------------------------------------------------- /.github/workflows/check-go-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-task.md 2 | name: Check Go 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-go-task.ya?ml" 10 | - "Taskfile.ya?ml" 11 | - "**/go.mod" 12 | - "**/go.sum" 13 | - "**.go" 14 | pull_request: 15 | paths: 16 | - ".github/workflows/check-go-task.ya?ml" 17 | - "Taskfile.ya?ml" 18 | - "**/go.mod" 19 | - "**/go.sum" 20 | - "**.go" 21 | schedule: 22 | # Run periodically to catch breakage caused by external changes. 23 | - cron: "0 7 * * WED" 24 | workflow_dispatch: 25 | repository_dispatch: 26 | 27 | jobs: 28 | run-determination: 29 | runs-on: ubuntu-latest 30 | permissions: {} 31 | outputs: 32 | result: ${{ steps.determination.outputs.result }} 33 | steps: 34 | - name: Determine if the rest of the workflow should run 35 | id: determination 36 | run: | 37 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 38 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 39 | if [[ 40 | "${{ github.event_name }}" != "create" || 41 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 42 | ]]; then 43 | # Run the other jobs. 44 | RESULT="true" 45 | else 46 | # There is no need to run the other jobs. 47 | RESULT="false" 48 | fi 49 | 50 | echo "result=$RESULT" >>$GITHUB_OUTPUT 51 | 52 | check-errors: 53 | name: check-errors (${{ matrix.module.path }}) 54 | needs: run-determination 55 | if: needs.run-determination.outputs.result == 'true' 56 | runs-on: ubuntu-latest 57 | permissions: 58 | contents: read 59 | 60 | strategy: 61 | fail-fast: false 62 | 63 | matrix: 64 | module: 65 | - path: ./ 66 | 67 | steps: 68 | - name: Checkout repository 69 | uses: actions/checkout@v6 70 | 71 | - name: Install Go 72 | uses: actions/setup-go@v6 73 | with: 74 | go-version-file: ${{ matrix.module.path }}/go.mod 75 | 76 | - name: Install Task 77 | uses: arduino/setup-task@v2 78 | with: 79 | repo-token: ${{ secrets.GITHUB_TOKEN }} 80 | version: 3.x 81 | 82 | - name: Check for errors 83 | env: 84 | GO_MODULE_PATH: ${{ matrix.module.path }} 85 | run: task go:vet 86 | 87 | check-outdated: 88 | name: check-outdated (${{ matrix.module.path }}) 89 | needs: run-determination 90 | if: needs.run-determination.outputs.result == 'true' 91 | runs-on: ubuntu-latest 92 | permissions: 93 | contents: read 94 | 95 | strategy: 96 | fail-fast: false 97 | 98 | matrix: 99 | module: 100 | - path: . 101 | 102 | steps: 103 | - name: Checkout repository 104 | uses: actions/checkout@v6 105 | 106 | - name: Install Go 107 | uses: actions/setup-go@v6 108 | with: 109 | go-version-file: ${{ matrix.module.path }}/go.mod 110 | 111 | - name: Install Task 112 | uses: arduino/setup-task@v2 113 | with: 114 | repo-token: ${{ secrets.GITHUB_TOKEN }} 115 | version: 3.x 116 | 117 | - name: Modernize usages of outdated APIs 118 | env: 119 | GO_MODULE_PATH: ${{ matrix.module.path }} 120 | run: task go:fix 121 | 122 | - name: Check if any fixes were needed 123 | run: | 124 | git diff \ 125 | --color \ 126 | --exit-code 127 | 128 | check-style: 129 | name: check-style (${{ matrix.module.path }}) 130 | needs: run-determination 131 | if: needs.run-determination.outputs.result == 'true' 132 | runs-on: ubuntu-latest 133 | permissions: 134 | contents: read 135 | 136 | strategy: 137 | fail-fast: false 138 | 139 | matrix: 140 | module: 141 | - path: . 142 | 143 | steps: 144 | - name: Checkout repository 145 | uses: actions/checkout@v6 146 | 147 | - name: Install Go 148 | uses: actions/setup-go@v6 149 | with: 150 | go-version-file: ${{ matrix.module.path }}/go.mod 151 | 152 | - name: Install Task 153 | uses: arduino/setup-task@v2 154 | with: 155 | repo-token: ${{ secrets.GITHUB_TOKEN }} 156 | version: 3.x 157 | 158 | - name: Install golint 159 | run: go install golang.org/x/lint/golint@latest 160 | 161 | - name: Check style 162 | env: 163 | GO_MODULE_PATH: ${{ matrix.module.path }} 164 | run: | 165 | task \ 166 | --silent \ 167 | go:lint 168 | 169 | check-formatting: 170 | name: check-formatting (${{ matrix.module.path }}) 171 | needs: run-determination 172 | if: needs.run-determination.outputs.result == 'true' 173 | runs-on: ubuntu-latest 174 | permissions: 175 | contents: read 176 | 177 | strategy: 178 | fail-fast: false 179 | 180 | matrix: 181 | module: 182 | - path: . 183 | 184 | steps: 185 | - name: Checkout repository 186 | uses: actions/checkout@v6 187 | 188 | - name: Install Go 189 | uses: actions/setup-go@v6 190 | with: 191 | go-version-file: ${{ matrix.module.path }}/go.mod 192 | 193 | - name: Install Task 194 | uses: arduino/setup-task@v2 195 | with: 196 | repo-token: ${{ secrets.GITHUB_TOKEN }} 197 | version: 3.x 198 | 199 | - name: Format code 200 | env: 201 | GO_MODULE_PATH: ${{ matrix.module.path }} 202 | run: task go:format 203 | 204 | - name: Check formatting 205 | run: | 206 | git diff \ 207 | --color \ 208 | --exit-code 209 | 210 | check-config: 211 | name: check-config (${{ matrix.module.path }}) 212 | needs: run-determination 213 | if: needs.run-determination.outputs.result == 'true' 214 | runs-on: ubuntu-latest 215 | permissions: 216 | contents: read 217 | 218 | strategy: 219 | fail-fast: false 220 | 221 | matrix: 222 | module: 223 | - path: . 224 | 225 | steps: 226 | - name: Checkout repository 227 | uses: actions/checkout@v6 228 | 229 | - name: Install Go 230 | uses: actions/setup-go@v6 231 | with: 232 | go-version-file: ${{ matrix.module.path }}/go.mod 233 | 234 | - name: Run go mod tidy 235 | working-directory: ${{ matrix.module.path }} 236 | run: go mod tidy 237 | 238 | - name: Check whether any tidying was needed 239 | run: | 240 | git diff \ 241 | --color \ 242 | --exit-code 243 | -------------------------------------------------------------------------------- /DistTasks.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-crosscompile-task/DistTasks.yml 2 | version: "3" 3 | 4 | # This taskfile is ideally meant to be project agnostic and could be dropped in 5 | # on other Go projects with minimal or no changes. 6 | # 7 | # To use it simply add the following lines to your main taskfile: 8 | # includes: 9 | # dist: ./DistTasks.yml 10 | # 11 | # The following variables must be declared in the including taskfile for the 12 | # build process to work correctly: 13 | # * DIST_DIR: the folder that will contain the final binaries and packages 14 | # * PROJECT_NAME: the name of the project, used in package name 15 | # * VERSION: the version of the project, used in package name and checksum file 16 | # * LD_FLAGS: flags used at build time 17 | # 18 | # The project MUST contain a LICENSE.txt file in the root folder or packaging will fail. 19 | 20 | tasks: 21 | Windows_32bit: 22 | desc: Builds Windows 32 bit binaries 23 | env: 24 | GOOS: "windows" 25 | GOARCH: "386" 26 | GO386: "softfloat" 27 | cmds: 28 | - | 29 | go build \ 30 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ 31 | {{.LDFLAGS}} 32 | cd {{.DIST_DIR}} 33 | cp \ 34 | ../LICENSE.txt \ 35 | {{.PLATFORM_DIR}}/ 36 | zip \ 37 | {{.PACKAGE_NAME}} \ 38 | {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ 39 | {{.PLATFORM_DIR}}/LICENSE.txt 40 | vars: 41 | PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_386" 42 | PACKAGE_PLATFORM: "Windows_32bit" 43 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.zip" 44 | 45 | Windows_64bit: 46 | desc: Builds Windows 64 bit binaries 47 | env: 48 | GOOS: "windows" 49 | GOARCH: "amd64" 50 | cmds: 51 | - | 52 | go build \ 53 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ 54 | {{.LDFLAGS}} 55 | cd {{.DIST_DIR}} 56 | cp \ 57 | ../LICENSE.txt \ 58 | {{.PLATFORM_DIR}}/ 59 | zip \ 60 | {{.PACKAGE_NAME}} \ 61 | {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ 62 | {{.PLATFORM_DIR}}/LICENSE.txt 63 | vars: 64 | PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_amd64" 65 | PACKAGE_PLATFORM: "Windows_64bit" 66 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.zip" 67 | 68 | Linux_32bit: 69 | desc: Builds Linux 32 bit binaries 70 | env: 71 | GOOS: "linux" 72 | GOARCH: "386" 73 | GO386: "softfloat" 74 | cmds: 75 | - | 76 | go build \ 77 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 78 | {{.LDFLAGS}} 79 | cd {{.DIST_DIR}} 80 | cp \ 81 | ../LICENSE.txt \ 82 | {{.PLATFORM_DIR}}/ 83 | tar cz \ 84 | {{.PLATFORM_DIR}} \ 85 | -f {{.PACKAGE_NAME}} 86 | vars: 87 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd32" 88 | PACKAGE_PLATFORM: "Linux_32bit" 89 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 90 | 91 | Linux_64bit: 92 | desc: Builds Linux 64 bit binaries 93 | env: 94 | GOOS: "linux" 95 | GOARCH: "amd64" 96 | cmds: 97 | - | 98 | go build \ 99 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 100 | {{.LDFLAGS}} 101 | cd {{.DIST_DIR}} 102 | cp \ 103 | ../LICENSE.txt \ 104 | {{.PLATFORM_DIR}}/ 105 | tar cz \ 106 | {{.PLATFORM_DIR}} \ 107 | -f {{.PACKAGE_NAME}} 108 | vars: 109 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd64" 110 | PACKAGE_PLATFORM: "Linux_64bit" 111 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 112 | 113 | Linux_ARMv7: 114 | desc: Builds Linux ARMv7 binaries 115 | env: 116 | GOOS: "linux" 117 | GOARCH: "arm" 118 | GOARM: 7 119 | cmds: 120 | - | 121 | go build \ 122 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 123 | {{.LDFLAGS}} 124 | cd {{.DIST_DIR}} 125 | cp \ 126 | ../LICENSE.txt \ 127 | {{.PLATFORM_DIR}}/ 128 | tar cz \ 129 | {{.PLATFORM_DIR}} \ 130 | -f {{.PACKAGE_NAME}} 131 | vars: 132 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_7" 133 | PACKAGE_PLATFORM: "Linux_ARMv7" 134 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 135 | 136 | Linux_ARMv6: 137 | desc: Builds Linux ARMv6 binaries 138 | env: 139 | GOOS: "linux" 140 | GOARCH: "arm" 141 | GOARM: 6 142 | cmds: 143 | - | 144 | go build \ 145 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 146 | {{.LDFLAGS}} 147 | cd {{.DIST_DIR}} 148 | cp \ 149 | ../LICENSE.txt \ 150 | {{.PLATFORM_DIR}}/ 151 | tar cz \ 152 | {{.PLATFORM_DIR}} \ 153 | -f {{.PACKAGE_NAME}} 154 | vars: 155 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_6" 156 | PACKAGE_PLATFORM: "Linux_ARMv6" 157 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 158 | 159 | Linux_ARM64: 160 | desc: Builds Linux ARM64 binaries 161 | env: 162 | GOOS: "linux" 163 | GOARCH: "arm64" 164 | cmds: 165 | - | 166 | go build \ 167 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 168 | {{.LDFLAGS}} 169 | cd {{.DIST_DIR}} 170 | cp \ 171 | ../LICENSE.txt \ 172 | {{.PLATFORM_DIR}}/ 173 | tar cz \ 174 | {{.PLATFORM_DIR}} \ 175 | -f {{.PACKAGE_NAME}} 176 | vars: 177 | PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_64" 178 | PACKAGE_PLATFORM: "Linux_ARM64" 179 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 180 | 181 | macOS_64bit: 182 | desc: Builds Mac OS X 64 bit binaries 183 | env: 184 | GOOS: "darwin" 185 | GOARCH: "amd64" 186 | cmds: 187 | - | 188 | go build \ 189 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 190 | {{.LDFLAGS}} 191 | cd {{.DIST_DIR}} 192 | cp \ 193 | ../LICENSE.txt \ 194 | {{.PLATFORM_DIR}}/ 195 | tar cz \ 196 | {{.PLATFORM_DIR}} \ 197 | -f {{.PACKAGE_NAME}} 198 | vars: 199 | PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_amd64" 200 | PACKAGE_PLATFORM: "macOS_64bit" 201 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 202 | 203 | macOS_ARM64: 204 | desc: Builds Mac OS X ARM64 binaries 205 | env: 206 | GOOS: "darwin" 207 | GOARCH: "arm64" 208 | cmds: 209 | - | 210 | go build \ 211 | -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ 212 | {{.LDFLAGS}} 213 | cd {{.DIST_DIR}} 214 | cp \ 215 | ../LICENSE.txt \ 216 | {{.PLATFORM_DIR}}/ 217 | tar cz \ 218 | {{.PLATFORM_DIR}} \ 219 | -f {{.PACKAGE_NAME}} 220 | vars: 221 | PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_arm64" 222 | PACKAGE_PLATFORM: "macOS_ARM64" 223 | PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" 224 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "flag" 6 | "fmt" 7 | "io" 8 | "io/ioutil" 9 | "net" 10 | "net/http" 11 | "net/http/httptrace" 12 | "os" 13 | "path/filepath" 14 | "regexp" 15 | "strconv" 16 | "strings" 17 | "time" 18 | 19 | "github.com/arduino/arduinoOTA/globals" 20 | ) 21 | 22 | var compileInfo string 23 | 24 | var ( 25 | version = flag.Bool("version", false, "Prints program version") 26 | networkAddress = flag.String("address", "localhost", "The address of the board") 27 | networkPort = flag.String("port", "80", "The board needs to be listening on this port") 28 | username = flag.String("username", "", "Username for authentication") 29 | password = flag.String("password", "", "Password for authentication") 30 | sketchPath = flag.String("sketch", "", "Sketch path") 31 | uploadEndpoint = flag.String("upload", "", "Upload endpoint") 32 | resetEndpoint = flag.String("reset", "", "Upload endpoint") 33 | syncEndpoint = flag.String("sync", "", "Upload endpoint") 34 | binMode = flag.Bool("b", false, "Upload binary mode") 35 | verbose = flag.Bool("v", true, "Verbose flag") 36 | quiet = flag.Bool("q", false, "Quiet flag") 37 | useSsl = flag.String("ssl", "", "SSL flag") 38 | syncRet = flag.String("sync_exp", "", "sync expected return code in format code:string") 39 | hasDownloadFile = flag.Bool("d", false, "set to true to take advantage of downloadFile API") 40 | timeoutSeconds = flag.Int("t", 10, "Upload timeout") 41 | ) 42 | 43 | func main() { 44 | flag.Parse() 45 | 46 | if *version { 47 | fmt.Println(globals.VersionInfo.String() + compileInfo) 48 | os.Exit(0) 49 | } 50 | 51 | var httpClient = &http.Client{ 52 | Timeout: time.Second * time.Duration(*timeoutSeconds), 53 | } 54 | 55 | httpheader := "http://" 56 | 57 | if *useSsl != "" { 58 | httpheader = "https://" 59 | } 60 | 61 | syncRetCode := 200 62 | syncString := "SYNC" 63 | 64 | if *syncRet != "" { 65 | sliceStrRet := strings.Split(*syncRet, ":") 66 | if len(sliceStrRet) == 2 { 67 | syncRetCode, _ = strconv.Atoi(sliceStrRet[0]) 68 | syncString = sliceStrRet[1] 69 | } 70 | } 71 | 72 | if *syncEndpoint != "" { 73 | if *verbose { 74 | fmt.Println("Resetting the board") 75 | } 76 | 77 | resp, err := httpClient.Post(httpheader+*networkAddress+":"+*networkPort+*syncEndpoint, "", nil) 78 | if err != nil || resp.StatusCode != syncRetCode { 79 | if *verbose { 80 | fmt.Println("Failed to reset the board, upload failed") 81 | } 82 | os.Exit(1) 83 | } 84 | defer resp.Body.Close() 85 | } 86 | 87 | if *syncEndpoint != "" { 88 | if *verbose { 89 | fmt.Println("Waiting for the upload to start") 90 | } 91 | 92 | timeout := 0 93 | 94 | for timeout < 10 { 95 | resp, err := httpClient.Get(httpheader + *networkAddress + ":" + *networkPort + *syncEndpoint) 96 | if err != nil { 97 | if *verbose { 98 | fmt.Println("Failed to reset the board, upload failed") 99 | } 100 | os.Exit(1) 101 | } 102 | defer resp.Body.Close() 103 | 104 | statusString, err := ioutil.ReadAll(resp.Body) 105 | 106 | if strings.Contains(string(statusString), syncString) { 107 | fmt.Println(string(statusString)) 108 | break 109 | } 110 | 111 | time.Sleep(1 * time.Second) 112 | timeout++ 113 | } 114 | } 115 | 116 | if *uploadEndpoint != "" { 117 | f, err := os.Open(*sketchPath) 118 | if err != nil { 119 | if *verbose { 120 | fmt.Println("Failed to open the sketch") 121 | } 122 | os.Exit(1) 123 | } 124 | defer f.Close() 125 | 126 | var sketchData *bytes.Buffer 127 | 128 | if *binMode { 129 | sketchData = streamToBytes(f) 130 | } else { 131 | str := streamToString(f) 132 | re := regexp.MustCompile(`\r?\n`) 133 | str = re.ReplaceAllString(str, "") 134 | sketchData = bytes.NewBufferString(str) 135 | } 136 | 137 | if *hasDownloadFile { 138 | go http.ListenAndServe(":"+*networkPort, http.FileServer(http.Dir(filepath.Dir(*sketchPath)))) 139 | // find my IP if not specified 140 | ip := getMyIP(net.ParseIP(*networkAddress)) 141 | url := "http://" + ip.String() + ":" + *networkPort + "/" + filepath.Base(*sketchPath) 142 | sketchData = bytes.NewBufferString(url) 143 | fmt.Println("Serving sketch on " + url) 144 | } 145 | 146 | req, err := http.NewRequest("POST", httpheader+*networkAddress+":"+*networkPort+*uploadEndpoint, sketchData) 147 | if err != nil { 148 | if *verbose { 149 | fmt.Println("Error sending sketch file") 150 | } 151 | os.Exit(1) 152 | } 153 | 154 | if *binMode { 155 | req.Header.Set("Content-Type", "application/octet-stream") 156 | } else { 157 | req.Header.Set("Content-Type", "application/x-www-form-urlencoded") 158 | } 159 | 160 | if len(*username) > 0 && len(*password) != 0 { 161 | req.SetBasicAuth(*username, *password) 162 | } 163 | 164 | if *verbose { 165 | trace := &httptrace.ClientTrace{ 166 | ConnectStart: func(network, addr string) { 167 | fmt.Print("Connecting to board ... ") 168 | }, 169 | ConnectDone: func(network, addr string, err error) { 170 | if err != nil { 171 | fmt.Println("failed!") 172 | } else { 173 | fmt.Println(" done") 174 | } 175 | }, 176 | WroteHeaders: func() { 177 | fmt.Print("Uploading sketch ... ") 178 | }, 179 | WroteRequest: func(wri httptrace.WroteRequestInfo) { 180 | fmt.Println(" done") 181 | fmt.Print("Flashing sketch ... ") 182 | }, 183 | GotFirstResponseByte: func() { 184 | fmt.Println(" done") 185 | }, 186 | } 187 | req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace)) 188 | } 189 | 190 | resp, err := httpClient.Do(req) 191 | if err != nil { 192 | if *verbose { 193 | fmt.Println("Error flashing the sketch") 194 | } 195 | os.Exit(1) 196 | } 197 | defer resp.Body.Close() 198 | 199 | respStr, _ := ioutil.ReadAll(resp.Body) 200 | 201 | if resp.StatusCode != 200 { 202 | if *verbose { 203 | fmt.Println("Error flashing the sketch:" + string(respStr)) 204 | } 205 | os.Exit(1) 206 | } 207 | 208 | if *verbose { 209 | fmt.Println(string(respStr)) 210 | fmt.Println("Sketch uploaded successfully") 211 | } 212 | } 213 | 214 | if *resetEndpoint != "" { 215 | if *verbose { 216 | fmt.Println("Resetting the board") 217 | } 218 | 219 | resp, err := httpClient.Post(httpheader+*networkAddress+":"+*networkPort+*resetEndpoint, "", nil) 220 | if err != nil { 221 | if *verbose { 222 | fmt.Println("Failed to reset the board, please reset manually") 223 | } 224 | os.Exit(0) 225 | } 226 | defer resp.Body.Close() 227 | } 228 | } 229 | 230 | func streamToBytes(stream io.Reader) *bytes.Buffer { 231 | buf := new(bytes.Buffer) 232 | buf.ReadFrom(stream) 233 | return buf 234 | } 235 | 236 | func streamToString(stream io.Reader) string { 237 | return streamToBytes(stream).String() 238 | } 239 | 240 | func getMyIP(otherip net.IP) net.IP { 241 | ifaces, _ := net.Interfaces() 242 | // handle err 243 | var ips []net.IP 244 | for _, i := range ifaces { 245 | addrs, _ := i.Addrs() 246 | // handle err 247 | for _, addr := range addrs { 248 | switch v := addr.(type) { 249 | case *net.IPNet: 250 | if v.Contains(otherip) { 251 | return v.IP 252 | } 253 | case *net.IPAddr: 254 | ips = append(ips, v.IP) 255 | } 256 | } 257 | } 258 | return nil 259 | } 260 | -------------------------------------------------------------------------------- /.github/workflows/check-prettier-formatting-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md 2 | name: Check Prettier Formatting 3 | 4 | # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows 5 | on: 6 | create: 7 | push: 8 | paths: 9 | - ".github/workflows/check-prettier-formatting-task.ya?ml" 10 | - ".npmrc" 11 | - "Taskfile.ya?ml" 12 | - "**/.prettierignore" 13 | - "**/.prettierrc*" 14 | # Prettier-covered file patterns are defined by: 15 | # https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml 16 | # 17 | # CSS 18 | - "**.css" 19 | - "**.wxss" 20 | # PostCSS 21 | - "**.pcss" 22 | - "**.postcss" 23 | # Less 24 | - "**.less" 25 | # SCSS 26 | - "**.scss" 27 | # GraphQL 28 | - "**.graphqls?" 29 | - "**.gql" 30 | # handlebars 31 | - "**.handlebars" 32 | - "**.hbs" 33 | # HTML 34 | - "**.mjml" 35 | - "**.html?" 36 | - "**.html.hl" 37 | - "**.st" 38 | - "**.xht" 39 | - "**.xhtml" 40 | # Vue 41 | - "**.vue" 42 | # JavaScript 43 | - "**.flow" 44 | - "**._?jsb?" 45 | - "**.bones" 46 | - "**.cjs" 47 | - "**.es6?" 48 | - "**.frag" 49 | - "**.gs" 50 | - "**.jake" 51 | - "**.jscad" 52 | - "**.jsfl" 53 | - "**.js[ms]" 54 | - "**.[mn]js" 55 | - "**.pac" 56 | - "**.wxs" 57 | - "**.[xs]s?js" 58 | - "**.xsjslib" 59 | # JSX 60 | - "**.jsx" 61 | # TypeScript 62 | - "**.ts" 63 | # TSX 64 | - "**.tsx" 65 | # JSON 66 | - "**/.eslintrc" 67 | - "**.json" 68 | - "**.avsc" 69 | - "**.geojson" 70 | - "**.gltf" 71 | - "**.har" 72 | - "**.ice" 73 | - "**.JSON-tmLanguage" 74 | - "**.mcmeta" 75 | - "**.tfstate" 76 | - "**.topojson" 77 | - "**.webapp" 78 | - "**.webmanifest" 79 | - "**.yyp?" 80 | # JSONC 81 | - "**/.babelrc" 82 | - "**/.jscsrc" 83 | - "**/.js[hl]intrc" 84 | - "**.jsonc" 85 | - "**.sublime-*" 86 | # JSON5 87 | - "**.json5" 88 | # Markdown 89 | - "**.mdx?" 90 | - "**.markdown" 91 | - "**.mk?down" 92 | - "**.mdwn" 93 | - "**.mkdn?" 94 | - "**.ronn" 95 | - "**.workbook" 96 | # TOML 97 | - "**/Cargo.lock" 98 | - "**/Cargo.toml.orig" 99 | - "**/Gopkg.lock" 100 | - "**/Pipfile" 101 | - "**/pdm.lock" 102 | - "**.toml" 103 | # YAML 104 | - "**/.clang-format" 105 | - "**/.clang-tidy" 106 | - "**/.gemrc" 107 | - "**/glide.lock" 108 | - "**.ya?ml*" 109 | - "**.mir" 110 | - "**.reek" 111 | - "**.rviz" 112 | - "**.sublime-syntax" 113 | - "**.syntax" 114 | pull_request: 115 | paths: 116 | - ".github/workflows/check-prettier-formatting-task.ya?ml" 117 | - ".npmrc" 118 | - "Taskfile.ya?ml" 119 | - "**/.prettierignore" 120 | - "**/.prettierrc*" 121 | # CSS 122 | - "**.css" 123 | - "**.wxss" 124 | # PostCSS 125 | - "**.pcss" 126 | - "**.postcss" 127 | # Less 128 | - "**.less" 129 | # SCSS 130 | - "**.scss" 131 | # GraphQL 132 | - "**.graphqls?" 133 | - "**.gql" 134 | # handlebars 135 | - "**.handlebars" 136 | - "**.hbs" 137 | # HTML 138 | - "**.mjml" 139 | - "**.html?" 140 | - "**.html.hl" 141 | - "**.st" 142 | - "**.xht" 143 | - "**.xhtml" 144 | # Vue 145 | - "**.vue" 146 | # JavaScript 147 | - "**.flow" 148 | - "**._?jsb?" 149 | - "**.bones" 150 | - "**.cjs" 151 | - "**.es6?" 152 | - "**.frag" 153 | - "**.gs" 154 | - "**.jake" 155 | - "**.jscad" 156 | - "**.jsfl" 157 | - "**.js[ms]" 158 | - "**.[mn]js" 159 | - "**.pac" 160 | - "**.wxs" 161 | - "**.[xs]s?js" 162 | - "**.xsjslib" 163 | # JSX 164 | - "**.jsx" 165 | # TypeScript 166 | - "**.ts" 167 | # TSX 168 | - "**.tsx" 169 | # JSON 170 | - "**/.eslintrc" 171 | - "**.json" 172 | - "**.avsc" 173 | - "**.geojson" 174 | - "**.gltf" 175 | - "**.har" 176 | - "**.ice" 177 | - "**.JSON-tmLanguage" 178 | - "**.mcmeta" 179 | - "**.tfstate" 180 | - "**.topojson" 181 | - "**.webapp" 182 | - "**.webmanifest" 183 | - "**.yyp?" 184 | # JSONC 185 | - "**/.babelrc" 186 | - "**/.jscsrc" 187 | - "**/.js[hl]intrc" 188 | - "**.jsonc" 189 | - "**.sublime-*" 190 | # JSON5 191 | - "**.json5" 192 | # Markdown 193 | - "**.mdx?" 194 | - "**.markdown" 195 | - "**.mk?down" 196 | - "**.mdwn" 197 | - "**.mkdn?" 198 | - "**.ronn" 199 | - "**.workbook" 200 | # TOML 201 | - "**/Cargo.lock" 202 | - "**/Cargo.toml.orig" 203 | - "**/Gopkg.lock" 204 | - "**/Pipfile" 205 | - "**/pdm.lock" 206 | - "**.toml" 207 | # YAML 208 | - "**/.clang-format" 209 | - "**/.clang-tidy" 210 | - "**/.gemrc" 211 | - "**/glide.lock" 212 | - "**.ya?ml*" 213 | - "**.mir" 214 | - "**.reek" 215 | - "**.rviz" 216 | - "**.sublime-syntax" 217 | - "**.syntax" 218 | schedule: 219 | # Run periodically to catch breakage caused by external changes. 220 | - cron: "0 4 * * WED" 221 | workflow_dispatch: 222 | repository_dispatch: 223 | 224 | jobs: 225 | run-determination: 226 | runs-on: ubuntu-latest 227 | permissions: {} 228 | outputs: 229 | result: ${{ steps.determination.outputs.result }} 230 | steps: 231 | - name: Determine if the rest of the workflow should run 232 | id: determination 233 | run: | 234 | RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" 235 | # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. 236 | if [[ 237 | "${{ github.event_name }}" != "create" || 238 | "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX 239 | ]]; then 240 | # Run the other jobs. 241 | RESULT="true" 242 | else 243 | # There is no need to run the other jobs. 244 | RESULT="false" 245 | fi 246 | 247 | echo "result=$RESULT" >>$GITHUB_OUTPUT 248 | 249 | check: 250 | needs: run-determination 251 | if: needs.run-determination.outputs.result == 'true' 252 | runs-on: ubuntu-latest 253 | permissions: 254 | contents: read 255 | 256 | steps: 257 | - name: Checkout repository 258 | uses: actions/checkout@v6 259 | 260 | - name: Setup Node.js 261 | uses: actions/setup-node@v6 262 | with: 263 | node-version-file: package.json 264 | 265 | - name: Install Task 266 | uses: arduino/setup-task@v2 267 | with: 268 | repo-token: ${{ secrets.GITHUB_TOKEN }} 269 | version: 3.x 270 | 271 | - name: Format with Prettier 272 | run: task general:format-prettier 273 | 274 | - name: Check formatting 275 | run: | 276 | git diff \ 277 | --color \ 278 | --exit-code 279 | -------------------------------------------------------------------------------- /.github/workflows/release-go-crosscompile-task.yml: -------------------------------------------------------------------------------- 1 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/release-go-crosscompile-task.md 2 | name: Release 3 | 4 | env: 5 | # As defined by the Taskfile's PROJECT_NAME variable 6 | PROJECT_NAME: arduinoOTA 7 | # As defined by the Taskfile's DIST_DIR variable 8 | DIST_DIR: dist 9 | # The project's folder on Arduino's download server for uploading builds 10 | AWS_PLUGIN_TARGET: /arduinoOTA/ 11 | ARTIFACT_PREFIX: dist- 12 | 13 | on: 14 | push: 15 | tags: 16 | - "[0-9]+.[0-9]+.[0-9]+*" 17 | 18 | jobs: 19 | create-release-artifacts: 20 | runs-on: ubuntu-latest 21 | permissions: 22 | contents: read 23 | 24 | strategy: 25 | matrix: 26 | os: 27 | - task: Windows_32bit 28 | artifact-suffix: Windows_32bit 29 | - task: Windows_64bit 30 | artifact-suffix: Windows_64bit 31 | - task: Linux_32bit 32 | artifact-suffix: Linux_32bit 33 | - task: Linux_64bit 34 | artifact-suffix: Linux_64bit 35 | - task: Linux_ARMv6 36 | artifact-suffix: Linux_ARMv6 37 | - task: Linux_ARMv7 38 | artifact-suffix: Linux_ARMv7 39 | - task: Linux_ARM64 40 | artifact-suffix: Linux_ARM64 41 | - task: macOS_64bit 42 | artifact-suffix: macOS_64bit 43 | - task: macOS_ARM64 44 | artifact-suffix: macOS_ARM64 45 | 46 | steps: 47 | - name: Checkout repository 48 | uses: actions/checkout@v6 49 | with: 50 | fetch-depth: 0 51 | 52 | - name: Create changelog 53 | # Avoid creating the same changelog for each os 54 | if: matrix.os.task == 'Windows_32bit' 55 | uses: arduino/create-changelog@v1 56 | with: 57 | tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$' 58 | filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*' 59 | case-insensitive-regex: true 60 | changelog-file-path: "${{ env.DIST_DIR }}/CHANGELOG.md" 61 | 62 | - name: Install Go 63 | uses: actions/setup-go@v6 64 | with: 65 | go-version-file: go.mod 66 | 67 | - name: Install Task 68 | uses: arduino/setup-task@v2 69 | with: 70 | repo-token: ${{ secrets.GITHUB_TOKEN }} 71 | version: 3.x 72 | 73 | - name: Build 74 | run: task dist:${{ matrix.os.task }} 75 | 76 | - name: Upload artifacts 77 | uses: actions/upload-artifact@v6 78 | with: 79 | if-no-files-found: error 80 | name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.os.artifact-suffix }} 81 | path: ${{ env.DIST_DIR }} 82 | 83 | notarize-macos: 84 | name: Notarize ${{ matrix.build.artifact-suffix }} 85 | runs-on: macos-latest 86 | needs: create-release-artifacts 87 | permissions: 88 | contents: read 89 | 90 | env: 91 | GON_CONFIG_PATH: gon.config.hcl 92 | 93 | strategy: 94 | matrix: 95 | build: 96 | - artifact-suffix: macOS_64bit 97 | folder-suffix: darwin_amd64 98 | package-suffix: "macOS_64bit.tar.gz" 99 | - artifact-suffix: macOS_ARM64 100 | folder-suffix: darwin_arm64 101 | package-suffix: "macOS_ARM64.tar.gz" 102 | 103 | steps: 104 | - name: Set environment variables 105 | run: | 106 | # See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable 107 | echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >>"$GITHUB_ENV" 108 | 109 | TAG="${GITHUB_REF/refs\/tags\//}" 110 | echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >>$GITHUB_ENV 111 | 112 | - name: Checkout repository 113 | uses: actions/checkout@v6 114 | 115 | - name: Download artifacts 116 | uses: actions/download-artifact@v7 117 | with: 118 | name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }} 119 | path: ${{ env.DIST_DIR }} 120 | 121 | - name: Import Code-Signing Certificates 122 | env: 123 | KEYCHAIN: "sign.keychain" 124 | INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" 125 | # Arbitrary password for a keychain that exists only for the duration of the job, so not secret 126 | KEYCHAIN_PASSWORD: keychainpassword 127 | run: | 128 | echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode >"${{ env.INSTALLER_CERT_MAC_PATH }}" 129 | 130 | security create-keychain \ 131 | -p "${{ env.KEYCHAIN_PASSWORD }}" \ 132 | "${{ env.KEYCHAIN }}" 133 | 134 | security default-keychain \ 135 | -s "${{ env.KEYCHAIN }}" 136 | 137 | security unlock-keychain \ 138 | -p "${{ env.KEYCHAIN_PASSWORD }}" \ 139 | "${{ env.KEYCHAIN }}" 140 | 141 | security import \ 142 | "${{ env.INSTALLER_CERT_MAC_PATH }}" \ 143 | -k "${{ env.KEYCHAIN }}" \ 144 | -f pkcs12 \ 145 | -A \ 146 | -T "/usr/bin/codesign" \ 147 | -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" 148 | 149 | security set-key-partition-list \ 150 | -S apple-tool:,apple: \ 151 | -s \ 152 | -k "${{ env.KEYCHAIN_PASSWORD }}" \ 153 | "${{ env.KEYCHAIN }}" 154 | 155 | - name: Install gon for code signing and app notarization 156 | run: | 157 | wget \ 158 | -q \ 159 | https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip 160 | 161 | unzip \ 162 | gon_macos.zip \ 163 | -d /usr/local/bin 164 | 165 | - name: Write gon config to file 166 | # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) 167 | run: | 168 | cat >"${{ env.GON_CONFIG_PATH }}" \ 169 | <${TAG}-checksums.txt 235 | 236 | - name: Identify Prerelease 237 | # This is a workaround while waiting for create-release action 238 | # to implement auto pre-release based on tag 239 | id: prerelease 240 | run: | 241 | wget \ 242 | -q \ 243 | -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.2.0.zip 244 | 245 | unzip \ 246 | -p /tmp/3.2.0.zip semver-tool-3.2.0/src/semver \ 247 | >/tmp/semver 248 | 249 | chmod \ 250 | +x \ 251 | /tmp/semver 252 | 253 | if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then 254 | echo "IS_PRE=true" >>$GITHUB_OUTPUT 255 | fi 256 | 257 | - name: Create Github Release and upload artifacts 258 | uses: ncipollo/release-action@v1 259 | with: 260 | token: ${{ secrets.GITHUB_TOKEN }} 261 | bodyFile: ${{ env.DIST_DIR }}/CHANGELOG.md 262 | draft: false 263 | prerelease: ${{ steps.prerelease.outputs.IS_PRE }} 264 | # NOTE: "Artifact is a directory" warnings are expected and don't indicate a problem 265 | # (all the files we need are in the DIST_DIR root) 266 | artifacts: ${{ env.DIST_DIR }}/* 267 | 268 | - name: Upload release files on Arduino downloads servers 269 | uses: docker://plugins/s3 270 | env: 271 | PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*" 272 | PLUGIN_TARGET: ${{ env.AWS_PLUGIN_TARGET }} 273 | PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/" 274 | PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }} 275 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 276 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 277 | -------------------------------------------------------------------------------- /Taskfile.yml: -------------------------------------------------------------------------------- 1 | # See: https://taskfile.dev/#/usage 2 | version: "3" 3 | 4 | includes: 5 | dist: ./DistTasks.yml 6 | 7 | vars: 8 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml 9 | # Path of the project's primary Go module: 10 | DEFAULT_GO_MODULE_PATH: . 11 | DEFAULT_GO_PACKAGES: 12 | sh: | 13 | echo $( 14 | cd {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}} && 15 | go list ./... | tr '\n' ' ' || 16 | echo '"ERROR: Unable to discover Go packages"' 17 | ) 18 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml 19 | # Path of the primary npm-managed project: 20 | DEFAULT_NPM_PROJECT_PATH: . 21 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml 22 | PROJECT_NAME: "arduinoOTA" 23 | DIST_DIR: "dist" 24 | # build vars 25 | COMMIT: 26 | sh: | 27 | echo \ 28 | "$( 29 | git log \ 30 | --no-show-signature \ 31 | -n 1 \ 32 | --format=%h 33 | )" 34 | TIMESTAMP: 35 | sh: | 36 | echo \ 37 | "$( 38 | date \ 39 | -u \ 40 | +"%Y-%m-%dT%H:%M:%SZ" 41 | )" 42 | TIMESTAMP_SHORT: 43 | sh: echo "{{now | date "20060102"}}" 44 | TAG: 45 | sh: | 46 | echo \ 47 | "$( 48 | git tag \ 49 | --points-at=HEAD \ 50 | 2>/dev/null \ 51 | | \ 52 | head -n1 53 | )" 54 | VERSION: "{{if .NIGHTLY}}nightly-{{.TIMESTAMP_SHORT}}{{else if .TAG}}{{.TAG}}{{else}}{{.PACKAGE_NAME_PREFIX}}git-snapshot{{end}}" 55 | CONFIGURATION_PACKAGE: "github.com/arduino/arduinoOTA/version" 56 | LDFLAGS: >- 57 | -ldflags 58 | ' 59 | -X {{.CONFIGURATION_PACKAGE}}.versionString={{.VERSION}} 60 | -X {{.CONFIGURATION_PACKAGE}}.commit={{.COMMIT}} 61 | -X {{.CONFIGURATION_PACKAGE}}.date={{.TIMESTAMP}} 62 | ' 63 | 64 | tasks: 65 | build: 66 | desc: Build the project 67 | deps: 68 | - task: go:build 69 | 70 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml 71 | ci:validate: 72 | desc: Validate GitHub Actions workflows against their JSON schema 73 | vars: 74 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json 75 | WORKFLOW_SCHEMA_URL: https://json.schemastore.org/github-workflow 76 | WORKFLOW_SCHEMA_PATH: 77 | sh: task utility:mktemp-file TEMPLATE="workflow-schema-XXXXXXXXXX.json" 78 | WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}" 79 | deps: 80 | - task: npm:install-deps 81 | vars: 82 | PROJECT_PATH: . 83 | cmds: 84 | - | 85 | wget \ 86 | --quiet \ 87 | --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \ 88 | {{.WORKFLOW_SCHEMA_URL}} 89 | - | 90 | npx \ 91 | --package=ajv-cli \ 92 | --package=ajv-formats \ 93 | ajv validate \ 94 | --all-errors \ 95 | --strict=false \ 96 | -c ajv-formats \ 97 | -s "{{.WORKFLOW_SCHEMA_PATH}}" \ 98 | -d "{{.WORKFLOWS_DATA_PATH}}" 99 | 100 | docs:generate: 101 | desc: Create all generated documentation content 102 | # This is an "umbrella" task used to call any documentation generation processes the project has. 103 | # It can be left empty if there are none. 104 | 105 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml 106 | general:cache-dep-licenses: 107 | desc: Cache dependency license metadata 108 | deps: 109 | - task: general:prepare-deps 110 | cmds: 111 | - | 112 | if ! which licensed &>/dev/null; then 113 | if [[ {{OS}} == "windows" ]]; then 114 | echo "Licensed does not have Windows support." 115 | echo "Please use Linux/macOS or download the dependencies cache from the GitHub Actions workflow artifact." 116 | else 117 | echo "licensed not found or not in PATH." 118 | echo "Please install: https://github.com/licensee/licensed#installation" 119 | fi 120 | exit 1 121 | fi 122 | - licensed cache 123 | 124 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies-task/Taskfile.yml 125 | general:check-dep-licenses: 126 | desc: Check for unapproved dependency licenses 127 | deps: 128 | - task: general:cache-dep-licenses 129 | cmds: 130 | - licensed status 131 | 132 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml 133 | general:check-formatting: 134 | desc: Check basic formatting style of all files 135 | cmds: 136 | - | 137 | if 138 | ! which ec \ 139 | &>/dev/null 140 | then 141 | echo "ec not found or not in PATH." 142 | echo "Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation" 143 | exit 1 144 | fi 145 | - ec 146 | 147 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml 148 | general:format-prettier: 149 | desc: Format all supported files with Prettier 150 | deps: 151 | - task: npm:install-deps 152 | vars: 153 | PROJECT_PATH: . 154 | cmds: 155 | - | 156 | npx \ 157 | prettier \ 158 | --write \ 159 | . 160 | 161 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml 162 | general:check-spelling: 163 | desc: Check for commonly misspelled words 164 | deps: 165 | - task: poetry:install-deps 166 | vars: 167 | POETRY_GROUPS: dev 168 | cmds: 169 | - | 170 | if ! { 171 | poetry run \ 172 | codespell 173 | }; then 174 | echo 175 | echo "If this was a false positive, add the word to the ignore list:" 176 | echo "https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md#false-positives" 177 | exit 1 178 | fi 179 | 180 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml 181 | general:correct-spelling: 182 | desc: Correct commonly misspelled words where possible 183 | deps: 184 | - task: poetry:install-deps 185 | vars: 186 | POETRY_GROUPS: dev 187 | cmds: 188 | - | 189 | poetry run \ 190 | codespell \ 191 | --write-changes 192 | 193 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-dependencies-task/Taskfile.yml 194 | general:prepare-deps: 195 | desc: Prepare project dependencies for license check 196 | # No preparation is needed for Go module-based projects. 197 | 198 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml 199 | go:build: 200 | desc: Build the Go code 201 | dir: "{{.DEFAULT_GO_MODULE_PATH}}" 202 | cmds: 203 | - | 204 | go build \ 205 | -v \ 206 | {{.LDFLAGS}} 207 | 208 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 209 | go:fix: 210 | desc: | 211 | Modernize usages of outdated APIs. 212 | Environment variable parameters: 213 | - GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}). 214 | - GO_PACKAGES: List of Go packages to modernize (default: all packages of the module). 215 | dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}" 216 | cmds: 217 | - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 218 | 219 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 220 | go:format: 221 | desc: | 222 | Format Go code. 223 | Environment variable parameters: 224 | - GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}). 225 | - GO_PACKAGES: List of Go packages to modernize (default: all packages of the module). 226 | dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}" 227 | cmds: 228 | - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 229 | 230 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 231 | go:lint: 232 | desc: | 233 | Lint Go code 234 | Environment variable parameters: 235 | - GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}). 236 | - GO_PACKAGES: List of Go packages to modernize (default: all packages of the module). 237 | dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}" 238 | cmds: 239 | - | 240 | if ! which golint &>/dev/null; then 241 | echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation" 242 | exit 1 243 | fi 244 | - | 245 | golint \ 246 | {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \ 247 | {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 248 | 249 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml 250 | go:vet: 251 | desc: | 252 | Check for errors in Go code. 253 | Environment variable parameters: 254 | - GO_MODULE_PATH: Path of the Go module root (default: {{.DEFAULT_GO_MODULE_PATH}}). 255 | - GO_PACKAGES: List of Go packages to modernize (default: all packages of the module). 256 | dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}" 257 | cmds: 258 | - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}} 259 | 260 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml 261 | markdown:check-links: 262 | desc: Check for broken links 263 | vars: 264 | # The command is defined in a Taskfile variable to allow it to be broken into multiple lines for readability. 265 | # This can't be done in the `cmd` object of the Taskfile because `npx --call` uses the native shell, which causes 266 | # standard newline escaping syntax to not work when the task is run on Windows. 267 | # 268 | # Using -regex instead of -name to avoid Task's behavior of globbing even when quoted on Windows 269 | # The odd method for escaping . in the regex is required for windows compatibility because mvdan.cc/sh gives 270 | # \ characters special treatment on Windows in an attempt to support them as path separators. 271 | # 272 | # prettier-ignore 273 | CHECK_LINKS_COMMAND: 274 | " 275 | find . \ 276 | -type d -name \".git\" -prune -o \ 277 | -type d -name \".licenses\" -prune -o \ 278 | -type d -name \"__pycache__\" -prune -o \ 279 | -type d -name \"node_modules\" -prune -o \ 280 | -regex \".*[.]md\" \ 281 | -exec \ 282 | markdown-link-check \ 283 | --quiet \ 284 | --config \"./.markdown-link-check.json\" \ 285 | \\{\\} \ 286 | + 287 | " 288 | deps: 289 | - task: docs:generate 290 | - task: npm:install-deps 291 | vars: 292 | PROJECT_PATH: . 293 | cmds: 294 | - | 295 | npx \ 296 | --package=markdown-link-check \ 297 | --call='{{.CHECK_LINKS_COMMAND}}' 298 | 299 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml 300 | markdown:fix: 301 | desc: Automatically correct linting violations in Markdown files where possible 302 | deps: 303 | - task: npm:install-deps 304 | vars: 305 | PROJECT_PATH: . 306 | cmds: 307 | - | 308 | npx \ 309 | markdownlint-cli \ 310 | --fix \ 311 | "**/*.md" 312 | 313 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml 314 | markdown:lint: 315 | desc: Check for problems in Markdown files 316 | deps: 317 | - task: npm:install-deps 318 | vars: 319 | PROJECT_PATH: . 320 | cmds: 321 | - | 322 | npx \ 323 | markdownlint-cli \ 324 | "**/*.md" 325 | 326 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml 327 | npm:fix-config: 328 | desc: | 329 | Fix problems with the npm configuration file. 330 | Environment variable parameters: 331 | - PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}). 332 | dir: "{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}" 333 | cmds: 334 | - | 335 | npm config \ 336 | --location project \ 337 | fix 338 | 339 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml 340 | npm:install-deps: 341 | desc: | 342 | Install dependencies managed by npm. 343 | Environment variable parameters: 344 | - PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}). 345 | dir: | 346 | "{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}" 347 | run: when_changed 348 | cmds: 349 | - npm install 350 | 351 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml 352 | npm:validate: 353 | desc: | 354 | Validate npm configuration files against their JSON schema. 355 | Environment variable parameters: 356 | - PROJECT_PATH: Path of the npm-managed project (default: {{.DEFAULT_NPM_PROJECT_PATH}}). 357 | deps: 358 | - task: npm:install-deps 359 | vars: 360 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json 361 | SCHEMA_URL: https://json.schemastore.org/package.json 362 | SCHEMA_PATH: 363 | sh: task utility:mktemp-file TEMPLATE="package-json-schema-XXXXXXXXXX.json" 364 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/ava.json 365 | AVA_SCHEMA_URL: https://json.schemastore.org/ava.json 366 | AVA_SCHEMA_PATH: 367 | sh: task utility:mktemp-file TEMPLATE="ava-schema-XXXXXXXXXX.json" 368 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/base.json 369 | BASE_SCHEMA_URL: https://json.schemastore.org/base.json 370 | BASE_SCHEMA_PATH: 371 | sh: task utility:mktemp-file TEMPLATE="base-schema-XXXXXXXXXX.json" 372 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/eslintrc.json 373 | ESLINTRC_SCHEMA_URL: https://json.schemastore.org/eslintrc.json 374 | ESLINTRC_SCHEMA_PATH: 375 | sh: task utility:mktemp-file TEMPLATE="eslintrc-schema-XXXXXXXXXX.json" 376 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/jscpd.json 377 | JSCPD_SCHEMA_URL: https://json.schemastore.org/jscpd.json 378 | JSCPD_SCHEMA_PATH: 379 | sh: task utility:mktemp-file TEMPLATE="jscpd-schema-XXXXXXXXXX.json" 380 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/npm-badges.json 381 | NPM_BADGES_SCHEMA_URL: https://json.schemastore.org/npm-badges.json 382 | NPM_BADGES_SCHEMA_PATH: 383 | sh: task utility:mktemp-file TEMPLATE="npm-badges-schema-XXXXXXXXXX.json" 384 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/partial-eslint-plugins.json 385 | PARTIAL_ESLINT_PLUGINS_SCHEMA_URL: https://json.schemastore.org/partial-eslint-plugins.json 386 | PARTIAL_ESLINT_PLUGINS_PATH: 387 | sh: task utility:mktemp-file TEMPLATE="partial-eslint-plugins-schema-XXXXXXXXXX.json" 388 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/prettierrc.json 389 | PRETTIERRC_SCHEMA_URL: https://json.schemastore.org/prettierrc.json 390 | PRETTIERRC_SCHEMA_PATH: 391 | sh: task utility:mktemp-file TEMPLATE="prettierrc-schema-XXXXXXXXXX.json" 392 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/semantic-release.json 393 | SEMANTIC_RELEASE_SCHEMA_URL: https://json.schemastore.org/semantic-release.json 394 | SEMANTIC_RELEASE_SCHEMA_PATH: 395 | sh: task utility:mktemp-file TEMPLATE="semantic-release-schema-XXXXXXXXXX.json" 396 | # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/stylelintrc.json 397 | STYLELINTRC_SCHEMA_URL: https://json.schemastore.org/stylelintrc.json 398 | STYLELINTRC_SCHEMA_PATH: 399 | sh: task utility:mktemp-file TEMPLATE="stylelintrc-schema-XXXXXXXXXX.json" 400 | INSTANCE_PATH: >- 401 | {{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}/package.json 402 | cmds: 403 | - wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}} 404 | - wget --quiet --output-document="{{.AVA_SCHEMA_PATH}}" {{.AVA_SCHEMA_URL}} 405 | - wget --quiet --output-document="{{.BASE_SCHEMA_PATH}}" {{.BASE_SCHEMA_URL}} 406 | - wget --quiet --output-document="{{.ESLINTRC_SCHEMA_PATH}}" {{.ESLINTRC_SCHEMA_URL}} 407 | - wget --quiet --output-document="{{.JSCPD_SCHEMA_PATH}}" {{.JSCPD_SCHEMA_URL}} 408 | - wget --quiet --output-document="{{.NPM_BADGES_SCHEMA_PATH}}" {{.NPM_BADGES_SCHEMA_URL}} 409 | - wget --quiet --output-document="{{.PARTIAL_ESLINT_PLUGINS_PATH}}" {{.PARTIAL_ESLINT_PLUGINS_SCHEMA_URL}} 410 | - wget --quiet --output-document="{{.PRETTIERRC_SCHEMA_PATH}}" {{.PRETTIERRC_SCHEMA_URL}} 411 | - wget --quiet --output-document="{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" {{.SEMANTIC_RELEASE_SCHEMA_URL}} 412 | - wget --quiet --output-document="{{.STYLELINTRC_SCHEMA_PATH}}" {{.STYLELINTRC_SCHEMA_URL}} 413 | - | 414 | npx \ 415 | --package=ajv-cli \ 416 | --package=ajv-formats \ 417 | ajv validate \ 418 | --all-errors \ 419 | --strict=false \ 420 | -s "{{.SCHEMA_PATH}}" \ 421 | -r "{{.AVA_SCHEMA_PATH}}" \ 422 | -r "{{.BASE_SCHEMA_PATH}}" \ 423 | -r "{{.ESLINTRC_SCHEMA_PATH}}" \ 424 | -r "{{.JSCPD_SCHEMA_PATH}}" \ 425 | -r "{{.NPM_BADGES_SCHEMA_PATH}}" \ 426 | -r "{{.PARTIAL_ESLINT_PLUGINS_PATH}}" \ 427 | -r "{{.PRETTIERRC_SCHEMA_PATH}}" \ 428 | -r "{{.SEMANTIC_RELEASE_SCHEMA_PATH}}" \ 429 | -r "{{.STYLELINTRC_SCHEMA_PATH}}" \ 430 | -d "{{.INSTANCE_PATH}}" 431 | 432 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml 433 | poetry:install: 434 | desc: Install Poetry 435 | run: when_changed 436 | cmds: 437 | - | 438 | if ! which pipx &>/dev/null; then 439 | echo "pipx not found or not in PATH." 440 | echo "Please install: https://pipx.pypa.io/stable/installation/#installing-pipx" 441 | exit 1 442 | fi 443 | - | 444 | if ! which yq &>/dev/null; then 445 | echo "yq not found or not in PATH." 446 | echo "Please install: https://github.com/mikefarah/yq/#install" 447 | exit 1 448 | fi 449 | - | 450 | export PIPX_DEFAULT_PYTHON="$( \ 451 | task utility:normalize-path \ 452 | RAW_PATH="$(which python)" \ 453 | )" 454 | 455 | poetry_constraint="$( \ 456 | yq \ 457 | --input-format toml \ 458 | --output-format yaml \ 459 | '.tool.poetry.group.pipx.dependencies.poetry' \ 460 | /dev/null 527 | then 528 | # Even though the shell handles POSIX format absolute paths as expected, external applications do not. 529 | # So paths passed to such applications must first be converted to Windows format. 530 | cygpath \ 531 | -w \ 532 | "{{.RAW_PATH}}" 533 | else 534 | echo "{{.RAW_PATH}}" 535 | fi 536 | 537 | # Environment variable parameters: 538 | # - YAMLLINT_FORMAT: yamllint output format (default: colored). 539 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-yaml-task/Taskfile.yml 540 | yaml:lint: 541 | desc: Check for problems with YAML files 542 | deps: 543 | - task: poetry:install-deps 544 | vars: 545 | POETRY_GROUPS: dev 546 | cmds: 547 | - | 548 | poetry run \ 549 | yamllint \ 550 | --format \ 551 | {{default "colored" .YAMLLINT_FORMAT}} \ 552 | . 553 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------