Skip to content

Commit

Permalink
ci: add gh actions workflows (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
noot authored Dec 6, 2021
1 parent c7657b8 commit 674fba5
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 20 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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
148 changes: 148 additions & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions blockchain/blocks/src/election_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Option<ElectionProof>, D::Error>
Expand Down
2 changes: 1 addition & 1 deletion blockchain/blocks/src/ticket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub mod json {
where
S: Serializer,
{
v.as_ref().map(|s| TicketJsonRef(s)).serialize(serializer)
v.as_ref().map(TicketJsonRef).serialize(serializer)
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Ticket>, D::Error>
Expand Down
4 changes: 1 addition & 3 deletions crypto/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ pub mod json {
where
S: Serializer,
{
v.as_ref()
.map(|s| SignatureJsonRef(s))
.serialize(serializer)
v.as_ref().map(SignatureJsonRef).serialize(serializer)
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Signature>, D::Error>
Expand Down
2 changes: 1 addition & 1 deletion ipld/amt/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ where
let sub_i = i / nodes_for_height(bit_width, height);

match self {
Self::Leaf { vals } => Ok(vals.get_mut(i).map(|v| std::mem::take(v)).flatten()),
Self::Leaf { vals } => Ok(vals.get_mut(i).map(std::mem::take).flatten()),
Self::Link { links } => {
let (deleted, replace) = match &mut links[sub_i] {
Some(Link::Dirty(n)) => {
Expand Down
2 changes: 1 addition & 1 deletion ipld/amt/src/value_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ impl<V> Deref for ValueMut<'_, V> {
impl<V> DerefMut for ValueMut<'_, V> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.value_mutated = true;
&mut self.value
self.value
}
}
2 changes: 1 addition & 1 deletion ipld/cid/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub mod opt {
where
S: Serializer,
{
v.as_ref().map(|s| CidJsonRef(s)).serialize(serializer)
v.as_ref().map(CidJsonRef).serialize(serializer)
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Cid>, D::Error>
Expand Down
2 changes: 1 addition & 1 deletion ipld/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
serializer,
),
Ipld::List(list) => {
let wrapped = list.iter().map(|ipld| IpldJsonRef(ipld));
let wrapped = list.iter().map(IpldJsonRef);
serializer.collect_seq(wrapped)
}
Ipld::Map(map) => {
Expand Down
2 changes: 2 additions & 0 deletions node/forest_libp2p/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub const PUBSUB_MSG_STR: &str = "/fil/msgs";
const PUBSUB_TOPICS: [&str; 2] = [PUBSUB_BLOCK_STR, PUBSUB_MSG_STR];

/// Events emitted by this Service.
#[allow(clippy::large_enum_variant)]
#[derive(Debug)]
pub enum NetworkEvent {
PubsubMessage {
Expand All @@ -72,6 +73,7 @@ pub enum NetworkEvent {
}

/// Message types that can come over GossipSub
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone)]
pub enum PubsubMessage {
/// Messages that come over the block topic
Expand Down
12 changes: 6 additions & 6 deletions vm/interpreter/src/gas_tracker/price_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use vm::{MethodNum, TokenAmount, METHOD_SEND};

lazy_static! {
static ref BASE_PRICES: PriceList = PriceList {
compute_gas_multiplier: 1,
_compute_gas_multiplier: 1,
storage_gas_multiplier: 1000,

on_chain_message_compute_base: 38863,
Expand Down Expand Up @@ -44,7 +44,7 @@ lazy_static! {
compute_unsealed_sector_cid_base: 98647,
verify_seal_base: 2000, // TODO revisit potential removal of this

verify_aggregate_seal_base: 0,
_verify_aggregate_seal_base: 0,
verify_aggregate_seal_per: [
(
RegisteredSealProof::StackedDRG32GiBV1P1,
Expand Down Expand Up @@ -121,7 +121,7 @@ lazy_static! {
};

static ref CALICO_PRICES: PriceList = PriceList {
compute_gas_multiplier: 1,
_compute_gas_multiplier: 1,
storage_gas_multiplier: 1300,

on_chain_message_compute_base: 38863,
Expand Down Expand Up @@ -150,7 +150,7 @@ lazy_static! {
compute_unsealed_sector_cid_base: 98647,
verify_seal_base: 2000, // TODO revisit potential removal of this

verify_aggregate_seal_base: 0,
_verify_aggregate_seal_base: 0,
verify_aggregate_seal_per: [
(
RegisteredSealProof::StackedDRG32GiBV1P1,
Expand Down Expand Up @@ -264,7 +264,7 @@ pub struct PriceList {
/// Compute gas charge multiplier
// * This multiplier is not currently applied to anything, but is matching lotus.
// * If the possible values are non 1 or if Lotus adds, we should change also.
pub(crate) compute_gas_multiplier: i64,
pub(crate) _compute_gas_multiplier: i64,
/// Storage gas charge multiplier
pub(crate) storage_gas_multiplier: i64,

Expand Down Expand Up @@ -335,7 +335,7 @@ pub struct PriceList {

pub(crate) compute_unsealed_sector_cid_base: i64,
pub(crate) verify_seal_base: i64,
pub(crate) verify_aggregate_seal_base: i64,
pub(crate) _verify_aggregate_seal_base: i64,
pub(crate) verify_aggregate_seal_per: AHashMap<RegisteredSealProof, i64>,
pub(crate) verify_aggregate_seal_steps: AHashMap<RegisteredSealProof, StepCost>,

Expand Down
4 changes: 1 addition & 3 deletions vm/message/src/message_receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ pub mod json {
where
S: Serializer,
{
v.as_ref()
.map(|s| MessageReceiptJsonRef(s))
.serialize(serializer)
v.as_ref().map(MessageReceiptJsonRef).serialize(serializer)
}

pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<MessageReceipt>, D::Error>
Expand Down

0 comments on commit 674fba5

Please sign in to comment.