Skip to content

Commit 8c5105b

Browse files
authored
feat: add license conformity check (#417)
1 parent e490b59 commit 8c5105b

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "License Check Audit"
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "0 3 * * *"
9+
10+
jobs:
11+
license-check-golang-backend:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Golang | Install Golang
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: 1.23.3
21+
22+
- name: Golang | Install License Checker
23+
run: go install github.com/google/go-licenses@latest
24+
25+
- name: Golang | Run License Check
26+
run: make license-check-be
27+
28+
license-check-npm-frontend:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: NPM | Install NodeJS
35+
uses: actions/setup-node@v2
36+
with:
37+
node-version: 23.3.0
38+
- name: Install Dependencies
39+
run: (cd services/frontend ; npm install)
40+
41+
- name: NPM | Install License Checker
42+
run: npm install -g license-checker
43+
44+
- name: NPM | Run License Check
45+
run: make license-check-fe

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ALLOWED_LICENSES_COMMA ?= "MIT,BSD-3-Clause,Apache-2.0,MPL-2.0,ISC"
2+
ALLOWED_LICENSES_SEMICOLON ?= "MIT;BSD-3-Clause;Apache-2.0;ISC;OFL-1.1;CC0-1.0;0BSD;UNLICENSED"
3+
IGNORE ?= "github.com/uvulpos/golang-sveltekit-template,golang.org/x"
14

25
.install-deps: ## install all dependencies
36
@bash ./devops/scripts/utils/install-dependencies.sh
@@ -29,6 +32,16 @@ build-dockerfile-frontend: ## build the frontend microservice
2932
build-dockerfile-backend: ## build the backend microservice
3033
@bash ./devops/scripts/build-container/backend.sh
3134

35+
license-check-be: ## runs golang license check
36+
@(cd services/backend ; go-licenses check ./... --allowed_licenses=$(ALLOWED_LICENSES_COMMA) --ignore=$(IGNORE) --one_output); \
37+
STATUS=$$?; \
38+
exit $$STATUS
39+
40+
license-check-fe: ## runs npm license check
41+
@(cd services/frontend ; license-checker --onlyAllow=$(ALLOWED_LICENSES_SEMICOLON)); \
42+
STATUS=$$?; \
43+
exit $$STATUS
44+
3245
help: ## print our all commands to commandline
3346
@echo "\033[34m"
3447
@echo " SvelteKit + Golang Example"

0 commit comments

Comments
 (0)