Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] #1657: Update image to rust 1.57 #1666

Merged
merged 7 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/iroha2-add-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
- uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.github_token }}
labels: iroha2
labels: |
iroha2
14 changes: 9 additions & 5 deletions .github/workflows/iroha2-dev-pr-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ name: I2::Dev::Static Analysis
on:
pull_request:
branches: [iroha2-dev]
paths:
- "**.rs"
- "**.json"
- "**.toml"
- "**.yml"

jobs:
check:
runs-on: ubuntu-latest
#container: rust:1.56-buster
container:
image: 7272721/i2-ci:latest
steps:
Expand All @@ -26,15 +30,15 @@ jobs:
lscpu
free -h
- name: Format check
run: cargo +nightly-2021-10-22 fmt --all -- --check
run: cargo +nightly-2021-12-02 fmt --all -- --check
- name: Static analysis without features
run: cargo lints clippy --workspace --benches --tests --no-default-features
run: cargo lints clippy --workspace --benches --tests --quiet --no-default-features
if: always()
- name: Static analysis with all features enabled
run: cargo lints clippy --workspace --benches --tests --all-features
run: cargo lints clippy --workspace --benches --tests --all-features --quiet
if: always()
- name: Documentation check
run: |
cargo doc --no-deps
cargo doc --no-deps --quiet
./scripts/check_docs.sh
if: always()
88 changes: 83 additions & 5 deletions .github/workflows/iroha2-dev-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,87 @@ on:
jobs:
check_pr_title:
runs-on: ubuntu-latest
# TODO: Add labels when https://github.com/actions/first-interaction/issues/10 is fixed.
steps:
- name: Check PR title format
env:
PR_TITLE: ${{ github.event.pull_request.title }}
# Example: "[feature] #1: Some new feature"
run: echo $PR_TITLE | grep -Eq "^\[(feature|fix|refactor)\] \#[[:digit:]]+:.+$"
- name: Feature
uses: actions-ecosystem/action-regex-match@v2
id: feature-match
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[feature\] #\d+(, #\d+)*: .+$'
# - name: Add feature label
# uses: actions-ecosystem/action-add-labels@v1
# if: ${{ steps.feature-match.outputs.match != '' }}
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Enhancement

- name: Refactor
uses: actions-ecosystem/action-regex-match@v2
id: refactor-match
if: ${{ steps.feature-match.outputs.match == '' }}
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[refactor\]( #\d+(, #\d+)*)?: .+$'
# - name: Add Refactor label
# uses: actions-ecosystem/action-add-labels@v1
# if: ${{ steps.refactor-match.outputs.match != '' }}
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Refactor

- name: Fix
uses: actions-ecosystem/action-regex-match@v2
id: fix-match
if: ${{ steps.refactor-match.outputs.match == '' }}
with:
text: ${{ github.event.pull_request.title }}
regex: '\[fix\] #\d+(, #\d+)*: .+$'
# - name: Add fix label
# uses: actions-ecosystem/action-add-labels@v1
# if: ${{ steps.fix-match.outputs.match != '' }}
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Bug

- name: Documentation
uses: actions-ecosystem/action-regex-match@v2
id: docs-match
if: ${{ steps.feature-match.outputs.match == '' }}
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[documentation\]( #\d+(, #\d+)*)?: .+$'
# - name: Add Documentation label
# uses: actions-ecosystem/action-add-labels@v1
# if: ${{ steps.docs-match.outputs.match != '' }}
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# Documentation

- name: CI
uses: actions-ecosystem/action-regex-match@v2
id: ci-match
if: ${{ steps.feature-match.outputs.match == '' }}
with:
text: ${{ github.event.pull_request.title }}
regex: '^\[ci\]( #\d+(, #\d+)*)?: .+$'
# - name: Add CI label
# uses: actions-ecosystem/action-add-labels@v1
# if: ${{ steps.ci-match.outputs.match != '' }}
# continue-on-error: true
# with:
# github_token: ${{ secrets.github_token }}
# labels: |
# CI

- name: None of the above
if: ${{ steps.fix-match.outputs.match == '' && steps.refactor-match.outputs.match == '' && steps.feature-match.outputs.match == '' && steps.docs-match.outputs.match == '' && steps.ci-match.outputs.match == '' }}
run: exit 1
3 changes: 1 addition & 2 deletions .github/workflows/iroha2-dev-pr-unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ env:
jobs:
test:
runs-on: ubuntu-latest
#container: rust:1.56-buster
container:
image: 7272721/i2-ci:latest
timeout-minutes: 60
Expand All @@ -30,4 +29,4 @@ jobs:
restore-keys: |
iroha2-rust-test
- name: Run tests
run: cargo test -p iroha_client --tests unstable_network
run: cargo test -p iroha_client --tests unstable_network --quiet
10 changes: 4 additions & 6 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ env:
jobs:
test:
runs-on: ubuntu-latest
#container: rust:1.56-buster
container:
image: 7272721/i2-ci:latest
timeout-minutes: 60
Expand All @@ -30,16 +29,16 @@ jobs:
restore-keys: |
iroha2-rust-test
- name: Run tests
run: mold -run cargo test --workspace --no-fail-fast -- --skip unstable_network --test-threads 2
run: mold -run cargo test --quiet --workspace --no-fail-fast -- --skip unstable_network --test-threads 2
env:
RUSTC_BOOTSTRAP: 1
- name: Run iroha tests with network mock
run: mold -run cargo test --features mock -- --ignored --skip unstable_network --test-threads 2
run: mold -run cargo test --quiet --features mock -- --ignored --skip unstable_network --test-threads 2
env:
RUSTC_BOOTSTRAP: 1
working-directory: core/test_network
- name: Run iroha_actor deadlock detection tests
run: mold -run cargo test --features deadlock_detection -- --skip unstable_network --test-threads 2
run: mold -run cargo test --quiet --features deadlock_detection -- --skip unstable_network --test-threads 2
if: always()
env:
RUSTC_BOOTSTRAP: 1
Expand All @@ -50,7 +49,6 @@ jobs:
# 2 Coverage bot can have results from `iroha2-dev` to report coverage changes.
coverage:
runs-on: ubuntu-latest
#container: rust:1.56-buster
container:
image: 7272721/i2-ci:latest
steps:
Expand All @@ -64,7 +62,7 @@ jobs:
restore-keys: |
iroha2-rust-test-coverage
- name: Run tests
run: mold -run cargo test --workspace --no-fail-fast -- --skip unstable_network --test-threads 2 || true
run: mold -run cargo test --quiet --workspace --no-fail-fast -- --skip unstable_network --test-threads 2 || true
env:
RUSTFLAGS: "-Zinstrument-coverage"
RUSTC_BOOTSTRAP: 1
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/iroha2-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest
# container: rust:1.56-buster
container:
image: 7272721/i2-ci:latest
steps:
Expand Down Expand Up @@ -58,6 +57,22 @@ jobs:
PROFILE=--release
BIN=iroha_crypto_cli

build-ci-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push Docker container
uses: docker/build-push-action@v2
with:
file: Dockerfile.ci
tags: hyperledger/ci-iroha2:latest
push: true

archive-and-publish-schema:
runs-on: ubuntu-latest
container: rust:1.56-buster
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/iroha2-push-ci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.56.0
RUST_VERSION=1.57.0



Expand Down Expand Up @@ -50,7 +50,7 @@ RUN git clone https://github.com/rui314/mold.git; \
rm -rf "./mold"

RUN rustup component add llvm-tools-preview clippy; \
rustup install --profile default nightly-2021-10-22; \
rustup install --profile default nightly-2021-12-02; \
cargo install cargo-lints grcov

RUN curl -fsSL https://get.docker.com -o get-docker.sh; \
Expand Down
2 changes: 1 addition & 1 deletion actor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ thiserror = "1.0.28"
petgraph = { version = "0.5", optional = true }

[dev-dependencies]
trybuild = "1"
trybuild = "1.0.53"
6 changes: 4 additions & 2 deletions actor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//!
//! Iroha simple actor framework.
//!
#![allow(clippy::same_name_method)]
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll keep it for the time being, if you ran cargo clippy -- -W clippy::same_name_method, it would exclude this file, but keep highlighting others.


#[cfg(feature = "deadlock_detection")]
use std::any::type_name;
Expand Down Expand Up @@ -128,8 +127,10 @@ impl<A: Actor> Addr<A> {
}

/// Send a message and wait for an answer.
///
/// # Errors
/// Fails if no one will send message
///
/// # Panics
/// If queue is full
pub async fn send<M>(&self, message: M) -> Result<M::Result, Error>
Expand All @@ -149,6 +150,7 @@ impl<A: Actor> Addr<A> {
}

/// Send a message without waiting for an answer.
///
/// # Errors
/// Fails if queue is full or actor is disconnected
pub async fn do_send<M>(&self, message: M)
Expand Down
20 changes: 12 additions & 8 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ impl Client {
.send(EventListenerInitialized)
.wrap_err("Failed to send through init channel.")?;
for event in event_iterator.flatten() {
if let Event::Pipeline(event) = event {
match event.status {
if let Event::Pipeline(this_event) = event {
match this_event.status {
PipelineStatus::Validating => {}
PipelineStatus::Rejected(reason) => event_sender
.send(Err(reason))
Expand Down Expand Up @@ -544,9 +544,10 @@ impl EventIterator {
))?;
loop {
match stream.read_message() {
Ok(WebSocketMessage::Binary(message)) => {
Ok(WebSocketMessage::Binary(this_message)) => {
if let EventSocketMessage::SubscriptionAccepted =
VersionedEventSocketMessage::decode_versioned(&message)?.into_inner_v1()
VersionedEventSocketMessage::decode_versioned(&this_message)?
.into_inner_v1()
{
break;
}
Expand Down Expand Up @@ -577,17 +578,20 @@ impl Iterator for EventIterator {
};
let event = match event_socket_message {
EventSocketMessage::Event(event) => event,
message => return Some(Err(eyre!("Expected Event but got {:?}", message))),
msg => return Some(Err(eyre!("Expected Event but got {:?}", msg))),
appetrosyan marked this conversation as resolved.
Show resolved Hide resolved
};
let message =
let versioned_message =
match VersionedEventSocketMessage::from(EventSocketMessage::EventReceived)
.encode_versioned()
.wrap_err("Failed to serialize receipt.")
{
Ok(message) => message,
Ok(msg) => msg,
Err(e) => return Some(Err(e)),
};
return match self.stream.write_message(WebSocketMessage::Binary(message)) {
return match self
.stream
.write_message(WebSocketMessage::Binary(versioned_message))
{
Ok(_) => Some(Ok(event)),
Err(err) => Some(Err(eyre!("Failed to send receipt: {}", err))),
};
Expand Down
11 changes: 5 additions & 6 deletions client/src/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ pub fn web_socket_connect<U>(uri: U, headers: Headers) -> Result<WebSocketStream
where
U: AsRef<str>,
{
#[allow(clippy::string_add)]
let uri = if let Some(uri) = uri.as_ref().strip_prefix("https://") {
"wss://".to_owned() + uri
} else if let Some(uri) = uri.as_ref().strip_prefix("http://") {
"ws://".to_owned() + uri
let ws_uri = if let Some(https_uri) = uri.as_ref().strip_prefix("https://") {
"wss://".to_owned() + https_uri
} else if let Some(http_uri) = uri.as_ref().strip_prefix("http://") {
"ws://".to_owned() + http_uri
} else {
return Err(eyre!("No schema in web socket uri provided"));
};

let req = http::Request::builder()
.uri(uri)
.uri(ws_uri)
.set_headers(headers)
.wrap_err("Failed to build web socket request")?
.body(())
Expand Down
2 changes: 1 addition & 1 deletion client/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod tests;
mod integration_tests;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading