Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Nov 14, 2019
1 parent 1137245 commit 6a21e96
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 30 deletions.
115 changes: 108 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,126 @@
on: [push]
on: [pull_request]

name: Code Coverage
name: Rust checks

jobs:
lint:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v1

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast
env:
'CARGO_INCREMENTAL': '0'
'RUSTFLAGS': '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
- uses: actions-rs/grcov@v0.1.4
- uses: codecov/codecov-action@v1.0.3

- name: Collect coverage and generate report with grcov
uses: actions-rs/grcov@v0.1.4
id: coverage

- name: Upload coverage to codecov
uses: codecov/codecov-action@v1.0.3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: lcov.info
file: ${{ steps.coverage.outputs.report }}

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v1

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

wasm-pack:
name: Check if wasm-pack builds a valid package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: install
args: --force wasm-pack
- name: run wasm-pack
run: wasm-pack build

wasm32-wasi:
name: Run tests under wasm32-wasi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install wasm32-wasi target
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-wasi
- name: Install wasmtime
run: "curl https://wasmtime.dev/install.sh -sSf | bash"
- name: Add wasmtime to PATH
run: echo "::add-path::$HOME/.wasmtime/bin"
- name: Install cargo-wasi command
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-wasi
- name: Build code with cargo-wasi
uses: actions-rs/cargo@v1
with:
command: wasi
args: build
- name: Run tests under wasm32-wasi
uses: actions-rs/cargo@v1
continue-on-error: true ## TODO: remove this when tests work...
with:
command: wasi
args: test
20 changes: 0 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,6 @@ jobs:
python: 3.6
- <<: *test
python: 3.5
- <<: *test
name: wasm-pack
language: rust
rust: stable
before_script: skip
install: skip
script:
- rustup target add wasm32-unknown-unknown
- cargo install --force wasm-pack
- wasm-pack build
- <<: *test
name: wasi target
language: rust
rust: stable
before_script: skip
install: skip
script:
- rustup target add wasm32-wasi
- cargo install --force cargo-wasi
- cargo wasi build

- &wheel
stage: build wheel and send to github releases
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ categories = ["science", "algorithms", "data-structures"]
license = "BSD-3-Clause"
edition = "2018"
default-run = "smrs"
autoexamples = false

[lib]
name = "sourmash"
Expand Down Expand Up @@ -71,8 +72,10 @@ default-features = false
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.mqf]
version = "1.0.0"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.proptest]
version = "^0.8"

[dev-dependencies]
proptest = "^0.8"
criterion = "^0.2"
rand = "^0.5"
tempfile = "3"
Expand Down
5 changes: 3 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use failure::{Error, Fail};
use failure::Fail;

#[derive(Debug, Fail)]
pub enum SourmashError {
Expand Down Expand Up @@ -64,8 +64,9 @@ pub enum SourmashErrorCode {
SerdeError = 100_004,
}

#[cfg(not(all(target_arch = "wasm32", target_vendor = "unknown")))]
impl SourmashErrorCode {
pub fn from_error(error: &Error) -> SourmashErrorCode {
pub fn from_error(error: &failure::Error) -> SourmashErrorCode {
for cause in error.iter_chain() {
use crate::ffi::utils::Panic;
if cause.downcast_ref::<Panic>().is_some() {
Expand Down
5 changes: 5 additions & 0 deletions src/sketch/nodegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,12 @@ impl Nodegraph {
#[cfg(test)]
mod test {
use super::*;
use cfg_if::cfg_if;
use std::io::{BufReader, BufWriter};
use std::path::PathBuf;

cfg_if! {
if #[cfg(not(target_arch = "wasm32"))] {
use proptest::num::u64;
use proptest::{proptest, proptest_helper};

Expand All @@ -249,6 +252,8 @@ mod test {
assert_eq!(ng.get(hash), 1);
}
}
}
}

#[test]
fn count_and_get_nodegraph() {
Expand Down

0 comments on commit 6a21e96

Please sign in to comment.