Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/license-checks.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
9 changes: 9 additions & 0 deletions about.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
accepted = [
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"Zlib",
"ISC",
"Unicode-3.0",
]

70 changes: 70 additions & 0 deletions about_html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<html>

<head>
<style>
@media (prefers-color-scheme: dark) {
body {
background: #333;
color: white;
}
a {
color: skyblue;
}
}
.container {
font-family: sans-serif;
max-width: 800px;
margin: 0 auto;
}
.intro {
text-align: center;
}
.licenses-list {
list-style-type: none;
margin: 0;
padding: 0;
}
.license-used-by {
margin-top: -10px;
}
.license-text {
max-height: 200px;
overflow-y: scroll;
white-space: pre-wrap;
}
</style>
</head>

<body>
<main class="container">
<div class="intro">
<h1>Third Party Licenses</h1>
<p>This page lists the licenses of the projects used in cargo-about.</p>
</div>

<h2>Overview of licenses:</h2>
<ul class="licenses-overview">
{{#each overview}}
<li><a href="#{{id}}">{{name}}</a> ({{count}})</li>
{{/each}}
</ul>

<h2>All license text:</h2>
<ul class="licenses-list">
{{#each licenses}}
<li class="license">
<h3 id="{{id}}">{{name}}</h3>
<h4>Used by:</h4>
<ul class="license-used-by">
{{#each used_by}}
<li><a href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">{{crate.name}} {{crate.version}}</a></li>
{{/each}}
</ul>
<pre class="license-text">{{text}}</pre>
</li>
{{/each}}
</ul>
</main>
</body>

</html>
Loading