Skip to content

Commit

Permalink
Check third-party licenses on PR (grafana#1285)
Browse files Browse the repository at this point in the history
* Check third-party licenses on PR

* Fix license generation for a given goos and goarch
  • Loading branch information
mariomac authored Oct 29, 2024
1 parent a158573 commit 5c93589
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pull_request_check_license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check third-party licenses

on:
push:
branches: [ 'main', 'release-*' ]
pull_request:
branches: [ 'main', 'release-*' ]

jobs:
check-licenses:
name: check-licenses
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.23' ]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Check licenses
run: make check-licenses
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,17 @@ oats-test: oats-test-sql oats-test-redis oats-test-kafka
oats-test-debug: oats-prereq
cd test/oats/kafka && TESTCASE_BASE_PATH=./yaml TESTCASE_MANUAL_DEBUG=true TESTCASE_TIMEOUT=1h $(GINKGO) -v -r

.PHONY: update-licenses
.PHONY: update-licenses check-license
update-licenses: prereqs
@echo "### Updating third_party_licenses.csv"
$(GO_LICENSES) report --include_tests ./... > third_party_licenses.csv
GOOS=linux GOARCH=amd64 $(GO_LICENSES) report --include_tests ./... > third_party_licenses.csv

check-licenses: update-licenses
@echo "### Checking third party licenses"
@if [ "$(strip $(shell git diff HEAD third_party_licenses.csv))" != "" ]; then \
echo "ERROR: third_party_licenses.csv is not up to date. Run 'make update-licenses' and push the changes to your PR"; \
exit 1; \
fi

.PHONY: artifact
artifact: compile
Expand Down
6 changes: 4 additions & 2 deletions third_party_licenses.csv
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ github.com/prometheus/common,https://github.com/grafana/beyla/blob/HEAD/vendor/g
github.com/prometheus/procfs,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/prometheus/procfs/LICENSE,Apache-2.0
github.com/rs/cors,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/rs/cors/LICENSE,MIT
github.com/shirou/gopsutil/v3,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/shirou/gopsutil/v3/LICENSE,BSD-3-Clause
github.com/shoenig/go-m1cpu,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/shoenig/go-m1cpu/LICENSE,MPL-2.0
github.com/spf13/pflag,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/spf13/pflag/LICENSE,BSD-3-Clause
github.com/stretchr/testify,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/stretchr/testify/LICENSE,MIT
github.com/tklauser/go-sysconf,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/tklauser/go-sysconf/LICENSE,BSD-3-Clause
github.com/tklauser/numcpus,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/tklauser/numcpus/LICENSE,Apache-2.0
github.com/ugorji/go/codec,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/ugorji/go/codec/LICENSE,MIT
github.com/vishvananda/netlink,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/vishvananda/netlink/LICENSE,Apache-2.0
github.com/vishvananda/netns,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/vishvananda/netns/LICENSE,Apache-2.0
github.com/vladimirvivien/gexe,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/vladimirvivien/gexe/LICENSE,MIT
github.com/x448/float16,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/x448/float16/LICENSE,MIT
github.com/xwb1989/sqlparser,https://github.com/grafana/beyla/blob/HEAD/vendor/github.com/xwb1989/sqlparser/LICENSE.md,Apache-2.0
Expand Down Expand Up @@ -129,7 +131,7 @@ go.opentelemetry.io/otel/trace,https://github.com/grafana/beyla/blob/HEAD/vendor
go.opentelemetry.io/proto/otlp,https://github.com/grafana/beyla/blob/HEAD/vendor/go.opentelemetry.io/proto/otlp/LICENSE,Apache-2.0
go.uber.org/multierr,https://github.com/grafana/beyla/blob/HEAD/vendor/go.uber.org/multierr/LICENSE.txt,MIT
go.uber.org/zap,https://github.com/grafana/beyla/blob/HEAD/vendor/go.uber.org/zap/LICENSE,MIT
golang.org/x/arch/arm64/arm64asm,https://github.com/grafana/beyla/blob/HEAD/vendor/golang.org/x/arch/LICENSE,BSD-3-Clause
golang.org/x/arch/x86/x86asm,https://github.com/grafana/beyla/blob/HEAD/vendor/golang.org/x/arch/LICENSE,BSD-3-Clause
golang.org/x/crypto/sha3,https://github.com/grafana/beyla/blob/HEAD/vendor/golang.org/x/crypto/LICENSE,BSD-3-Clause
golang.org/x/exp,https://github.com/grafana/beyla/blob/HEAD/vendor/golang.org/x/exp/LICENSE,BSD-3-Clause
golang.org/x/mod/semver,https://github.com/grafana/beyla/blob/HEAD/vendor/golang.org/x/mod/LICENSE,BSD-3-Clause
Expand Down

0 comments on commit 5c93589

Please sign in to comment.