-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds check CI for the licenses (#2457)
* Adds check CI for the licenses * adds missing checkout * format
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Check licenses | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Verify Licenses | ||
run: | | ||
cargo install cargo-license | ||
./scripts/verify-licenses.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
cargo license --json > licenses.json | ||
LICENSES=( | ||
"(MIT OR Apache-2.0) AND Unicode-DFS-2016" | ||
"0BSD OR Apache-2.0 OR MIT" | ||
"Apache-2.0 AND MIT" | ||
"Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT" | ||
"Apache-2.0 OR BSD-1-Clause OR MIT" | ||
"Apache-2.0 OR BSD-3-Clause OR MIT" | ||
"Apache-2.0 OR BSL-1.0" | ||
"Apache-2.0 OR CC0-1.0 OR MIT-0" | ||
"Apache-2.0 OR CC0-1.0" | ||
"Apache-2.0 OR GPL-3.0" | ||
"Apache-2.0 OR ISC OR MIT" | ||
"Apache-2.0 OR MIT OR Zlib" | ||
"Apache-2.0 OR MIT" | ||
"Apache-2.0 WITH LLVM-exception" | ||
"Apache-2.0" | ||
"BSD-2-Clause" | ||
"BSD-3-Clause OR MIT" | ||
"BSD-3-Clause" | ||
"CC0-1.0" | ||
"GPL-3.0-only" | ||
"GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
"ISC" | ||
"MIT OR Unlicense" | ||
"MIT" | ||
"MPL-2.0" | ||
"Zlib" | ||
) | ||
AUTHORS=( | ||
"PureStake" | ||
"Parity Technologies <[email protected]>" | ||
"Moonsong-Labs" | ||
"Moonsong Labs" | ||
"moonbeam-foundation" | ||
) | ||
NAMES=( | ||
"webpki" | ||
"ring" | ||
"nimbus-consensus" | ||
) | ||
licenses_filter=$(printf ' .license != "%s" and' "${LICENSES[@]}") | ||
authors_filter=$(printf ' .authors != "%s" and' "${AUTHORS[@]}") | ||
names_filter=$(printf ' .name != "%s" and' "${NAMES[@]}") | ||
filter="${licenses_filter}${authors_filter}${names_filter:0:-4}" | ||
|
||
echo -e "checking licenses with filter:\n$filter\n" | ||
RESULT=$(jq "[.[] | select($filter)]" licenses.json) | ||
|
||
if [[ "$RESULT" == "[]" ]]; then | ||
echo "OK !!" | ||
exit 0 | ||
else | ||
echo -en "$RESULT\n" | ||
echo "FAILURE !!" | ||
exit 1 | ||
fi |