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

Add CircleCI support #45

Merged
merged 1 commit into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
129 changes: 129 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
version: 2.1

executors:
docker:
docker:
- image: &image saschagrunert/build-rust
machine:
machine:
docker_layer_caching: true
image: ubuntu-1604:201903-01

workflows:
version: 2
pipeline:
jobs:
- build
- doc
- doc-publish:
requires:
- doc
filters:
branches:
only: master
- rustfmt
- clippy
- test
jobs:
build:
executor: docker
steps:
- checkout
- run:
name: Version information
command: |
rustc --version
rustup --version
cargo --version
- restore_cache:
keys:
- build-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Build all targets
command: make
- save_cache:
key: build-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- /root/.cargo/registry
- target
doc:
executor: docker
steps:
- checkout
- restore_cache:
keys:
- doc-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Build documentation
command: make build-doc
- save_cache:
key: doc-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- /root/.cargo/registry
- target
- persist_to_workspace:
root: .
paths:
- target/doc
doc-publish:
executor: docker
steps:
- add_ssh_keys:
fingerprints:
- a6:4d:19:3c:a5:49:6b:f6:7a:fc:8b:b0:09:a5:45:ac
- checkout
- run:
name: Setup git
command: |
git config --global user.email mail@saschagrunert.de
git config --global user.name "CircleCI"
- attach_workspace:
at: .
- run:
name: Deploy documentation
command: |
git fetch origin gh-pages
git checkout -f gh-pages
rm -rf doc
mv target/doc .
git add .
git diff-index --quiet HEAD || git commit -m 'Update documentation'
git push -f origin gh-pages
rustfmt:
executor: docker
steps:
- checkout
- run:
name: Rust-Format
command: make lint-rustfmt
clippy:
executor: docker
steps:
- checkout
- restore_cache:
keys:
- clippy-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Clippy
command: make lint-clippy
- save_cache:
key: clippy-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
paths:
- /root/.cargo/registry
- target
test:
executor: machine
steps:
- checkout
- run:
name: Run tests
environment:
IMAGE: *image
command: |
docker pull $IMAGE
docker run --security-opt seccomp=unconfined \
-v $(pwd):/build -w /build -e CODECOV_TOKEN $IMAGE \
bash -c "\
make coverage && \
bash <(curl -s https://codecov.io/bash)"
20 changes: 20 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
codecov:
notify:
after_n_builds: 1
require_ci_to_pass: false

coverage:
precision: 1
round: down
range: 50..75

status:
project: true
patch: false
changes: false

comment:
layout: "header, diff"
behavior: default
require_changes: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Cargo
# will have compiled files and executables
/target/
Cargo.lock

# swap
[._]*.s[a-w][a-z]
Expand Down
65 changes: 65 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
max_width = 100
hard_tabs = false
tab_spaces = 4
newline_style = "Auto"
use_small_heuristics = "Default"
indent_style = "Block"
wrap_comments = false
format_doc_comments = false
comment_width = 80
normalize_comments = false
normalize_doc_attributes = false
license_template_path = ""
format_strings = false
format_macro_matchers = false
format_macro_bodies = true
empty_item_single_line = true
struct_lit_single_line = true
fn_single_line = false
where_single_line = false
imports_indent = "Block"
imports_layout = "Mixed"
merge_imports = false
reorder_imports = true
reorder_modules = true
reorder_impl_items = false
type_punctuation_density = "Wide"
space_before_colon = false
space_after_colon = true
spaces_around_ranges = false
binop_separator = "Front"
remove_nested_parens = true
combine_control_expr = true
overflow_delimited_expr = false
struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = false
fn_args_density = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = true
trailing_comma = "Vertical"
match_block_trailing_comma = false
blank_lines_upper_bound = 1
blank_lines_lower_bound = 0
edition = "2018"
version = "One"
merge_derives = true
use_try_shorthand = true
use_field_init_shorthand = true
force_explicit_abi = true
condense_wildcard_suffixes = false
color = "Auto"
required_version = "1.0.3"
unstable_features = false
disable_all_formatting = false
skip_children = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
report_todo = "Never"
report_fixme = "Never"
ignore = []
emit_mode = "Files"
make_backup = false
50 changes: 5 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,19 @@
---
dist: trusty
language: rust
os:
- linux
- osx
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
before_install:
- >
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
curl https://bootstrap.pypa.io/get-pip.py | sudo python
fi

before_script:
- pip install 'travis-cargo<0.2' --user --verbose
- export PATH=$HOME/.local/bin:$PATH
- export PATH=$HOME/Library/Python/2.7/bin:$PATH
- cargo install cargo-kcov

script:
- export CARGO_TARGET_DIR=`pwd`/target
- travis-cargo build -- --no-default-features
- travis-cargo build -- --features="par_iter"
- travis-cargo test -- --features="par_iter"
- cargo doc --no-deps

after_success:
- if [[ "$TRAVIS_RUST_VERSION" == "stable" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then travis-cargo doc-upload; fi
- if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cargo kcov --print-install-kcov-sh | sh; fi
- if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cargo kcov --coveralls --kcov ./kcov-33/build/src/kcov; fi

- cargo test --features="par_iter"
- cargo test --no-default-features
notifications:
email:
on_success: never
os:
- linux
- osx
addons:
apt:
sources:
- kalakris-cmake
packages:
- cmake
- libcurl4-openssl-dev
- libiberty-dev
- libelf-dev
- libdw-dev
- binutils-dev
- libpcap-dev
- bison
env:
global:
- TRAVIS_CARGO_NIGHTLY_FEATURE=""
- secure: WC9zSfV0u90iqsZD5477le2r7f0PwPEXQffN2fVbiV1kOWYZa7czyMeLQdCadfROf9K5SMgDBvRdB+FEyVWDMsatp5hIfeLyxug/xrktP7onzcWIImX+zFXV/Z+RDWOH+ojDsgmtR9PmP+k1+8DAq+w7d2e9uWkrVXhuY2xwvoUi0Ry3Ilw3Kji4EkzAV+sTCHV0wYM95Q1OOeYgIxf69Az73DqC6H254lud+EHculiBKaT+rnLvTdWJKP97xLuZ9p7wB368D3I4LGSQvtuGFynO+FRhjPbWKljeu6D1Q/Zj/CzX8Us0OXY0z4oGPsJTfLeSEJsIwTPFnqCyzmMBkpV4GC63Prso8pYmSe9a+226OAtLTyhWTWuHpw78BO23lsSLHpRIpHleNeMJhdAirEld7OWV3R3gYSNfuYKEQ6moQfpLdpWQbAddmE5qDsp9T5WIeFRu+aUPR45h6H4ma3w0txGiNSJKKzopIolnI3TZoI05B+dOGYoxPAhx5r1adDsqhZiXMgAni/NmUAN+nY19qBOLGQKhrqdqzRyz9QeNUiirPiL1ezyKQazTqjuubsgrbGk3hz9nyFrVgfEGbacYL6wCRzZuoOhBjcSePhymUXjSI+7PB5Ew4GfFNi5Jqxx47/Ba+uM5Gk8CTft/CjQ6jBOH2YxZeVHmwXKbaNI=