Skip to content

Commit 876e7b7

Browse files
authored
Merge pull request #77 from abrarshivani/third-party-notices
Add THIRD_PARTY_NOTICES.md and a generator for it
2 parents 0f6a75e + 7ce0a86 commit 876e7b7

6 files changed

Lines changed: 850 additions & 1 deletion

File tree

‎.github/workflows/golang.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,19 @@ jobs:
7878
with:
7979
go-version: ${{ env.GOLANG_VERSION }}
8080
- run: make build
81+
check-third-party-notices:
82+
name: Check third-party notices
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v6
86+
name: Checkout code
87+
- name: Get Golang version
88+
id: vars
89+
run: |
90+
GOLANG_VERSION=$( grep "GOLANG_VERSION ?=" versions.mk )
91+
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
92+
- name: Install Go
93+
uses: actions/setup-go@v6
94+
with:
95+
go-version: ${{ env.GOLANG_VERSION }}
96+
- run: make check-third-party-notices

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

‎Makefile‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include $(CURDIR)/versions.mk
1919
DOCKERFILE_DEVEL := "images/devel/Dockerfile"
2020
K8S_TEST_INFRA := "https://github.com/NVIDIA/k8s-test-infra.git"
2121

22-
TARGETS := binary build all check fmt assert-fmt generate test coverage golangci-lint
22+
TARGETS := binary build all check fmt assert-fmt generate test coverage golangci-lint third-party-notices check-third-party-notices
2323
DOCKER_TARGETS := $(patsubst %, docker-%, $(TARGETS))
2424
.PHONY: $(TARGETS) $(DOCKER_TARGETS)
2525

@@ -70,6 +70,21 @@ vendor:
7070
check-vendor: vendor
7171
git diff --quiet HEAD -- go.mod go.sum vendor
7272

73+
GO_LICENSES = $(CURDIR)/bin/go-licenses
74+
75+
$(GO_LICENSES): versions.mk
76+
GOBIN=$(CURDIR)/bin GOFLAGS= go install github.com/google/go-licenses/v2@$(GO_LICENSES_VERSION)
77+
78+
third-party-notices: $(GO_LICENSES)
79+
@bash hack/generate-third-party-notices.sh
80+
81+
check-third-party-notices: third-party-notices
82+
@echo "- Checking if THIRD_PARTY_NOTICES.md is up to date..."
83+
@git ls-files --error-unmatch THIRD_PARTY_NOTICES.md >/dev/null 2>&1 \
84+
|| { echo "ERROR: THIRD_PARTY_NOTICES.md is not tracked. Run 'make third-party-notices' and commit the result."; exit 1; }
85+
@git diff --exit-code -- THIRD_PARTY_NOTICES.md \
86+
|| { echo "ERROR: THIRD_PARTY_NOTICES.md is stale. Run 'make third-party-notices' and commit the change."; exit 1; }
87+
7388
build-image: $(DOCKERFILE_DEVEL)
7489
$(DOCKER) build \
7590
--progress=plain \

0 commit comments

Comments
 (0)