on master help sign in
CICD: Add check for accidental inclusion of GPL:ed code
ce89fb2Martin Nordholts
.github/workflows/CICD.yml+9
@@ -27,6 +27,15 @@ jobs:
27 - uses: actions/checkout@v2
27 - uses: actions/checkout@v2
28 - run: cargo fmt -- --check
28 - run: cargo fmt -- --check
29
29
30+ license_checks:
31+ name: License checks
32+ runs-on: ubuntu-20.04
33+ steps:
34+ - uses: actions/checkout@v2
35+ with:
36+ submodules: true # we especially want to perform license checks on submodules
37+ - run: tests/scripts/license-checks.sh
38+
30 min_version:
39 min_version:
31 name: Minimum supported rust version
40 name: Minimum supported rust version
32 runs-on: ubuntu-20.04
41 runs-on: ubuntu-20.04
tests/scripts/license-checks.shnew file+24
@@ -0,0 +1,24 @@
1+#!/usr/bin/env bash
2+set -o errexit -o nounset -o pipefail
3+
4+# Make sure that we don't accidentally include GPL licenced files
5+gpl_term="General Public License"
6+gpl_excludes=(
7+ # Snippet expands to GPL, but is not under GPL
8+ ":(exclude)assets/syntaxes/01_Packages/Matlab/Snippets/Octave-function.sublime-snippet"
9+
10+ # 'gpl_term' matches itself :D
11+ ":(exclude)tests/scripts/license-checks.sh"
12+
13+ # Contains a reference to GPL, but is not under GPL
14+ ":(exclude)tests/syntax-tests/source/Java Server Page (JSP)/LICENSE.md"
15+)
16+gpl_occurances=$(git grep --recurse-submodules "${gpl_term}" -- "${gpl_excludes[@]}" || true)
17+
18+if [ -z "${gpl_occurances}" ]; then
19+ echo "PASS: No files under GPL were found"
20+else
21+ echo "FAIL: GPL:ed code is not compatible with bat, but occurances of '${gpl_term}' were found:"
22+ echo "${gpl_occurances}"
23+ exit 1
24+fi