Skip to content

Commit

Permalink
Add 3PP license check as part of PR CI
Browse files Browse the repository at this point in the history
The license check can be triggered locally:
  yarn license:check

For automatic opening of IP tickets for suspicious depedencies, set an
Eclipse Foundation gitlab token as environment variable "DASH_TOKEN" and
run the alternate pacakge.json script. e.g.:
  export DASH_TOKEN="<your token>"
  yarn license:check:reviewAdd 3PP license check as part of PR CI

Closes #268

Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
  • Loading branch information
marcdumais-work committed Jan 29, 2024
1 parent 93cc807 commit e2e132e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/license-check-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 3PP License Check

on:
push:
branches:
- master
workflow_dispatch:
pull_request:
branches:
- master
schedule:
- cron: '0 4 * * *' # Runs every day at 4am: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule

jobs:

License-check:
name: 3PP License Check using dash-licenses

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18]
java: [11]

runs-on: ${{ matrix.os }}
timeout-minutes: 20

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Use Java ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}

- name: Run dash-licenses
shell: bash
run: |
yarn --frozen-lockfile --ignore-scripts
yarn license:check
env:
DASH_TOKEN: ${{ secrets.DASH_LICENSES_PAT }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ bundle.js
coverage
lib
node_modules
license-check-summary.txt*
8 changes: 8 additions & 0 deletions configs/license-check-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"project": "ecd.cdt-cloud",
"review": false,
"inputFile": "yarn.lock",
"batch": 50,
"timeout": 200,
"summary": "license-check-summary.txt"
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"start": "lerna run start",
"test": "lerna run test --",
"publish:latest": "lerna publish --registry=https://registry.npmjs.org/ --exact --no-git-tag-version --no-push",
"publish:next": "lerna publish --registry=https://registry.npmjs.org/ --exact --canary minor --preid=next.$(date -u '+%Y%m%d%H%M%S').$(git rev-parse --short HEAD) --dist-tag=next --no-git-tag-version --no-push --yes"
"publish:next": "lerna publish --registry=https://registry.npmjs.org/ --exact --canary minor --preid=next.$(date -u '+%Y%m%d%H%M%S').$(git rev-parse --short HEAD) --dist-tag=next --no-git-tag-version --no-push --yes",
"license:check": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json",
"license:check:review": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json --review"
},
"keywords": [
"gantt",
Expand All @@ -26,6 +28,7 @@
},
"homepage": "https://github.com/theia-ide/timeline-chart",
"devDependencies": {
"@eclipse-dash/nodejs-wrapper": "^0.0.1",
"lerna": "^7.0.0",
"typescript": "^5.2.2"
},
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@
resolved "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==

"@eclipse-dash/nodejs-wrapper@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@eclipse-dash/nodejs-wrapper/-/nodejs-wrapper-0.0.1.tgz#f2629671cf090a84c4d69a8fec42f198e583d103"
integrity sha512-Rkk8O8hEVi/+LC/co7ly1zGLVwCNJG3yPbalsz1FHAqk6WZyEaWNf29EX6jz4vTfR5wpv2xAfF2yokKuStiOdA==

"@hutson/parse-repository-url@^3.0.0":
version "3.0.2"
resolved "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340"
Expand Down

0 comments on commit e2e132e

Please sign in to comment.