-
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.
* CircleCI Commit * replicating circleci config from snarkos * only using circleci meduim resource plans * fixed bft tests * limiting workflow to main branch * circleci: config update * circleci: config update
- Loading branch information
Showing
2 changed files
with
398 additions
and
24 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,360 @@ | ||
version: 2.1 | ||
|
||
parameters: | ||
medium: | ||
type: string | ||
default: medium | ||
large: | ||
type: string | ||
default: large | ||
xlarge: | ||
type: string | ||
default: xlarge | ||
twoxlarge: | ||
type: string | ||
default: aleonet/2xlarge | ||
|
||
orbs: | ||
windows: circleci/[email protected] | ||
|
||
commands: | ||
check_windows: | ||
description: "Runs cargo check on Windows" | ||
parameters: | ||
workspace_member: | ||
type: string | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} | ||
- run: | ||
name: "Install Rust and run cargo check" | ||
command: | | ||
$ProgressPreference = "SilentlyContinue" | ||
# Remove the circleci installed rustc. | ||
choco uninstall rust | ||
# Install llvm (libclang for rocksdb). | ||
choco install llvm -y | ||
refreshenv | ||
# Install rust with rustup. | ||
Invoke-WebRequest -Uri "https://win.rustup.rs/" -OutFile "C:\rustup-init.exe" | ||
& C:\rustup-init.exe -y --default-toolchain "stable-x86_64-pc-windows-msvc" --no-modify-path --profile minimal | ||
$Env:Path += ";$Env:USERPROFILE\.cargo\bin" | ||
# Verify the installation. | ||
cargo --version --verbose | ||
rustc --version | Out-File -FilePath "rust-version" | ||
if (!(Test-Path "Cargo.lock" -PathType Leaf)) { | ||
cargo generate-lockfile | ||
} | ||
cd << parameters.workspace_member >> | ||
cargo check --examples --benches --tests | ||
- save_cache: | ||
paths: | ||
- C:\Users\circleci\.cargo\registry | ||
- C:\Users\circleci\.cargo\git | ||
- target | ||
key: cargo-cache-{{ arch }}-{{ checksum "rust-version" }}-{{ checksum "Cargo.lock" }} | ||
|
||
setup_environment: | ||
description: "Setup testing environment" | ||
parameters: | ||
cache_key: | ||
type: string | ||
default: v3.0.0-rust-1.81.0-snarkos-stable-cache | ||
steps: | ||
- run: set -e | ||
- run: | ||
name: Prepare environment and install dependencies | ||
command: | | ||
export SCCACHE_CACHE_SIZE=200M | ||
export WORK_DIR="$CIRCLE_WORKING_DIRECTORY/.cache/sccache" | ||
export SCCACHE_DIR="$CIRCLE_WORKING_DIRECTORY/.cache/sccache" | ||
mkdir -p "$CIRCLE_WORKING_DIRECTORY/.bin" | ||
wget https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-unknown-linux-musl.tar.gz | ||
tar -C "$CIRCLE_WORKING_DIRECTORY/.bin" -xvf sccache-v0.3.0-x86_64-unknown-linux-musl.tar.gz | ||
mv $CIRCLE_WORKING_DIRECTORY/.bin/sccache-v0.3.0-x86_64-unknown-linux-musl/sccache $CIRCLE_WORKING_DIRECTORY/.bin/sccache | ||
export PATH="$PATH:$CIRCLE_WORKING_DIRECTORY/.bin" | ||
export RUSTC_WRAPPER="sccache" | ||
rm -rf "$CIRCLE_WORKING_DIRECTORY/.cargo/registry" | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get update | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get dist-upgrade -y -o DPkg::Options::=--force-confold | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends clang llvm-dev llvm pkg-config xz-utils make libssl-dev libssl-dev | ||
- restore_cache: | ||
keys: | ||
- << parameters.cache_key >> | ||
|
||
clear_environment: | ||
description: "Clear environment" | ||
parameters: | ||
cache_key: | ||
type: string | ||
default: v3.0.0-rust-1.81.0-snarkos-stable-cache | ||
steps: | ||
- run: (sccache -s||true) | ||
- run: set +e | ||
- save_cache: | ||
key: << parameters.cache_key >> | ||
paths: | ||
- .cache/sccache | ||
- .cargo | ||
|
||
run_serial: | ||
description: "Build and run tests" | ||
parameters: | ||
workspace_member: | ||
type: string | ||
cache_key: | ||
type: string | ||
flags: | ||
type: string | ||
default: "" | ||
steps: | ||
- checkout | ||
- setup_environment: | ||
cache_key: << parameters.cache_key >> | ||
- run: | ||
no_output_timeout: 30m | ||
command: cd << parameters.workspace_member >> && RUST_MIN_STACK=67108864 cargo test << parameters.flags >> | ||
- clear_environment: | ||
cache_key: << parameters.cache_key >> | ||
|
||
run_serial_long: | ||
description: "Build and run long running tests" | ||
parameters: | ||
workspace_member: | ||
type: string | ||
cache_key: | ||
type: string | ||
flags: | ||
type: string | ||
default: "" | ||
steps: | ||
- checkout | ||
- setup_environment: | ||
cache_key: << parameters.cache_key >> | ||
- run: | ||
no_output_timeout: 300m | ||
command: cd << parameters.workspace_member >> && RUST_MIN_STACK=67108864 cargo test << parameters.flags >> | ||
- clear_environment: | ||
cache_key: << parameters.cache_key >> | ||
|
||
run_parallel: | ||
description: "Build and run tests (in parallel)" | ||
parameters: | ||
workspace_member: | ||
type: string | ||
cache_key: | ||
type: string | ||
flags: | ||
type: string | ||
default: "" | ||
steps: | ||
- checkout | ||
- setup_environment: | ||
cache_key: << parameters.cache_key >> | ||
- run: | ||
no_output_timeout: 45m | ||
command: | | ||
cd << parameters.workspace_member >> | ||
cargo test -- --list --format terse | sed 's/: test//' > test_names.txt | ||
TEST_NAMES=$(circleci tests split test_names.txt) | ||
for i in $(echo $TEST_NAMES | sed "s/ / /g") | ||
do | ||
RUST_MIN_STACK=67108864 cargo test $i << parameters.flags >> | ||
done | ||
- clear_environment: | ||
cache_key: << parameters.cache_key >> | ||
|
||
install_rust_nightly: | ||
description: "Install Rust nightly toolchain" | ||
steps: | ||
- run: rustup toolchain install nightly-x86_64-unknown-linux-gnu | ||
|
||
jobs: | ||
amareleo-chain: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: . | ||
cache_key: v3.0.0-rust-1.81.0-stable-cache | ||
|
||
account: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: account | ||
cache_key: v3.0.0-rust-1.81.0-account-cache | ||
|
||
cli: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: cli | ||
cache_key: v3.0.0-rust-1.81.0-cli-cache | ||
|
||
node: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node | ||
cache_key: v3.0.0-rust-1.81.0-node-cache | ||
|
||
node-bft: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/bft | ||
cache_key: v3.0.0-rust-1.81.0-node-bft-cache | ||
|
||
node-bft-events: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/bft/events | ||
cache_key: v3.0.0-rust-1.81.0-node-bft-events-cache | ||
|
||
node-bft-ledger-service: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/bft/ledger-service | ||
cache_key: v3.0.0-rust-1.81.0-node-bft-ledger-service-cache | ||
|
||
node-bft-storage-service: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/bft/storage-service | ||
cache_key: v3.0.0-rust-1.81.0-node-bft-storage-service-cache | ||
|
||
node-consensus: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/consensus | ||
cache_key: v3.0.0-rust-1.81.0-node-consensus-cache | ||
|
||
node-rest: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/rest | ||
cache_key: v3.0.0-rust-1.81.0-node-rest-cache | ||
|
||
node-sync: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/sync | ||
cache_key: v3.0.0-rust-1.81.0-node-sync-cache | ||
|
||
node-sync-locators: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- run_serial: | ||
workspace_member: node/sync/locators | ||
cache_key: v3.0.0-rust-1.81.0-node-sync-locators-cache | ||
|
||
check-fmt: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- checkout | ||
- install_rust_nightly | ||
- setup_environment: | ||
cache_key: v3.0.0-rust-1.81.0-fmt-cache | ||
- run: | ||
name: Check style | ||
no_output_timeout: 35m | ||
command: cargo +nightly fmt --all -- --check | ||
- clear_environment: | ||
cache_key: v3.0.0-rust-1.81.0-fmt-cache | ||
|
||
check-clippy: | ||
docker: | ||
- image: cimg/rust:1.81.0 # Attention - Change the MSRV in Cargo.toml and rust-toolchain as well | ||
resource_class: << pipeline.parameters.medium >> | ||
steps: | ||
- checkout | ||
- setup_environment: | ||
cache_key: v3.0.0-rust-1.81.0-clippy-cache | ||
- run: | ||
name: Check lint | ||
no_output_timeout: 35m | ||
command: | | ||
cargo clippy --workspace --all-targets -- -D warnings | ||
cargo clippy --workspace --all-targets --all-features -- -D warnings | ||
- clear_environment: | ||
cache_key: v3.0.0-rust-1.81.0-clippy-cache | ||
|
||
verify-windows: | ||
executor: | ||
name: windows/default | ||
size: medium | ||
environment: | ||
CARGO_NET_GIT_FETCH_WITH_CLI: "true" | ||
parameters: | ||
workspace_member: | ||
type: string | ||
steps: | ||
- check_windows: | ||
workspace_member: << parameters.workspace_member >> | ||
|
||
workflows: | ||
version: 2 | ||
|
||
main-workflow: | ||
jobs: | ||
- amareleo-chain: | ||
filters: pipeline.git.branch == "main" | ||
- account: | ||
filters: pipeline.git.branch == "main" | ||
- cli: | ||
filters: pipeline.git.branch == "main" | ||
- node: | ||
filters: pipeline.git.branch == "main" | ||
- node-bft: | ||
filters: pipeline.git.branch == "main" | ||
- node-bft-events: | ||
filters: pipeline.git.branch == "main" | ||
- node-bft-ledger-service: | ||
filters: pipeline.git.branch == "main" | ||
- node-bft-storage-service: | ||
filters: pipeline.git.branch == "main" | ||
- node-consensus: | ||
filters: pipeline.git.branch == "main" | ||
- node-rest: | ||
filters: pipeline.git.branch == "main" | ||
- node-sync: | ||
filters: pipeline.git.branch == "main" | ||
- node-sync-locators: | ||
filters: pipeline.git.branch == "main" | ||
- check-fmt: | ||
filters: pipeline.git.branch == "main" | ||
- check-clippy: | ||
filters: pipeline.git.branch == "main" |
Oops, something went wrong.