Skip to content

Commit b7d0c3b

Browse files
Merge pull request #18 from eclipse-cdt-cloud/automated-pr-license-check
Add 3PP license check as part of PR CI
2 parents 4ebbb2d + f6b8480 commit b7d0c3b

File tree

7 files changed

+147
-2
lines changed

7 files changed

+147
-2
lines changed

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
node-version: [16.x]
18+
19+
steps:
20+
- name: install dependencies on ubuntu
21+
if: startsWith(matrix.os,'ubuntu')
22+
run: |
23+
sudo apt install -y make gcc pkg-config build-essential libx11-dev libxkbfile-dev
24+
25+
- uses: actions/checkout@v2
26+
27+
- name: Use Node.js ${{ matrix.node-version }}
28+
uses: actions/setup-node@v1
29+
with:
30+
node-version: ${{ matrix.node-version }}
31+
32+
- name: Get yarn cache directory path
33+
id: yarn-cache-dir-path
34+
run: echo "::set-output name=dir::$(yarn cache dir)"
35+
36+
- name: Cache node_modules with yarn
37+
uses: actions/cache@v2
38+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
39+
with:
40+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
41+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-yarn-
44+
45+
- run: yarn --frozen-lockfile
46+
47+
tests:
48+
timeout-minutes: 60
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-node@v3
53+
with:
54+
node-version: 16
55+
- name: Install dependencies
56+
run: yarn
57+
- name: Run tests
58+
uses: coactions/setup-xvfb@v1
59+
with:
60+
run: yarn test
61+
62+
code-lint:
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Check out Git repository
67+
uses: actions/checkout@v2
68+
69+
- uses: actions/setup-node@v1
70+
with:
71+
node-version: '16'
72+
73+
# ESLint and Prettier must be in `package.json`
74+
- run: yarn --frozen-lockfile --ignore-scripts
75+
76+
- run: yarn lint
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 3PP License Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
pull_request:
9+
branches:
10+
- main
11+
schedule:
12+
- cron: '0 4 * * *' # Runs every day at 4am: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule
13+
14+
jobs:
15+
16+
License-check:
17+
name: 3PP License Check using dash-licenses
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest]
23+
node: [18]
24+
java: [11]
25+
26+
runs-on: ${{ matrix.os }}
27+
timeout-minutes: 20
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
with:
33+
fetch-depth: 2
34+
35+
- name: Use Node.js ${{ matrix.node }}
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: ${{ matrix.node }}
39+
40+
- name: Use Java ${{ matrix.java }}
41+
uses: actions/setup-java@v3
42+
with:
43+
distribution: 'adopt'
44+
java-version: ${{ matrix.java }}
45+
46+
- name: Run dash-licenses
47+
shell: bash
48+
run: |
49+
yarn --frozen-lockfile
50+
yarn license:check
51+
env:
52+
DASH_TOKEN: ${{ secrets.DASH_LICENSES_PAT }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/node_modules/
55
/out/
66
/vscode-trace-server-*.vsix
7+
license-check-summary.txt*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This README is the usual entry point for documenting this extension.
2020
Run `yarn`, which should automatically include `yarn install`.
2121

2222
* This extension is bundled using `webpack`, originally based on [the guide][guide].
23-
* There is no support yet for any automated CI on GitHub; planned for though.
23+
* There is only a modest automated CI test suite being run on GitHub
2424

2525
## Test
2626

configs/license-check-config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"project": "ecd.cdt-cloud",
3+
"review": false,
4+
"inputFile": "yarn.lock",
5+
"batch": 50,
6+
"timeout": 200,
7+
"summary": "license-check-summary.txt"
8+
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@
5757
"watch-tests": "tsc -p . -w --outDir out",
5858
"pretest": "yarn run compile-tests && yarn run compile && yarn run lint",
5959
"lint": "eslint src --ext ts",
60-
"test": "node ./out/test/runTest.js"
60+
"test": "node ./out/test/runTest.js",
61+
"license:check": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json",
62+
"license:check:review": "npx dash-licenses-wrapper --configFile=./configs/license-check-config.json --review"
6163
},
6264
"dependencies": {
6365
"tree-kill": "^1.2.2",
6466
"tsp-typescript-client": "next"
6567
},
6668
"devDependencies": {
69+
"@eclipse-dash/nodejs-wrapper": "^0.0.1",
6770
"@types/glob": "^8.1.0",
6871
"@types/mocha": "^10.0.1",
6972
"@types/node": "16.x",

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
resolved "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz"
88
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
99

10+
"@eclipse-dash/nodejs-wrapper@^0.0.1":
11+
version "0.0.1"
12+
resolved "https://registry.yarnpkg.com/@eclipse-dash/nodejs-wrapper/-/nodejs-wrapper-0.0.1.tgz#f2629671cf090a84c4d69a8fec42f198e583d103"
13+
integrity sha512-Rkk8O8hEVi/+LC/co7ly1zGLVwCNJG3yPbalsz1FHAqk6WZyEaWNf29EX6jz4vTfR5wpv2xAfF2yokKuStiOdA==
14+
1015
"@eslint-community/eslint-utils@^4.2.0":
1116
version "4.4.0"
1217
resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz"

0 commit comments

Comments
 (0)