From d103b673f918821ca92cf61ba5f63da10ad54706 Mon Sep 17 00:00:00 2001 From: Tim Riedl Date: Sun, 1 Dec 2024 22:48:33 +0100 Subject: [PATCH] . --- .github/workflows/license-checker.yaml | 45 ++++++++++++++++++++++++++ Makefile | 13 ++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/license-checker.yaml diff --git a/.github/workflows/license-checker.yaml b/.github/workflows/license-checker.yaml new file mode 100644 index 00000000..ec63c678 --- /dev/null +++ b/.github/workflows/license-checker.yaml @@ -0,0 +1,45 @@ +name: "License Check Audit" + +on: + pull_request: + types: [opened, synchronize, reopened] + workflow_dispatch: + schedule: + - cron: "0 3 * * *" + +jobs: + license-check-golang-backend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Golang | Install Golang + uses: actions/setup-go@v4 + with: + go-version: 1.23.3 + + - name: Golang | Install License Checker + run: go install github.com/google/go-licenses@latest + + - name: Golang | Run License Check + run: make license-check-be + + license-check-npm-frontend: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: NPM | Install NodeJS + uses: actions/setup-node@v2 + with: + node-version: 23.3.0 + - name: Install Dependencies + run: (cd services/frontend ; npm install) + + - name: NPM | Install License Checker + run: npm install -g license-checker + + - name: NPM | Run License Check + run: make license-check-fe diff --git a/Makefile b/Makefile index 540a5efd..9b549607 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +ALLOWED_LICENSES_COMMA ?= "MIT,BSD-3-Clause,Apache-2.0,MPL-2.0,ISC" +ALLOWED_LICENSES_SEMICOLON ?= "MIT;BSD-3-Clause;Apache-2.0;ISC;OFL-1.1;CC0-1.0;0BSD;UNLICENSED" +IGNORE ?= "github.com/uvulpos/golang-sveltekit-template,golang.org/x" .install-deps: ## install all dependencies @bash ./devops/scripts/utils/install-dependencies.sh @@ -29,6 +32,16 @@ build-dockerfile-frontend: ## build the frontend microservice build-dockerfile-backend: ## build the backend microservice @bash ./devops/scripts/build-container/backend.sh +license-check-be: ## runs golang license check + @(cd services/backend ; go-licenses check ./... --allowed_licenses=$(ALLOWED_LICENSES_COMMA) --ignore=$(IGNORE) --one_output); \ + STATUS=$$?; \ + exit $$STATUS + +license-check-fe: ## runs npm license check + @(cd services/frontend ; license-checker --onlyAllow=$(ALLOWED_LICENSES_SEMICOLON)); \ + STATUS=$$?; \ + exit $$STATUS + help: ## print our all commands to commandline @echo "\033[34m" @echo " SvelteKit + Golang Example"