Skip to content

Commit

Permalink
Merge pull request #11 from Zondax/refactor/github_actions
Browse files Browse the repository at this point in the history
Move CI to Github Actions
  • Loading branch information
jleni authored Mar 21, 2022
2 parents 81aef11 + b3ddf77 commit 0df8ff4
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 74 deletions.
66 changes: 0 additions & 66 deletions .circleci/config.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "Main workflow"
on:
- push

jobs:
configure:
runs-on: ubuntu-latest
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"

lint:
runs-on: ubuntu-latest
container:
image: zondax/rust-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- run: sudo apt-get install -y libudev-dev libusb-1.0-0-dev
- name: show versions
run: |
rustup show
- name: rustfmt
run: |
cargo fmt --version
cargo fmt -- --check
- name: rust cache
uses: Swatinem/rust-cache@v1
with:
# setup sharedKey to share cache with other jobs
sharedKey: ${{ github.run_id }}-${{ github.run_attempt }}

- name: clippy
run: |
cargo clippy --version
cargo clippy --all-features
tests:
runs-on: ubuntu-latest
container:
image: zondax/rust-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Rust Dependency Cache
uses: Swatinem/rust-cache@v1
with:
# setup sharedKey to share cache with other jobs
sharedKey: ${{ github.run_id }}-${{ github.run_attempt }}

- run: sudo apt-get install -y libudev-dev libusb-1.0.0-dev
- name: test --all-features
run: |
#with --lib we only test the unit tests
cargo test --lib --all-features
24 changes: 24 additions & 0 deletions .github/workflows/rust_audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Security audit

on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'

jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- run: cargo audit

# disabled until we can change directory
# see https://github.com/actions-rs/audit-check/issues/194
# - name: Run audit
# uses: actions-rs/audit-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/rust_periodic_audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Scheduled security audit

on:
schedule:
# run everyday at midnight
- cron: '0 0 * * *'

jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- run: cargo audit

# disabled until we can change directory
# see https://github.com/actions-rs/audit-check/issues/194
# - name: Run audit
# uses: actions-rs/audit-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ keywords = ["ledger", "nano", "apdu", "filecoin"]
edition = "2018"
autobenches = false

[badges]
circle-ci = { repository = "zondax/ledger-filecoin-rs" }

[lib]
name = "ledger_filecoin"

Expand Down
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern crate ledger;
extern crate quick_error;
extern crate secp256k1;

use self::ledger::{ApduAnswer, ApduCommand};
use self::ledger::ApduCommand;
use self::params::{APDUErrors, PayloadType};
use crate::params::{
CLA, INS_GET_ADDR_SECP256K1, INS_GET_VERSION, INS_SIGN_SECP256K1, USER_MESSAGE_CHUNK_SIZE,
Expand Down Expand Up @@ -255,7 +255,7 @@ impl FilecoinApp {

/// Sign a transaction
pub fn sign(&self, path: &BIP44Path, message: &[u8]) -> Result<Signature, Error> {
let bip44path = serialize_bip44(&path)?;
let bip44path = serialize_bip44(path)?;
let chunks = message.chunks(USER_MESSAGE_CHUNK_SIZE);

if chunks.len() > 255 {
Expand All @@ -267,7 +267,6 @@ impl FilecoinApp {
}

let packet_count = chunks.len() as u8;
let mut response: ApduAnswer;

let _command = ApduCommand {
cla: CLA,
Expand All @@ -278,7 +277,7 @@ impl FilecoinApp {
data: bip44path,
};

response = self.app.exchange(_command)?;
let mut response = self.app.exchange(_command)?;

// Send message chunks
for (packet_idx, chunk) in chunks.enumerate() {
Expand Down
1 change: 0 additions & 1 deletion src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#![deny(warnings, trivial_casts, trivial_numeric_casts)]
#![deny(unused_import_braces, unused_qualifications)]
#![deny(missing_docs)]
#![doc(html_root_url = "https://docs.rs/ledger-filecoin/0.1.0")]

pub const CLA: u8 = 0x06;
pub const INS_GET_VERSION: u8 = 0x00;
Expand Down

0 comments on commit 0df8ff4

Please sign in to comment.