Skip to content

Add CI workflow to check for unapproved Go dependency licenses #288

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[codespell]
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
ignore-words-list = ot,propert
skip = ./.git,**/go.mod,**/go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site
skip = ./.git,./.licenses,**/go.mod,**/go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site
builtin = clear,informal,en-GB_to_en-US
check-filenames =
check-hidden =
1 change: 1 addition & 0 deletions .ecrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"Exclude": [
"^LICENSE\\.txt$",
"^poetry\\.lock$",
"^\\.licenses/",
"^internal/rule/schema/schemadata/bindata.go$",
"^internal/rule/schema/testdata/bindata.go$"
]
Expand Down
109 changes: 109 additions & 0 deletions .github/workflows/check-go-dependencies-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md
name: Check Go Dependencies

env:
# See: https://github.com/actions/setup-go/tree/v2#readme
GO_VERSION: "1.16"

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/check-go-dependencies-task.ya?ml"
- ".licenses/**"
- ".licensed.json"
- ".licensed.ya?ml"
- "Taskfile.ya?ml"
- "**/.gitmodules"
- "**/go.mod"
- "**/go.sum"
pull_request:
paths:
- ".github/workflows/check-go-dependencies-task.ya?ml"
- ".licenses/**"
- ".licensed.json"
- ".licensed.ya?ml"
- "Taskfile.ya?ml"
- "**/.gitmodules"
- "**/go.mod"
- "**/go.sum"
workflow_dispatch:
repository_dispatch:

jobs:
check-cache:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install licensed
uses: jonabc/setup-licensed@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

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

- name: Update dependencies license metadata cache
run: task --silent general:cache-dep-licenses

- name: Check for outdated cache
id: diff
run: |
git add --intent-to-add .
if ! git diff --color --exit-code; then
echo
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"
exit 1
fi
# Some might find it convenient to have CI generate the cache rather than setting up for it locally
- name: Upload cache to workflow artifact
if: failure() && steps.diff.outcome == 'failure'
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: dep-licenses-cache
path: .licenses/

check-deps:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install licensed
uses: jonabc/setup-licensed@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

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

- name: Check for dependencies with unapproved licenses
run: task --silent general:check-dep-licenses
89 changes: 89 additions & 0 deletions .licensed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# See: https://github.com/github/licensed/blob/master/docs/configuration.md
sources:
go: true

shared_cache: true
cache_path: .licenses/

apps:
- source_path: ./
- source_path: docsgen/
- source_path: ruledocsgen/

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-dependencies/GPL-3.0/.licensed.yml
allowed:
# The following are based on: https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses
- gpl-1.0-or-later
- gpl-1.0+ # Deprecated ID for `gpl-1.0-or-later`
- gpl-2.0-or-later
- gpl-2.0+ # Deprecated ID for `gpl-2.0-or-later`
- gpl-3.0-only
- gpl-3.0 # Deprecated ID for `gpl-3.0-only`
- gpl-3.0-or-later
- gpl-3.0+ # Deprecated ID for `gpl-3.0-or-later`
- lgpl-2.0-or-later
- lgpl-2.0+ # Deprecated ID for `lgpl-2.0-or-later`
- lgpl-2.1-only
- lgpl-2.1 # Deprecated ID for `lgpl-2.1-only`
- lgpl-2.1-or-later
- lgpl-2.1+ # Deprecated ID for `lgpl-2.1-or-later`
- lgpl-3.0-only
- lgpl-3.0 # Deprecated ID for `lgpl-3.0-only`
- lgpl-3.0-or-later
- lgpl-3.0+ # Deprecated ID for `lgpl-3.0-or-later`
- fsfap
- apache-2.0
- artistic-2.0
- clartistic
- sleepycat
- bsl-1.0
- bsd-3-clause
- cecill-2.0
- bsd-3-clause-clear
# "Cryptix General License" - no SPDX ID (https://github.com/spdx/license-list-XML/issues/456)
- ecos-2.0
- ecl-2.0
- efl-2.0
- eudatagrid
- mit
- bsd-2-clause # Subsumed by `bsd-2-clause-views`
- bsd-2-clause-netbsd # Deprecated ID for `bsd-2-clause`
- bsd-2-clause-views # This is the version linked from https://www.gnu.org/licenses/license-list.html#FreeBSD
- bsd-2-clause-freebsd # Deprecated ID for `bsd-2-clause-views`
- ftl
- hpnd
- imatix
- imlib2
- ijg
# "Informal license" - this is a general class of license
- intel
- isc
- mpl-2.0
- ncsa
# "License of Netscape JavaScript" - no SPDX ID
- oldap-2.7
# "License of Perl 5 and below" - possibly `Artistic-1.0-Perl` ?
- cc0-1.0
- cc-pddc
- psf-2.0
- ruby
- sgi-b-2.0
- smlnj
- standardml-nj # Deprecated ID for `smlnj`
- unicode-dfs-2015
- upl-1.0
- unlicense
- vim
- w3c
- wtfpl
- lgpl-2.0-or-later with wxwindows-exception-3.1
- wxwindows # Deprecated ID for `lgpl-2.0-or-later with wxwindows-exception-3.1`
- x11
- xfree86-1.1
- zlib
- zpl-2.0
- zpl-2.1
# The following are based on individual license text
- eupl-1.2
- liliq-r-1.1
- liliq-rplus-1.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: github.com/JohannesKaufmann/html-to-markdown/escape
version: v1.3.0
type: go
summary: Package escape escapes characters that are commonly used in markdown like
the * for strong/italic.
homepage: https://pkg.go.dev/github.com/JohannesKaufmann/html-to-markdown/escape
license: mit
licenses:
- sources: [email protected]/LICENSE
text: |
MIT License

Copyright (c) 2018 Johannes Kaufmann

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: [email protected]/README.md
text: This project is licensed under the terms of the MIT license.
notices: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: github.com/ProtonMail/go-crypto/bitcurves
version: v0.0.0-20210428141323-04723f9f07d7
type: go
summary:
homepage: https://pkg.go.dev/github.com/ProtonMail/go-crypto/bitcurves
license: bsd-3-clause
licenses:
- sources: [email protected]/LICENSE
text: |
Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- sources: [email protected]/PATENTS
text: |
Additional IP Rights Grant (Patents)

"This implementation" means the copyrightable works distributed by
Google as part of the Go project.

Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.
notices: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: github.com/ProtonMail/go-crypto/brainpool
version: v0.0.0-20210428141323-04723f9f07d7
type: go
summary: Package brainpool implements Brainpool elliptic curves.
homepage: https://pkg.go.dev/github.com/ProtonMail/go-crypto/brainpool
license: bsd-3-clause
licenses:
- sources: [email protected]/LICENSE
text: |
Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- sources: [email protected]/PATENTS
text: |
Additional IP Rights Grant (Patents)

"This implementation" means the copyrightable works distributed by
Google as part of the Go project.

Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.
notices: []
Loading