Skip to content

Commit acfb97f

Browse files
authored
chore(license): check license using cargo-deny (#492)
1 parent 3af5a75 commit acfb97f

File tree

5 files changed

+51
-8
lines changed

5 files changed

+51
-8
lines changed

.github/workflows/brew-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
tags:
55
- 'v*'
66
jobs:
7-
release:
8-
name: Bump Homebrew formula
7+
bump-homebrew-formula:
98
runs-on: ubuntu-latest
109
steps:
1110
- uses: mislav/bump-homebrew-formula-action@v3

.github/workflows/check-licenses.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check licenses
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
pull_request:
6+
7+
jobs:
8+
check-licenses:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: EmbarkStudios/cargo-deny-action@v2
13+
with:
14+
command: check licenses

.github/workflows/spell-check.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66

77
jobs:
88
spell-check:
9-
name: Spell Check with Typos
109
runs-on: ubuntu-latest
1110
steps:
1211
- name: Checkout

Makefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Checks same as CI
22
.PHONY: ci
3-
ci: test-ci check fmt-check detect-unused-dependencies update-license-file spell-check
3+
ci: test-ci check fmt-check detect-unused-dependencies check-licenses update-license-file spell-check
44

55
.PHONY: run
66
run:
@@ -12,25 +12,31 @@ tools: tool-test tool-bump-version tool-spell-check
1212
.PHONY: tool-test
1313
tool-test:
1414
@if ! which cargo-nextest > /dev/null; then \
15-
cargo install cargo-nextest; \
15+
cargo install --locked cargo-nextest; \
1616
fi
1717

1818
.PHONY: tool-bump-version
1919
tool-bump-version:
2020
@if ! which cargo-set-version > /dev/null; then \
21-
cargo install cargo-edit; \
21+
cargo install --locked cargo-edit; \
2222
fi
2323

2424
.PHONY: tool-spell-check
2525
tool-spell-check:
2626
@if ! which typos > /dev/null; then \
27-
cargo install typos-cli; \
27+
cargo install --locked typos-cli; \
2828
fi
2929

3030
.PHONY: tool-detect-unused-dependencies
3131
tool-detect-unused-dependencies:
3232
@if ! which cargo-machete > /dev/null; then \
33-
cargo install cargo-machete; \
33+
cargo install --locked cargo-machete; \
34+
fi
35+
36+
.PHONY: tool-check-licenses
37+
tool-check-licenses:
38+
@if ! which cargo-deny > /dev/null; then \
39+
cargo install --locked cargo-deny; \
3440
fi
3541

3642
.PHONY: tool-update-license-file
@@ -85,6 +91,10 @@ detect-unused-dependencies: tool-detect-unused-dependencies
8591
update-license-file: tool-update-license-file
8692
cargo about generate about.hbs > license.html
8793

94+
.PHONY: check-licenses
95+
check-licenses: tool-check-licenses
96+
cargo deny check licenses
97+
8898
DEBUG_EXECUTABLE = ./target/debug/fzf-make
8999
TEST_DIR = ./test_data
90100
.PHONY: run-in-test-data

deny.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# doc: https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
2+
[licenses]
3+
allow = [
4+
"MIT",
5+
"ISC",
6+
"Apache-2.0",
7+
"MPL-2.0",
8+
"BSD-2-Clause",
9+
"BSD-3-Clause",
10+
"Unicode-DFS-2016",
11+
"OpenSSL",
12+
]
13+
confidence-threshold = 0.8
14+
exceptions = []
15+
16+
[[licenses.clarify]]
17+
name = "ring"
18+
expression = "MIT AND ISC AND OpenSSL"
19+
license-files = [
20+
{ path = "LICENSE", hash = 0xbd0eed23 }
21+
]

0 commit comments

Comments
 (0)