generated from finos-labs/project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 38
51 lines (48 loc) · 1.74 KB
/
license-scanning-maven.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: License Scanning for Maven
on:
schedule:
- cron: '0 8,18 * * 1-5'
push:
paths:
- '**/pom.xml'
- '.github/workflows/license-scanning-maven.yml'
env:
ALLOW_LICENSES: "'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'"
REPORT_PATH: "target/generated-resources/licenses.xml"
jobs:
scan:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: ['21']
module-folder: [
'translator'
]
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
cache: maven
distribution: 'adopt'
- name: Install XQ
run: pip install xq
- name: Build with Maven
run: mvn clean install -Dmaven.test.skip=true
working-directory: ${{ matrix.module-folder }}
- name: License XML report
run: mvn org.codehaus.mojo:license-maven-plugin:2.0.0:download-licenses
working-directory: ${{ matrix.module-folder }}
- name: Validate XML report
run: |
LICENSE_REPORT=`xq "//dependency[licenses/license/name!=${{ env.ALLOW_LICENSES }}]" ./${{ env.REPORT_PATH }}`
LINES_FOUND=`echo $LICENSE_REPORT | wc -l`
echo "License issues found ..."
if [ $LINES_FOUND -gt 1 ]; then echo $LICENSE_REPORT ; exit -1; fi
working-directory: ${{ matrix.module-folder }}
- name: Upload license XML reports
uses: actions/upload-artifact@v4
with:
name: license-xml-report
path: '${{ matrix.module-folder }}/**/${{ env.REPORT_PATH }}'