diff --git a/.github/workflows/license-checks.yml b/.github/workflows/license-checks.yml new file mode 100644 index 00000000..08f93726 --- /dev/null +++ b/.github/workflows/license-checks.yml @@ -0,0 +1,60 @@ +name: License checks + +on: + push: + branches: + - main + - release-* + pull_request: + +jobs: + licenses-need-reevaluation: + name: 'Should licenses be evaluated ?' + runs-on: 'ubuntu-24.04' + outputs: + need-reevaluation: ${{ steps.changed.outputs.lockfile }} + + steps: + - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v3 + id: changed + with: + filters: | + lockfile: + - Cargo.lock + + check: + name: Check licenses + needs: + - licenses-need-reevaluation + if: needs.licenses-need-reevaluation.outputs.need-reevaluation == 'true' + runs-on: 'ubuntu-24.04' + + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + key: check-license-${{ runner.os }} + + - name: Install cargo-about + run: cargo install cargo-about + + - name: Generate licenses + run: make licenses + + - name: Store licenses + if: always() + uses: actions/upload-artifact@v4 + with: + name: third-party-licenses + path: | + ${{ github.workspace }}/THIRD_PARTY_LICENSES.html diff --git a/Makefile b/Makefile index 1fe10ddc..464320e8 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,12 @@ image: -t $(FACT_IMAGE_NAME) \ $(CURDIR) +licenses:THIRD_PARTY_LICENSES.html + +THIRD_PARTY_LICENSES.html:Cargo.lock + cargo install cargo-about + cargo about generate --format handlebars -o THIRD_PARTY_LICENSES.html about_html.hbs + integration-tests: make -C tests @@ -37,4 +43,4 @@ format: cargo fmt make -C fact-ebpf format -.PHONY: tag mock-server integration-tests image image-name clean +.PHONY: tag mock-server integration-tests image image-name licenses clean diff --git a/about.toml b/about.toml new file mode 100644 index 00000000..26d24936 --- /dev/null +++ b/about.toml @@ -0,0 +1,9 @@ +accepted = [ + "MIT", + "Apache-2.0", + "BSD-3-Clause", + "Zlib", + "ISC", + "Unicode-3.0", +] + diff --git a/about_html.hbs b/about_html.hbs new file mode 100644 index 00000000..b24f8e0e --- /dev/null +++ b/about_html.hbs @@ -0,0 +1,70 @@ + + + + + + + +
+
+

Third Party Licenses

+

This page lists the licenses of the projects used in cargo-about.

+
+ +

Overview of licenses:

+ + +

All license text:

+ +
+ + +