From 674fba52820d60f4d2244730a8f30f233ee1cd91 Mon Sep 17 00:00:00 2001
From: noot <36753753+noot@users.noreply.github.com>
Date: Mon, 6 Dec 2021 14:38:03 -0500
Subject: [PATCH] ci: add gh actions workflows (#1317)
---
.github/workflows/docs.yml | 19 +++
.github/workflows/msrv.yml | 148 +++++++++++++++++++
blockchain/blocks/src/election_proof.rs | 4 +-
blockchain/blocks/src/ticket.rs | 2 +-
crypto/src/signature.rs | 4 +-
ipld/amt/src/node.rs | 2 +-
ipld/amt/src/value_mut.rs | 2 +-
ipld/cid/src/json.rs | 2 +-
ipld/src/json.rs | 2 +-
node/forest_libp2p/src/service.rs | 2 +
vm/interpreter/src/gas_tracker/price_list.rs | 12 +-
vm/message/src/message_receipt.rs | 4 +-
12 files changed, 183 insertions(+), 20 deletions(-)
create mode 100644 .github/workflows/docs.yml
create mode 100644 .github/workflows/msrv.yml
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000000..2d9d2e3c17ec
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,19 @@
+name: Publish docs
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ publish-docs:
+ name: publish docs
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ - run: |
+ cargo install mdbook
+ mdbook build ./documentation
+ bash ./scripts/build-rust-docs.sh
\ No newline at end of file
diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml
new file mode 100644
index 000000000000..664d46e98c59
--- /dev/null
+++ b/.github/workflows/msrv.yml
@@ -0,0 +1,148 @@
+on: [pull_request]
+
+name: msrv
+
+jobs:
+ check:
+ name: check
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ rust:
+ - stable
+ - 1.57.0
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+
+ - name: Run cargo check
+ uses: actions-rs/cargo@v1
+ with:
+ command: check
+
+ test:
+ name: unit tests
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ rust:
+ - stable
+ - 1.57.0
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+
+ - name: Run cargo test
+ run: make test
+
+ fmt:
+ name: fmt
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ rust:
+ - stable
+ - 1.57.0
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+
+ - name: check license
+ run: make license
+
+ - name: Install rustfmt
+ run: rustup component add rustfmt
+
+ - name: Run cargo fmt
+ uses: actions-rs/cargo@v1
+ with:
+ command: fmt
+ args: --all -- --check
+
+ clippy:
+ name: clippy
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ rust:
+ - stable
+ - 1.57.0
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+
+ - name: Install clippy
+ run: rustup component add clippy
+
+ - name: Run cargo clippy
+ uses: actions-rs/cargo@v1
+ with:
+ command: clippy
+ args: -- -D warnings
+
+
+ test-vectors:
+ name: test-vectors
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ rust:
+ - stable
+ - 1.57.0
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+ - name: build
+ run: |
+ git submodule update --init
+ make run-vectors
+
+ audit:
+ name: cargo audit
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ rust:
+ - stable
+ - 1.57.0
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v2
+ - name: Install toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: ${{ matrix.rust }}
+ override: true
+ - name: build
+ run: |
+ cargo install cargo-audit
+ cargo audit --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071
\ No newline at end of file
diff --git a/blockchain/blocks/src/election_proof.rs b/blockchain/blocks/src/election_proof.rs
index 31bae10d640f..b13843e37df6 100644
--- a/blockchain/blocks/src/election_proof.rs
+++ b/blockchain/blocks/src/election_proof.rs
@@ -228,9 +228,7 @@ pub mod json {
where
S: Serializer,
{
- v.as_ref()
- .map(|s| ElectionProofJsonRef(s))
- .serialize(serializer)
+ v.as_ref().map(ElectionProofJsonRef).serialize(serializer)
}
pub fn deserialize<'de, D>(deserializer: D) -> Result