Skip to content

Commit

Permalink
Add licensing checks
Browse files Browse the repository at this point in the history
  • Loading branch information
emesare committed Aug 29, 2024
1 parent 3896447 commit 5f32597
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,22 @@ jobs:
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
uses: actions-rust-lang/rustfmt@v1

# Check licensing and produce a list of licenses
licensing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-about
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-about
version: "0.6.4"
- name: Run license check
run: cargo about generate about.hbs > license.html
- name: Archive license file
uses: actions/upload-artifact@v4
with:
name: license
path: license.html
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
Cargo.lock
.idea
.idea
license.html
70 changes: 70 additions & 0 deletions about.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>
5 changes: 5 additions & 0 deletions about.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accepted = [
"Apache-2.0",
"MIT",
"Unicode-DFS-2016"
]

0 comments on commit 5f32597

Please sign in to comment.