-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code checks to CI and do_checks script
- Loading branch information
1 parent
4c47018
commit e273303
Showing
4 changed files
with
142 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Static code checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" # target all branches | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_LOG: debug | ||
RUST_BACKTRACE: full | ||
|
||
jobs: | ||
static_checks_ubuntu: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Update local dependency repositories | ||
run: sudo apt-get update | ||
- name: Install dependencies | ||
run: sudo apt-get install -yqq --no-install-recommends build-essential python3 python3-toml | ||
|
||
- name: Install rust | ||
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $(python3 ./build-tools/rust-version-extractor/rust-version-extractor.py) | ||
- name: Install rust clippy | ||
run: rustup component add clippy | ||
- name: Install cargo-deny | ||
run: cargo install cargo-deny --locked | ||
- name: Run checks | ||
run: ./do_checks.sh | ||
|
||
static_checks_windows: | ||
runs-on: windows-latest | ||
steps: | ||
# This prevents git from changing line-endings to crlf, which messes cargo fmt checks | ||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install python toml package | ||
run: python3 -m pip install toml | ||
- name: Install rust | ||
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $(python3 ./build-tools/rust-version-extractor/rust-version-extractor.py) | ||
- name: Install rust clippy | ||
run: rustup component add clippy | ||
- name: Install cargo-deny | ||
run: cargo install cargo-deny --locked | ||
- name: Run checks | ||
shell: bash | ||
run: ./do_checks.sh | ||
|
||
static_checks_macos: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install python toml package | ||
run: python3 -m pip install toml | ||
- name: Install rust | ||
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $(python3 ./build-tools/rust-version-extractor/rust-version-extractor.py) | ||
- name: Install rust clippy | ||
run: rustup component add clippy | ||
- name: Install cargo-deny | ||
run: cargo install cargo-deny --locked | ||
- name: Run checks | ||
run: bash ./do_checks.sh |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[sources.allow-org] | ||
github = [ | ||
"mintlayer", # allow any code from mintlayer's github | ||
] | ||
|
||
[licenses] | ||
#we reject code without a license | ||
confidence-threshold = 0.92 | ||
allow = [ | ||
"Apache-2.0", | ||
"MIT", | ||
"Unicode-DFS-2016", | ||
] # deny a license not in this set of licenses | ||
|
||
[[licenses.clarify]] | ||
name = "ring" | ||
expression = "LicenseRef-ring" | ||
license-files = [ | ||
{ path = "LICENSE", hash = 0xbd0eed23 }, | ||
] | ||
|
||
[[licenses.clarify]] | ||
name = "webpki" | ||
expression = "LicenseRef-webpki" | ||
license-files = [ | ||
{ path = "LICENSE", hash = 0x001c7e6c }, | ||
] | ||
|
||
[[licenses.clarify]] | ||
name = "rustls-webpki" | ||
expression = "LicenseRef-webpki" | ||
license-files = [ | ||
{ path = "LICENSE", hash = 0x001c7e6c }, | ||
] | ||
|
||
[advisories] | ||
db-path = "~/.cargo/advisory-dbs" | ||
db-urls = [ "https://github.com/RustSec/advisory-db" ] | ||
yanked = "warn" | ||
ignore = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | ||
PYTHON=$(which python || which python3) | ||
|
||
cargo fmt --check -- --config newline_style=Unix | ||
|
||
# Install cargo deny first with: cargo install cargo-deny | ||
cargo deny check --hide-inclusion-graph | ||
|
||
# Checks enabled everywhere, including tests, benchmarks | ||
cargo clippy |