Skip to content

Commit 219550e

Browse files
authored
Fix issues with licence scan github actions (#1767)
* WiP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP * Fix maven legal report - WIP
1 parent d50f045 commit 219550e

File tree

3 files changed

+82
-31
lines changed

3 files changed

+82
-31
lines changed

.github/workflows/legal-report-node.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ on:
77
- ".github/workflows/legal-report-node.yml"
88

99
jobs:
10+
1011
scan-packages:
1112
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
node-version: [20.x]
13+
1514
steps:
1615
- uses: actions/checkout@v3
17-
- name: Use Node.js ${{ matrix.node-version }}
16+
17+
- name: Set up Node
1818
uses: actions/setup-node@v3
1919
with:
20-
node-version: ${{ matrix.node-version }}
21-
- run: npm install --production
20+
node-version: 20.x
21+
22+
- name: Build project with NPM
23+
run: npm install --omit=dev
2224
working-directory: vuu-ui
25+
2326
- run: npx node-license-validator . --allow-licenses MIT ISC 0BSD BSD BSD-3-Clause Apache-2.0
2427
working-directory: vuu-ui

.github/workflows/legal-report.yml

Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,94 @@ on:
77
- '.github/workflows/legal-report.yml'
88

99
jobs:
10-
legal-report:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v3
14-
- name: Set up JDK 1.17
15-
uses: actions/setup-java@v1
16-
with:
17-
java-version: 1.17
18-
cache: maven
19-
- name: Build with Maven
20-
run: mvn clean install
21-
- name: License report
22-
run: mvn org.apache.maven.plugins:maven-site-plugin:3.12.1:site org.apache.maven.plugins:maven-project-info-reports-plugin:3.4.1:licenses -P legal-report
2310

2411
legal-scanning:
2512
runs-on: ubuntu-latest
13+
2614
strategy:
2715
matrix:
28-
package-folder: [".", vuu-ui, toolbox, vuu]
16+
package-folder: [toolbox, vuu, vuu-java]
2917

3018
steps:
3119
- uses: actions/checkout@v3
20+
3221
- name: Set up JDK 1.17
3322
uses: actions/setup-java@v4
3423
with:
3524
java-version: 17
3625
java-package: jdk
3726
distribution: temurin
3827
cache: 'maven'
28+
3929
- name: Install XQ
40-
run: pip install xq
41-
- name: Build with Maven
42-
run: mvn clean install
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install xq
33+
34+
- name: Maven build
35+
run: mvn clean install -pl ${{ matrix.package-folder }} -am -DskipTests
36+
4337
- name: License XML report
4438
run: mvn org.codehaus.mojo:license-maven-plugin:2.0.0:download-licenses
39+
working-directory: ${{ matrix.package-folder }}
40+
4541
- name: Validate XML report
4642
run: |
47-
LICENSE_REPORT=`xq "//dependency[licenses/license/name!='The Apache Software License, Version 2.0' and licenses/license/name!='BSD' and licenses/license/name!='BSD-style license' and licenses/license/name!='Apache License, Version 2.0']" ${{ matrix.package-folder }}/target/generated-resources/licenses.xml`
48-
LINES_FOUND=`echo $LICENSE_REPORT | wc -l`
49-
if [ $LINES_FOUND -gt 1 ]; then echo $LICENSE_REPORT ; exit -1; fi
50-
- name: Upload license reports
51-
uses: actions/upload-artifact@v4
52-
with:
53-
name: ${{ matrix.package-folder }}-license-reports
54-
path: '**/dependencies.html'
43+
#!/bin/bash
44+
45+
ALLOWED_LICENCES=(
46+
"Apache 2.0"
47+
"Apache 2.0 License"
48+
"Apache License 2.0"
49+
"Apache License, Version 2.0"
50+
"Apache-2.0"
51+
"BSD"
52+
"BSD licence"
53+
"BSD Licence 3"
54+
"BSD-3-Clause"
55+
"BSD 3-Clause \"New\" or \"Revised\" License (BSD-3-Clause)"
56+
"Eclipse Public License 1.0"
57+
"Eclipse Public License - v 1.0"
58+
"Eclipse Public License - v 2.0"
59+
"GNU Lesser General Public License"
60+
"MIT"
61+
"MIT License"
62+
"New BSD License"
63+
"The Apache Software License, Version 2.0"
64+
"the Apache License, ASL Version 2.0"
65+
"The BSD License"
66+
"Unicode/ICU License"
67+
)
68+
69+
#Parse unique licenses in dependencies
70+
readarray -t LICENSES < <(cat target/generated-resources/licenses.xml | xq -x '//name' | sort -u)
71+
72+
BANNED=()
73+
74+
# Collect the ones that arent allowed
75+
for license1 in "${LICENSES[@]}"; do
76+
found=false
77+
for license2 in "${ALLOWED_LICENCES[@]}"; do
78+
if [[ "$license1" == "$license2" ]]; then
79+
found=true
80+
break
81+
fi
82+
done
83+
if [[ "$found" == false ]]; then
84+
BANNED+=("$license1")
85+
fi
86+
done
87+
88+
if [ ${#BANNED[@]} -ne 0 ]; then
89+
echo "Banned licenses found:"
90+
for license in "${BANNED[@]}"; do
91+
echo " - $license"
92+
done
93+
exit 1
94+
fi
95+
96+
working-directory: ${{ matrix.package-folder }}
97+
5598
- name: Upload license XML reports
5699
uses: actions/upload-artifact@v4
57100
with:

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@
143143
<version>2.5.2</version>
144144
</plugin>
145145

146+
<plugin>
147+
<artifactId>maven-site-plugin</artifactId>
148+
<version>3.21.0</version>
149+
</plugin>
150+
146151
<plugin>
147152
<groupId>org.apache.maven.plugins</groupId>
148153
<artifactId>maven-release-plugin</artifactId>

0 commit comments

Comments
 (0)