Skip to content
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

Th2 1836 license compliance for java projects #90

Closed
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5d9f9fd
[TH2-1836] added com.github.jk1.dependency-license-report plugin
Nikita-Smirnov-Exactpro Jun 23, 2023
d0989a6
[TH2-1836] added CsvCustomReportRenderer
Nikita-Smirnov-Exactpro Jun 23, 2023
cd66eb4
[TH2-1836] refactored
Nikita-Smirnov-Exactpro Jul 11, 2023
f152c69
initial attempt to run the script
sabamushtashvili Aug 2, 2023
3f35432
added job to workflow
sabamushtashvili Aug 2, 2023
03da193
changed path to script
sabamushtashvili Aug 2, 2023
a0aa05d
editing job
sabamushtashvili Aug 2, 2023
aeb2e3b
edited path
sabamushtashvili Aug 2, 2023
b8a47fe
added checkout action
sabamushtashvili Aug 2, 2023
579cc84
specified branch
sabamushtashvili Aug 2, 2023
97ed37f
added script locally?
sabamushtashvili Aug 7, 2023
9690996
edited folder name
sabamushtashvili Aug 7, 2023
939aa55
edited folder path
sabamushtashvili Aug 7, 2023
6865278
checking root path
sabamushtashvili Aug 7, 2023
12d8e24
checking repos
sabamushtashvili Aug 7, 2023
02466a2
checking repos
sabamushtashvili Aug 7, 2023
04153d3
checking repos
sabamushtashvili Aug 7, 2023
ae5709b
running script
sabamushtashvili Aug 7, 2023
b3a9a72
running script
sabamushtashvili Aug 7, 2023
9a76999
made file executable
sabamushtashvili Aug 8, 2023
070c08e
added checkout
sabamushtashvili Aug 8, 2023
594a6e8
removed chmod
sabamushtashvili Aug 8, 2023
3340340
modified script
sabamushtashvili Aug 8, 2023
eaebf2e
modified script
sabamushtashvili Aug 8, 2023
5282755
edited script permissions
sabamushtashvili Aug 8, 2023
dc785c1
adding jq env
sabamushtashvili Aug 8, 2023
79b52c0
adding jq env
sabamushtashvili Aug 8, 2023
43902d8
updated script
sabamushtashvili Aug 8, 2023
64d5b31
removed local script
sabamushtashvili Aug 9, 2023
a4f2845
cloning script repo
sabamushtashvili Aug 9, 2023
f3d4564
typo
sabamushtashvili Aug 9, 2023
621de01
fixing paths
sabamushtashvili Aug 9, 2023
0e7a659
downloading script
sabamushtashvili Aug 9, 2023
bd3642a
fix workflow
Aug 9, 2023
924af19
installing jq environment
sabamushtashvili Aug 9, 2023
b33d5ee
displaying results
sabamushtashvili Aug 9, 2023
330472d
checking folders
sabamushtashvili Aug 9, 2023
38b1f0d
corrected folder name
sabamushtashvili Aug 9, 2023
c90f019
uploading results
sabamushtashvili Aug 9, 2023
31d735f
fixed extension
sabamushtashvili Aug 9, 2023
4e0b2dd
fixing time
sabamushtashvili Aug 9, 2023
28caa1d
added timestamp
sabamushtashvili Aug 9, 2023
e53f86d
removed time
sabamushtashvili Aug 9, 2023
2e25bad
upload files fix
Aug 10, 2023
ce3e181
art upload
Aug 10, 2023
2f7818b
fix naming
Aug 10, 2023
57a1dab
add name and version
Aug 10, 2023
b663561
fix
Aug 10, 2023
a681442
fix typo
Aug 10, 2023
102cbe0
added condition
sabamushtashvili Aug 18, 2023
d101dba
updating workflow
sabamushtashvili Aug 18, 2023
7e4e4c4
separating script run and output analyzes
sabamushtashvili Aug 18, 2023
ed24fef
checking failed_licenses file
sabamushtashvili Aug 18, 2023
bba36c3
editing step for setting the status
sabamushtashvili Aug 18, 2023
b2ef98c
separated licenses check to new workflow
sabamushtashvili Aug 23, 2023
1fd8ed9
chenged workflow name
sabamushtashvili Aug 23, 2023
f6c08e5
chenged fail condition
sabamushtashvili Aug 23, 2023
47ef63f
corrections to output messages
Nov 2, 2023
cf445ad
fix typo
Nov 8, 2023
0252ffa
fix quotes
Nov 8, 2023
1ee83b6
fix quotes
Nov 8, 2023
ccdc23a
output corrections
Nov 8, 2023
cbf9669
new version of workflow
Nov 9, 2023
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
6 changes: 5 additions & 1 deletion .github/workflows/dev-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ on:
paths-ignore:
- README.md

env:
APP_NAME: ${{ github.repository }}
BRANCH: ${{ github.ref }}

jobs:
build-job:
uses: th2-net/.github/.github/workflows/compound-java-dev.yml@main
with:
build-target: 'Docker'
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Check licenses
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we create a template with main part of this script in the .github to simplify spreading to other repositories


on:
push:
branches-ignore:
- master
- version-*
- dependabot**
paths-ignore:
- README.md

env:
APP_NAME: ${{ github.repository }}
BRANCH: ${{ github.ref }}

jobs:
check_licenses:
runs-on: ubuntu-latest
steps:
- name: checkout actions
uses: actions/checkout@v2

- name: Install jq env
run: |
sudo apt-get update
sudo apt-get install -y jq

- name: Download script
run: |
wget -q -O check_licenses.sh https://raw.githubusercontent.com/th2-net/.github/th2-1836-json-files-update/license-compliance/check_licenses.sh
chmod +x ./check_licenses.sh

- name: Run check_licenses script
run: ./check_licenses.sh java
id: run_script

- name: Get version
run:
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

- name: Uploading results
if: always()
uses: actions/upload-artifact@v3
with:
name: licenses_check-$APP_NAME-$VERSION
path: ./licenses_check/

- name: Determine workflow status
id: set_status
run: |
line_count=$(wc -l < ./licenses_check/failed_licenses.csv)
if [[ $line_count -gt 1 ]]; then
echo "FAILED: failed/unknown licenses found"
exit 1
else
echo "PASSED: license check successfull"
exit 0
fi

- name: Set workflow status
run: echo "::set-output name=status::Failure"
if: steps.set_status.outputs.result == 'FAILED: failed/unknown licenses found'
continue-on-error: false
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.JsonReportRenderer

plugins {
id 'java'
id 'java-library'
id 'application'
id 'com.palantir.docker' version '0.25.0'
id "org.owasp.dependencycheck" version "8.2.1"
id 'com.github.jk1.dependency-license-report' version '2.5'
id "de.undercouch.download" version "5.4.0"
}

ext {
Expand Down Expand Up @@ -109,4 +114,25 @@ dependencyCheck {

dependencyLocking {
lockAllConfigurations()
}

licenseReport {
def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json"

if (!file(licenseNormalizerBundlePath).exists()) {
download.run {
src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
dest "$buildDir/license-normalizer-bundle.json"
overwrite false
}
}

filters = [
new LicenseBundleNormalizer(licenseNormalizerBundlePath, false)
]
renderers = [
new JsonReportRenderer('licenses.json', false),
]
excludeOwnGroup = false
allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json")
}
Loading