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

Transitioning to CircleCI and running latest clippy and rustfmt #107

Merged
merged 2 commits into from
Jan 10, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

build: &build
docker:
- image: majorz/rust-$CIRCLE_JOB:rust-1.23.0
steps:
- checkout
- run: cargo build

version: 2

jobs:
aarch64:
<<: *build
rpi:
<<: *build
armv7hf:
<<: *build
i386:
<<: *build
amd64:
<<: *build
test:
docker:
- image: majorz/rust-test-deploy:rust-nightly-2018-01-08

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a good idea to pin this to a single nightly version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea is to bump the nightly version in this place once new image version is published. The commit will go hand in hand with the needed clippy and rustfmt updates. This will solve the problem we often have where a new PR is created and it gets blocked by the fact that clippy has a new version and the build does not pass because of it. So a second PR has to be created, then a rebase is needed, etc. I think it is better to manually bump it up once in a while on Rust stable releases and important clippy versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, one important note is that the Rust nightly version is the one that the clippy version from the image targets, e.g.:
https://github.com/rust-lang-nursery/rust-clippy/blob/master/CHANGELOG.md#00178
https://github.com/resin-io-projects/rust-cross-toolchains/blob/d1b0c745b8762d3bc0b42d116510cabc80a02693/.circleci/config.yml#L47

Sometimes with the current approach of using latest nightly + latest clippy, latest clippy does not compile with latest nightly, so the PR gets blocked awaiting for a new clippy release.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

steps:
- checkout
- run: cargo fmt -- --write-mode=diff
- run: cargo clippy -- -D warnings

workflows:
version: 2
test:
jobs:
- test
build:
jobs:
- aarch64
- rpi
- armv7hf
- i386
- amd64
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
28 changes: 4 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
dist: trusty
sudo: required
language: rust
cache: cargo
rust:
- nightly
- beta
- stable
before_install:
- sudo apt-get -qq update
- sudo apt-get install -yq --no-install-recommends libdbus-1-dev
install:
- type -p cargo-install-update || cargo install cargo-update
- cargo install-update -i cargo-update
- cargo install-update -i rustfmt
- if [ $TRAVIS_RUST_VERSION == nightly ]; then
cargo install-update -i clippy;
fi
script:
- cargo fmt -- --write-mode=diff
- if [ $TRAVIS_RUST_VERSION == nightly ]; then
cargo clippy -- -D warnings;
fi
- cargo build
language: generic
script: printf 'empty'
notifications:
email: false
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

## v0.8.3 - 2018-01-10

* Transitioning to CircleCI and running latest clippy and rustfmt #107 [majorz]

## v0.8.2 - 2017-10-20

* Do not include clippy as an optional dependency #100 [majorz]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "network-manager"
version = "0.8.2"
version = "0.8.3"
authors = ["Joseph Roberts <joe@resin.io>", "Zahari Petkov <zahari@resin.io>"]
description = "Rust NetworkManager bindings"
homepage = "https://github.com/resin-io-modules/network-manager"
Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
network-manager
==============
===============

[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/resin-io-modules/NetworkManager/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/resin-io-modules/network-manager.svg?branch=master)](https://travis-ci.org/resin-io-modules/network-manager)
> Rust NetworkManager bindings

[![Current Release](https://img.shields.io/github/release/resin-io-modules/network-manager.svg?style=flat-square)](https://github.com/resin-io-modules/network-manager/releases/latest)
[![CircleCI status](https://img.shields.io/circleci/project/github/resin-io-modules/network-manager.svg?style=flat-square)](https://circleci.com/gh/resin-io-modules/network-manager)
[![License](https://img.shields.io/github/license/resin-io-modules/network-manager.svg?style=flat-square)](https://github.com/resin-io-modules/network-manager/blob/master/LICENSE)
[![Issues](https://img.shields.io/github/issues/resin-io-modules/network-manager.svg?style=flat-square)](https://github.com/resin-io-modules/network-manager/issues)

<div align="center">
<sub>an open source :satellite: project by <a href="https://resin.io">resin.io</a></sub>
</div>

***

Support
-------

If you're having any problem, please [raise an issue](https://github.com/resin-io-modules/network-manager/issues/new) on GitHub or [contact us](https://resin.io/community/), and the resin.io team will be happy to help.

***

License
-------

network-manager is free software, and may be redistributed under the terms specified in
the [license](https://github.com/resin-io-modules/network-manager/blob/master/LICENSE).
3 changes: 1 addition & 2 deletions examples/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ extern crate network_manager;
use std::env;
use std::process;

use network_manager::{NetworkManager, DeviceType};

use network_manager::{DeviceType, NetworkManager};

fn main() {
let args: Vec<String> = env::args().collect();
Expand Down
13 changes: 4 additions & 9 deletions examples/hotspot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ extern crate network_manager;
use std::env;
use std::process;

use network_manager::{NetworkManager, Device, DeviceType};

use network_manager::{Device, DeviceType, NetworkManager};

struct Options {
interface: Option<String>,
ssid: String,
password: Option<String>,
}


fn print_usage_and_exit() {
println!("USAGE: hotspot [-i INTERFACE] SSID [PASSWORD]");
process::exit(1);
}


fn parse_options() -> Options {
let args: Vec<String> = env::args().collect();

Expand Down Expand Up @@ -51,7 +48,6 @@ fn parse_options() -> Options {
}
}


fn find_device(manager: &NetworkManager, interface: Option<String>) -> Option<Device> {
if let Some(interface) = interface {
let device = manager.get_device_by_interface(&interface).unwrap();
Expand All @@ -64,9 +60,9 @@ fn find_device(manager: &NetworkManager, interface: Option<String>) -> Option<De
} else {
let devices = manager.get_devices().unwrap();

let index = devices.iter().position(
|d| *d.device_type() == DeviceType::WiFi,
);
let index = devices
.iter()
.position(|d| *d.device_type() == DeviceType::WiFi);

if let Some(index) = index {
Some(devices[index].clone())
Expand All @@ -76,7 +72,6 @@ fn find_device(manager: &NetworkManager, interface: Option<String>) -> Option<De
}
}


fn main() {
let Options {
interface,
Expand Down
9 changes: 0 additions & 9 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
array_layout = "Block"
chain_indent = "Block"
control_style = "Rfc"
fn_args_layout = "Block"
fn_args_paren_newline = false
fn_call_style = "Block"
fn_call_width = 80
match_block_trailing_comma = true
struct_lit_multiline_style = "ForceMulti"
struct_lit_style = "Block"
use_try_shorthand = true
Loading