-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from holochain/2019-06-27-bump-nightly
wip on nix + circle
- Loading branch information
Showing
7 changed files
with
62 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: 2 | ||
|
||
jobs: | ||
build: | ||
docker: | ||
- image: holochain/holochain-rust:circle.01.warm.nix | ||
steps: | ||
- checkout | ||
- run: nix-shell --run hcs-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
Cargo.lock | ||
target | ||
.cargo | ||
**/*.rs.bk | ||
|
||
# Environment Cruft | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,12 @@ | ||
.PHONY: all test fmt clean tools tool_rust tool_fmt | ||
|
||
RUSTFLAGS += -D warnings | ||
|
||
SHELL = /usr/bin/env sh | ||
RUST_VER_WANT = "rustc 1.33.0-nightly (19f8958f8 2019-01-23)" | ||
RUST_TAG_WANT = "nightly-2019-01-24" | ||
FMT_VER_WANT = "rustfmt 1.0.1-nightly (be13559 2018-12-10)" | ||
CLP_VER_WANT = "clippy 0.0.212 (280069d 2019-01-22)" | ||
.PHONY: all test fmt clean | ||
|
||
all: test | ||
|
||
test: tools | ||
RUSTFLAGS='$(RUSTFLAGS)' cargo fmt -- --check | ||
RUSTFLAGS='$(RUSTFLAGS)' cargo clippy -- \ | ||
-A clippy::nursery -A clippy::style -A clippy::cargo \ | ||
-A clippy::pedantic -A clippy::restriction \ | ||
-D clippy::complexity -D clippy::perf -D clippy::correctness | ||
RUSTFLAGS='$(RUSTFLAGS)' RUST_BACKTRACE=1 cargo test | ||
test: | ||
nix-shell --run hcs-test | ||
|
||
fmt: tools | ||
cargo fmt | ||
fmt: | ||
nix-shell --run hn-rust-fmt | ||
|
||
clean: | ||
rm -rf target | ||
|
||
tools: tool_rust tool_fmt tool_clippy | ||
|
||
tool_rust: | ||
@if [ "$$(rustc --version 2>/dev/null || true)" != ${RUST_VER_WANT} ]; \ | ||
then \ | ||
echo "# Makefile # incorrect rust toolchain version"; \ | ||
echo "# Makefile # want:" ${RUST_VER_WANT}; \ | ||
if rustup --version >/dev/null 2>&1; then \ | ||
echo "# Makefile # found rustup, setting override"; \ | ||
rustup override set ${RUST_TAG_WANT}; \ | ||
else \ | ||
echo "# Makefile # rustup not found, cannot install toolchain"; \ | ||
exit 1; \ | ||
fi \ | ||
else \ | ||
echo "# Makefile # rust toolchain ok:" ${RUST_VER_WANT}; \ | ||
fi; | ||
|
||
tool_fmt: tool_rust | ||
@if [ "$$(cargo fmt --version 2>/dev/null || true)" != ${FMT_VER_WANT} ]; \ | ||
then \ | ||
if rustup --version >/dev/null 2>&1; then \ | ||
echo "# Makefile # installing rustfmt with rustup"; \ | ||
rustup component add rustfmt-preview; \ | ||
else \ | ||
echo "# Makefile # rustup not found, cannot install rustfmt"; \ | ||
exit 1; \ | ||
fi; \ | ||
else \ | ||
echo "# Makefile # rustfmt ok:" ${FMT_VER_WANT}; \ | ||
fi; | ||
|
||
tool_clippy: tool_rust | ||
@if [ "$$(cargo clippy --version 2>/dev/null || true)" != ${CLP_VER_WANT} ]; \ | ||
then \ | ||
if rustup --version >/dev/null 2>&1; then \ | ||
echo "# Makefile # installing clippy with rustup"; \ | ||
rustup component add clippy-preview; \ | ||
else \ | ||
echo "# Makefile # rustup not found, cannot install rustfmt"; \ | ||
exit 1; \ | ||
fi; \ | ||
else \ | ||
echo "# Makefile # clippy ok:" ${CLP_VER_WANT}; \ | ||
fi; | ||
nix-shell --run hn-flush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
let | ||
holonix-release-tag = "0.0.4"; | ||
holonix-release-sha256 = "04xbhr0w0fc911vjd4f42shmy3vlnvwpicjnsk0q8gr4prkpz74h"; | ||
|
||
holonix = import (fetchTarball { | ||
url = "https://github.com/holochain/holonix/tarball/${holonix-release-tag}"; | ||
sha256 = "${holonix-release-sha256}"; | ||
}); | ||
# uncomment to work locally | ||
# holonix = import ../holonix; | ||
in | ||
with holonix.pkgs; | ||
{ | ||
core-shell = stdenv.mkDerivation (holonix.shell // { | ||
name = "holochain-serialization-shell"; | ||
|
||
buildInputs = [] | ||
++ holonix.shell.buildInputs | ||
++ (holonix.pkgs.callPackage ./test { | ||
pkgs = holonix.pkgs; | ||
}).buildInputs | ||
; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ pkgs }: | ||
let | ||
name = "hcs-test"; | ||
|
||
script = pkgs.writeShellScriptBin name | ||
'' | ||
RUST_BACKTRACE=1 \ | ||
hn-rust-fmt-check \ | ||
&& hn-rust-clippy \ | ||
&& cargo test | ||
''; | ||
in | ||
{ | ||
buildInputs = [ script ]; | ||
} |