Skip to content

Commit

Permalink
chore: add license header checks to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Feb 20, 2022
1 parent bf8bd16 commit fbac694
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ jobs:
with:
command: fmt
args: --all -- --check
- name: license-check
run: scripts/license_check.sh

cargo-deny:
name: cargo-deny (advisories, licenses, bans, ...)
Expand Down
20 changes: 20 additions & 0 deletions scripts/license_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# shellcheck disable=SC2044
# This script checks each file starts with a license comment
set -e
set -o pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TOPLEVEL="${DIR}/../"

# Iterate over rust files not in the target directory
for i in $(find "$TOPLEVEL" -path "$TOPLEVEL/target" -prune -o -iname "*.rs" -print)
do
CNT=$(head -n3 "$i" | grep -oEe '// (Copyright \(c\) 2022, Mysten Labs, Inc.|SPDX-License-Identifier: Apache-2.0)' | wc -l)
# echo "$i $CNT"
if [ "$CNT" -lt 2 ]
then
echo "File $i has an incorrect license header"
exit 1
fi
done

1 comment on commit fbac694

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bench results

�[0m�[0m�[1m�[32m Finished�[0m release [optimized + debuginfo] target(s) in 1.60s
�[0m�[0m�[1m�[32m Running�[0m target/release/bench
�[2m2022-02-20T18:08:11.412344Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Starting benchmark: OrdersAndCerts
�[2m2022-02-20T18:08:11.412631Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Preparing accounts.
�[2m2022-02-20T18:08:11.419753Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Open database on path: "/tmp/DB_64A31C0F5150FC6B6C5066743FCD03085A70097E"
�[2m2022-02-20T18:08:16.644709Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Preparing transactions.
�[2m2022-02-20T18:08:25.271673Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m Listening to TCP traffic on 127.0.0.1:9555
�[2m2022-02-20T18:08:26.273554Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Number of TCP connections: 2
�[2m2022-02-20T18:08:26.273589Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Set max_in_flight to 500
�[2m2022-02-20T18:08:26.273594Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Sending requests.
�[2m2022-02-20T18:08:26.279754Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Sending TCP requests to 127.0.0.1:9555
�[2m2022-02-20T18:08:26.285385Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Sending TCP requests to 127.0.0.1:9555
�[2m2022-02-20T18:08:27.163488Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 5000 packets
�[2m2022-02-20T18:08:27.946449Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 35000
�[2m2022-02-20T18:08:27.968263Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 35000
�[2m2022-02-20T18:08:28.050147Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 10000 packets
�[2m2022-02-20T18:08:28.937155Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 15000 packets
�[2m2022-02-20T18:08:29.738342Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 30000
�[2m2022-02-20T18:08:29.766498Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 30000
�[2m2022-02-20T18:08:29.828920Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 20000 packets
�[2m2022-02-20T18:08:30.718062Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 25000 packets
�[2m2022-02-20T18:08:31.545060Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 25000
�[2m2022-02-20T18:08:31.562172Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 25000
�[2m2022-02-20T18:08:31.607559Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 30000 packets
�[2m2022-02-20T18:08:32.500227Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 35000 packets
�[2m2022-02-20T18:08:33.292962Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 20000
�[2m2022-02-20T18:08:33.316814Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 20000
�[2m2022-02-20T18:08:33.389995Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 40000 packets
�[2m2022-02-20T18:08:34.325063Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 45000 packets
�[2m2022-02-20T18:08:35.122326Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 15000
�[2m2022-02-20T18:08:35.217418Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 15000
�[2m2022-02-20T18:08:35.234702Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 50000 packets
�[2m2022-02-20T18:08:36.140426Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 55000 packets
�[2m2022-02-20T18:08:36.853629Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 10000
�[2m2022-02-20T18:08:37.024182Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 10000
�[2m2022-02-20T18:08:37.032166Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 60000 packets
�[2m2022-02-20T18:08:37.927177Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 65000 packets
�[2m2022-02-20T18:08:38.623985Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 5000
�[2m2022-02-20T18:08:38.819696Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 70000 packets
�[2m2022-02-20T18:08:38.871713Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m In flight 500 Remaining 5000
�[2m2022-02-20T18:08:39.715942Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 75000 packets
�[2m2022-02-20T18:08:40.492541Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Done sending TCP requests to 127.0.0.1:9555
�[2m2022-02-20T18:08:40.753276Z�[0m �[32m INFO�[0m �[2msui_core::authority_server�[0m�[2m:�[0m 127.0.0.1:9555 has processed 80000 packets
�[2m2022-02-20T18:08:40.795106Z�[0m �[32m INFO�[0m �[2msui_network::network�[0m�[2m:�[0m Done sending TCP requests to 127.0.0.1:9555
�[2m2022-02-20T18:08:40.797321Z�[0m �[32m INFO�[0m �[2mbench�[0m�[2m:�[0m Received 80000 responses.
�[2m2022-02-20T18:08:40.967588Z�[0m �[33m WARN�[0m �[2mbench�[0m�[2m:�[0m Completed benchmark for OrdersAndCerts
Total time: 14523712us, items: 40000, tx/sec: 2754.1168538731695

Please sign in to comment.