Skip to content

Commit 3e6926a

Browse files
committed
Add license check
1 parent ef42580 commit 3e6926a

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,28 @@ jobs:
130130
if: ${{ matrix.check == 'clippy' }}
131131
run: cargo clippy -- -D warnings
132132

133+
license-check:
134+
runs-on: ubuntu-latest
135+
steps:
136+
- uses: actions/checkout@v3
137+
138+
- name: Install cargo-about
139+
uses: baptiste0928/cargo-install@v1
140+
with:
141+
crate: cargo-about
142+
version: "0.5"
143+
144+
- name: Run license check
145+
# Explicitly use stable because otherwise cargo will trigger a download of
146+
# the nightly version specified in rust-toolchain.toml
147+
run: cargo +stable about generate about.hbs > license.html
148+
149+
- name: Archive license file
150+
uses: actions/upload-artifact@v3
151+
with:
152+
name: license
153+
path: license.html
154+
133155
cargo-toml-fmt:
134156
runs-on: ubuntu-latest
135157
container: "tamasfe/taplo:0.7.0-alpine"

about.hbs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<html>
2+
3+
<head>
4+
<style>
5+
@media (prefers-color-scheme: dark) {
6+
body {
7+
background: #333;
8+
color: white;
9+
}
10+
a {
11+
color: skyblue;
12+
}
13+
}
14+
.container {
15+
font-family: sans-serif;
16+
max-width: 800px;
17+
margin: 0 auto;
18+
}
19+
.intro {
20+
text-align: center;
21+
}
22+
.licenses-list {
23+
list-style-type: none;
24+
margin: 0;
25+
padding: 0;
26+
}
27+
.license-used-by {
28+
margin-top: -10px;
29+
}
30+
.license-text {
31+
max-height: 200px;
32+
overflow-y: scroll;
33+
white-space: pre-wrap;
34+
}
35+
</style>
36+
</head>
37+
38+
<body>
39+
<main class="container">
40+
<div class="intro">
41+
<h1>Third Party Licenses</h1>
42+
<p>This page lists the licenses of the projects used in cargo-about.</p>
43+
</div>
44+
45+
<h2>Overview of licenses:</h2>
46+
<ul class="licenses-overview">
47+
{{#each overview}}
48+
<li><a href="#{{id}}">{{name}}</a> ({{count}})</li>
49+
{{/each}}
50+
</ul>
51+
52+
<h2>All license text:</h2>
53+
<ul class="licenses-list">
54+
{{#each licenses}}
55+
<li class="license">
56+
<h3 id="{{id}}">{{name}}</h3>
57+
<h4>Used by:</h4>
58+
<ul class="license-used-by">
59+
{{#each used_by}}
60+
<li><a href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">{{crate.name}} {{crate.version}}</a></li>
61+
{{/each}}
62+
</ul>
63+
<pre class="license-text">{{text}}</pre>
64+
</li>
65+
{{/each}}
66+
</ul>
67+
</main>
68+
</body>
69+
70+
</html>

about.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
accepted = [
2+
"Apache-2.0",
3+
"MIT",
4+
"Apache-2.0 WITH LLVM-exception",
5+
"BSD-2-Clause",
6+
"CC0-1.0",
7+
"BSD-3-Clause",
8+
"MPL-2.0",
9+
"ISC",
10+
"OpenSSL",
11+
"Unicode-DFS-2016",
12+
"Zlib",
13+
"GPL-3.0 WITH Classpath-exception-2.0",
14+
"GPL-3.0",
15+
]
16+
ignore-dev-dependencies = true
17+
ignore-build-dependencies = true
18+
workarounds = [
19+
"ring",
20+
]

0 commit comments

Comments
 (0)