Skip to content

Commit

Permalink
Merge pull request #167 from huitseeker/ci_upgrade
Browse files Browse the repository at this point in the history
Upgrade CI, including release testing
  • Loading branch information
huitseeker authored Jan 14, 2022
2 parents df9137a + 88c2712 commit 48d8764
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Rust

on:
schedule:
- cron: '0 0 * * *' # every day at midnight

env:
CARGO_TERM_COLOR: always
# Disable incremental compilation.
#
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
# as it lets the compiler avoid recompiling code that hasn't changed. However,
# on CI, we're not making small edits; we're almost always building the entire
# project from scratch. Thus, incremental compilation on CI actually
# introduces *additional* overhead to support making future builds
# faster...but no future builds will ever occur in any given CI environment.
#
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
CARGO_INCREMENTAL: 0
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short

jobs:

test:
name: Test Rust ${{matrix.toolchain}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
toolchain: [stable, nightly]
os: [ubuntu]
steps:
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{matrix.toolchain}}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --release --profile=release
7 changes: 7 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,10 @@ jobs:
with:
command: fmt
args: --all -- --check

cargo-deny:
name: cargo-deny (advisories, licenses, bans, ...)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
218 changes: 218 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# This template contains all of the possible sections and their default values

# Note that all fields that take a lint level have these possible values:
# * deny - An error will be produced and the check will fail
# * warn - A warning will be produced, but the check will not fail
# * allow - No warning or error will be produced, though in some cases a note
# will be

# The values provided in this template are the default values that will be used
# when any section or field is not specified in your own configuration

# If 1 or more target triples (and optionally, target_features) are specified,
# only the specified targets will be checked when running `cargo deny check`.
# This means, if a particular package is only ever used as a target specific
# dependency, such as, for example, the `nix` crate only being used via the
# `target_family = "unix"` configuration, that only having windows targets in
# this list would mean the nix crate, as well as any of its exclusive
# dependencies not shared by any other crates, would be ignored, as the target
# list here is effectively saying which targets you are building for.
targets = [
# The triple can be any string, but only the target triples built in to
# rustc (as of 1.40) can be checked against actual config expressions
#{ triple = "x86_64-unknown-linux-musl" },
# You can also specify which target_features you promise are enabled for a
# particular target. target_features are currently not validated against
# the actual valid features supported by the target architecture.
#{ triple = "wasm32-unknown-unknown", features = ["atomics"] },
]

# This section is considered when running `cargo deny check advisories`
# More documentation for the advisories section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
[advisories]
# The path where the advisory database is cloned/fetched into
db-path = "~/.cargo/advisory-db"
# The url(s) of the advisory databases to use
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for security vulnerabilities
vulnerability = "deny"
# The lint level for unmaintained crates
unmaintained = "warn"
# The lint level for crates that have been yanked from their source registry
yanked = "warn"
# The lint level for crates with security notices. Note that as of
# 2019-12-17 there are no security notice advisories in
# https://github.com/rustsec/advisory-db
notice = "warn"
# A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered.
ignore = [
#"RUSTSEC-0000-0000",
"RUSTSEC-2020-0071",
"RUSTSEC-2020-0159",
]
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
# lower than the range specified will be ignored. Note that ignored advisories
# will still output a note when they are encountered.
# * None - CVSS Score 0.0
# * Low - CVSS Score 0.1 - 3.9
# * Medium - CVSS Score 4.0 - 6.9
# * High - CVSS Score 7.0 - 8.9
# * Critical - CVSS Score 9.0 - 10.0
#severity-threshold =

# This section is considered when running `cargo deny check licenses`
# More documentation for the licenses section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
[licenses]
# The lint level for crates which do not have a detectable license
unlicensed = "deny"
# List of explictly allowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
allow = [
"MIT",
"BSD-2-Clause",
"BSD-3-Clause",
"Apache-2.0",
"MPL-2.0",
"ISC",
"CC0-1.0",
"LicenseRef-ring",
#"Apache-2.0 WITH LLVM-exception",
]
# List of explictly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
deny = [
#"Nokia",
]
# Lint level for licenses considered copyleft
copyleft = "warn"
# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
# * both - The license will be approved if it is both OSI-approved *AND* FSF
# * either - The license will be approved if it is either OSI-approved *OR* FSF
# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
# * neither - This predicate is ignored and the default lint level is used
allow-osi-fsf-free = "neither"
# Lint level used when no other predicates are matched
# 1. License isn't in the allow or deny lists
# 2. License isn't copyleft
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
default = "deny"
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
# canonical license text of a valid SPDX license file.
# [possible values: any between 0.0 and 1.0].
confidence-threshold = 0.8
# Allow 1 or more licenses on a per-crate basis, so that particular licenses
# aren't accepted for every possible crate as with the normal allow list
exceptions = [
# Each entry is the crate and version constraint, and its specific allow
# list
#{ allow = ["Zlib"], name = "adler32", version = "*" },
]

# Some crates don't have (easily) machine readable licensing information,
# adding a clarification entry for it allows you to manually specify the
# licensing information
#[[licenses.clarify]]
# The name of the crate the clarification applies to
#name = "ring"
# The optional version constraint for the crate
#version = "*"
# The SPDX expression for the license requirements of the crate
#expression = "MIT AND ISC AND OpenSSL"
# One or more files in the crate's source used as the "source of truth" for
# the license expression. If the contents match, the clarification will be used
# when running the license check, otherwise the clarification will be ignored
# and the crate will be checked normally, which may produce warnings or errors
# depending on the rest of your configuration
#license-files = [
# Each entry is a crate relative path, and the (opaque) hash of its contents
#{ path = "LICENSE", hash = 0xbd0eed23 }
#]
[[licenses.clarify]]
name = "ring"
expression = "LicenseRef-ring"
license-files = [
{ path = "LICENSE", hash = 0xbd0eed23 },
]
[[licenses.clarify]]
name = "encoding_rs"
version = "*"
expression = "(Apache-2.0 OR MIT) AND BSD-3-Clause"
license-files = [
{ path = "COPYRIGHT", hash = 0x39f8ad31 }
]

[licenses.private]
# If true, ignores workspace crates that aren't published, or are only
# published to private registries
ignore = false
# One or more private registries that you might publish crates to, if a crate
# is only published to private registries, and ignore is true, the crate will
# not have its license(s) checked
registries = [
#"https://sekretz.com/registry
]

# This section is considered when running `cargo deny check bans`.
# More documentation about the 'bans' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
[bans]
# Lint level for when multiple versions of the same crate are detected
multiple-versions = "warn"
# Lint level for when a crate version requirement is `*`
wildcards = "allow"
# The graph highlighting used when creating dotgraphs for crates
# with multiple versions
# * lowest-version - The path to the lowest versioned duplicate is highlighted
# * simplest-path - The path to the version with the fewest edges is highlighted
# * all - Both lowest-version and simplest-path are used
highlight = "all"
# List of crates that are allowed. Use with care!
allow = [
#{ name = "ansi_term", version = "=0.11.0" },
]
# List of crates to deny
deny = [
# Each entry the name of a crate and a version range. If version is
# not specified, all versions will be matched.
#{ name = "ansi_term", version = "=0.11.0" },
#
# Wrapper crates can optionally be specified to allow the crate when it
# is a direct dependency of the otherwise banned crate
#{ name = "ansi_term", version = "=0.11.0", wrappers = [] },
]
# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [
#{ name = "ansi_term", version = "=0.11.0" },
]
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
# dependencies starting at the specified crate, up to a certain depth, which is
# by default infinite
skip-tree = [
#{ name = "ansi_term", version = "=0.11.0", depth = 20 },
]

# This section is considered when running `cargo deny check sources`.
# More documentation about the 'sources' section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html
[sources]
# Lint level for what to happen when a crate from a crate registry that is not
# in the allow list is encountered
unknown-registry = "warn"
# Lint level for what to happen when a crate from a git repository that is not
# in the allow list is encountered
unknown-git = "warn"
# List of URLs for allowed crate registries. Defaults to the crates.io index
# if not specified. If it is specified but empty, no registries are allowed.
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories
allow-git = []

[sources.allow-org]
1 change: 1 addition & 0 deletions fastpay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "fastpay"
version = "0.1.0"
authors = ["Libra <[email protected]>"]
license = "Apache-2.0"
publish = false
edition = "2021"

Expand Down
1 change: 1 addition & 0 deletions fastpay_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "fastpay_core"
version = "0.1.0"
authors = ["Libra <[email protected]>"]
license = "Apache-2.0"
publish = false
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn sub_non_existing() {

// Substitution between two module ID's that already exist in the module table.
// This is currently not supported and should cause a panic
#[should_panic]
#[cfg_attr(debug_assertions, should_panic)]
#[test]
fn sub_existing() {
let id1 = make_id(10, ident_str!("Name1"));
Expand Down
11 changes: 9 additions & 2 deletions fastx_programmability/adapter/tests/cli_testsuite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@

//use move_cli::sandbox::commands::test;

use std::path::{Path, PathBuf};
use std::path::Path;

fn run_all(args_path: &Path) -> datatest_stable::Result<()> {
let _use_temp_dir = !args_path.parent().unwrap().join("NO_TEMPDIR").exists();
let fastx_binary = PathBuf::from("../../target/debug/fastx");
let target =
std::env::var_os("CARGO_BUILD_TARGET_DIR").unwrap_or_else(|| "../../target".into());
#[cfg(debug_assertions)]
let profile: String = "debug".into();
#[cfg(not(debug_assertions))]
let profile: String = "release".into();

let fastx_binary = Path::new(&target).join(profile).join("fastx");
assert!(fastx_binary.exists(), "No such binary {:?}", fastx_binary);
// TODO: crashes inside diem code with `Error: prefix not found` when running `cargo test`
/*test::run_one(
Expand Down
1 change: 1 addition & 0 deletions fastx_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "fastx-types"
version = "0.1.0"
authors = ["Mysten Labs <[email protected]>"]
license = "Apache-2.0"
publish = false
edition = "2021"

Expand Down

1 comment on commit 48d8764

@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.30s
�[0m�[0m�[1m�[32m Running�[0m target/release/bench
[2022-01-14T14:14:36Z INFO bench] Starting benchmark: OrdersAndCerts
[2022-01-14T14:14:36Z INFO bench] Preparing accounts.
[2022-01-14T14:14:36Z INFO bench] Open database on path: "/tmp/DB_FA56EA70C9A7DE59AADC2C27008763E8"
[2022-01-14T14:14:40Z INFO bench] Preparing transactions.
[2022-01-14T14:14:48Z INFO fastpay::network] Listening to Tcp traffic on 127.0.0.1:9555
[2022-01-14T14:14:49Z INFO bench] Number of TCP connections: 2
[2022-01-14T14:14:49Z INFO bench] Set max_in_flight to 500
[2022-01-14T14:14:49Z INFO bench] Sending requests.
[2022-01-14T14:14:49Z INFO fastpay::network] Sending Tcp requests to 127.0.0.1:9555
[2022-01-14T14:14:51Z INFO fastpay::network] 127.0.0.1:9555 has processed 5000 packets
[2022-01-14T14:14:52Z INFO fastpay::network] In flight 500 Remaining 35000
[2022-01-14T14:14:52Z INFO fastpay::network] 127.0.0.1:9555 has processed 10000 packets
[2022-01-14T14:14:53Z INFO fastpay::network] 127.0.0.1:9555 has processed 15000 packets
[2022-01-14T14:14:54Z INFO fastpay::network] In flight 500 Remaining 30000
[2022-01-14T14:14:55Z INFO fastpay::network] In flight 500 Remaining 30000
[2022-01-14T14:14:55Z INFO fastpay::network] 127.0.0.1:9555 has processed 20000 packets
[2022-01-14T14:14:57Z INFO fastpay::network] 127.0.0.1:9555 has processed 25000 packets
[2022-01-14T14:14:58Z INFO fastpay::network] In flight 500 Remaining 25000
[2022-01-14T14:14:59Z INFO fastpay::network] 127.0.0.1:9555 has processed 30000 packets
[2022-01-14T14:14:59Z INFO fastpay::network] In flight 500 Remaining 25000
[2022-01-14T14:15:00Z INFO fastpay::network] 127.0.0.1:9555 has processed 35000 packets
[2022-01-14T14:15:00Z INFO fastpay::network] In flight 500 Remaining 20000
[2022-01-14T14:15:01Z INFO fastpay::network] 127.0.0.1:9555 has processed 40000 packets
[2022-01-14T14:15:02Z INFO fastpay::network] In flight 500 Remaining 20000
[2022-01-14T14:15:02Z INFO fastpay::network] 127.0.0.1:9555 has processed 45000 packets
[2022-01-14T14:15:02Z INFO fastpay::network] In flight 500 Remaining 15000
[2022-01-14T14:15:04Z INFO fastpay::network] 127.0.0.1:9555 has processed 50000 packets
[2022-01-14T14:15:04Z INFO fastpay::network] In flight 500 Remaining 15000
[2022-01-14T14:15:05Z INFO fastpay::network] 127.0.0.1:9555 has processed 55000 packets
[2022-01-14T14:15:05Z INFO fastpay::network] In flight 500 Remaining 10000
[2022-01-14T14:15:06Z INFO fastpay::network] 127.0.0.1:9555 has processed 60000 packets
[2022-01-14T14:15:07Z INFO fastpay::network] In flight 500 Remaining 5000
[2022-01-14T14:15:07Z INFO fastpay::network] 127.0.0.1:9555 has processed 65000 packets
[2022-01-14T14:15:07Z INFO fastpay::network] In flight 500 Remaining 10000
[2022-01-14T14:15:08Z INFO fastpay::network] 127.0.0.1:9555 has processed 70000 packets
[2022-01-14T14:15:09Z INFO fastpay::network] Done sending Tcp requests to 127.0.0.1:9555
[2022-01-14T14:15:12Z INFO fastpay::network] In flight 500 Remaining 5000
[2022-01-14T14:15:12Z INFO fastpay::network] 127.0.0.1:9555 has processed 75000 packets
[2022-01-14T14:15:13Z INFO fastpay::network] 127.0.0.1:9555 has processed 80000 packets
[2022-01-14T14:15:13Z INFO fastpay::network] Done sending Tcp requests to 127.0.0.1:9555
[2022-01-14T14:15:13Z INFO bench] Received 80000 responses.
[2022-01-14T14:15:13Z WARN bench] Completed benchmark for OrdersAndCerts
Total time: 24063283us, items: 40000, tx/sec: 1662.2835711984935

Please sign in to comment.