Merge pull request #211 from NixOS/bump-0.1.7

0.1.7 for the new result changes
This commit is contained in:
Daiderd Jordan 2018-08-08 18:40:27 +02:00 committed by GitHub
commit a7000b99bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 87 additions and 46 deletions

View file

@ -1,7 +1,9 @@
language: nix
matrix:
include:
- script:
- nix-shell --run checkPhase
- nix-shell --run checkPhase --arg useNix1 true
- nix-build -A ofborg.rs
- name: checkPhase - Nix 2
script: nix-shell --run checkPhase --arg useNix1 false
- name: checkPhase - Nix 1
script: nix-shell --run checkPhase --arg useNix1 true
- name: nix-build
script: nix-build -A ofborg.rs

View file

@ -23,9 +23,6 @@ in {
in pkgs.runCommand "ofborg-rs-symlink-compat" {
src = stripDeps build;
} ''
set -x
mkdir -p $out/bin
for f in $(find $src -type f); do
bn=$(basename "$f")
@ -43,6 +40,32 @@ in {
test -e $out/bin/github_comment_poster
test -e $out/bin/log_message_collector
test -e $out/bin/evaluation_filter
# Verify that the outpath contains the version number matching the
# Cargo.toml
if ! grep -q 'version = "${drv.crateVersion}"' ${./ofborg/Cargo.toml}; then
cat <<EOF
Build failed because you bumped the Cargo
version without regenerating the carnix
file.
Run:
nix-shell --run ./nix/update-carnix.sh
and commit those changes.
EOF
fi
'';
ofborg.php = pkgs.runCommand

View file

@ -45,7 +45,7 @@ let kernel = buildPlatform.parsed.kernel.name;
) [] (builtins.attrNames feat);
in
rec {
ofborg = f: ofborg_0_1_6 { features = ofborg_0_1_6_features { ofborg_0_1_6 = f; }; };
ofborg = f: ofborg_0_1_7 { features = ofborg_0_1_7_features { ofborg_0_1_7 = f; }; };
aho_corasick_0_5_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "aho-corasick";
version = "0.5.3";
@ -427,9 +427,9 @@ rec {
sha256 = "1y6qnd9r8ga6y8mvlabdrr73nc8cshjjlzbvnanzyj9b8zzkfwk2";
inherit dependencies buildDependencies features;
};
ofborg_0_1_6_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
ofborg_0_1_7_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "ofborg";
version = "0.1.6";
version = "0.1.7";
authors = [ "Graham Christensen <graham@grahamc.com>" ];
src = include [ "Cargo.toml" "Cargo.lock" "src" "test-srcs" "build.rs" ] ./../ofborg;
build = "build.rs";
@ -1449,10 +1449,10 @@ rec {
libc_0_2_40.default = true;
num_cpus_1_8_0.default = (f.num_cpus_1_8_0.default or true);
}) [ libc_0_2_40_features ];
ofborg_0_1_6 = { features?(ofborg_0_1_6_features {}) }: ofborg_0_1_6_ {
ofborg_0_1_7 = { features?(ofborg_0_1_7_features {}) }: ofborg_0_1_7_ {
dependencies = mapFeatures features ([ amqp_0_1_0 either_1_5_0 env_logger_0_4_3 fs2_0_4_3 hubcaps_0_3_16 hyper_0_10_13 hyper_native_tls_0_2_4 log_0_3_8 lru_cache_0_1_1 md5_0_3_7 nom_4_0_0_beta3 serde_1_0_43 serde_derive_1_0_43 serde_json_1_0_16 sys_info_0_5_6 tempfile_2_2_0 uuid_0_4_0 ]);
};
ofborg_0_1_6_features = f: updateFeatures f (rec {
ofborg_0_1_7_features = f: updateFeatures f (rec {
amqp_0_1_0.default = true;
either_1_5_0.default = true;
env_logger_0_4_3.default = true;
@ -1464,7 +1464,7 @@ rec {
lru_cache_0_1_1.default = true;
md5_0_3_7.default = true;
nom_4_0_0_beta3.default = true;
ofborg_0_1_6.default = (f.ofborg_0_1_6.default or true);
ofborg_0_1_7.default = (f.ofborg_0_1_7.default or true);
serde_1_0_43.default = true;
serde_derive_1_0_43.default = true;
serde_json_1_0_16.default = true;

View file

@ -1,11 +1,18 @@
#!/bin/sh
set -eu
cd nix
patched_carnix() {
src=$1
result=$2
(
cd "$(dirname "$src")"
cargo build
)
carnix "$src" --output "$result"
patch -p1 "$result" ./carnix.patch
}

2
ofborg/Cargo.lock generated
View file

@ -395,7 +395,7 @@ dependencies = [
[[package]]
name = "ofborg"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"amqp 0.1.0 (git+https://github.com/grahamc/rust-amqp.git)",
"either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -1,6 +1,6 @@
[package]
name = "ofborg"
version = "0.1.6"
version = "0.1.7"
authors = ["Graham Christensen <graham@grahamc.com>"]
include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"]
build = "build.rs"

View file

@ -9,7 +9,7 @@ use std::io::Write;
use ofborg::writetoline::LineWriter;
use ofborg::message::buildlogmsg::{BuildLogStart, BuildLogMsg};
use ofborg::message::buildresult::{BuildStatus, BuildResult};
use ofborg::message::buildresult::BuildResult;
use ofborg::worker;
use amqp::protocol::basic::{Deliver, BasicProperties};
@ -248,6 +248,7 @@ mod tests {
use std::path::PathBuf;
use ofborg::worker::SimpleWorker;
use ofborg::test_scratch::TestScratch;
use ofborg::message::buildresult::BuildStatus;
use ofborg::message::{Pr,Repo};
fn make_worker(path: PathBuf) -> LogMessageCollector {
@ -455,18 +456,18 @@ mod tests {
);
}
let mut pr = p.path();
let mut s = String::new();
pr.push("routing-key-foo/attempt-id-foo.metadata.json");
File::open(pr).unwrap().read_to_string(&mut s).unwrap();
assert_eq!(&s, "{\"system\":\"foobar-x8664\",\"identity\":\"my-identity\",\"attempt_id\":\"my-attempt-id\",\"attempted_attrs\":[\"foo\"],\"skipped_attrs\":[\"bar\"]}");
let mut prm = p.path();
let mut sm = String::new();
prm.push("routing-key-foo/attempt-id-foo.metadata.json");
File::open(prm).unwrap().read_to_string(&mut sm).unwrap();
assert_eq!(&sm, "{\"system\":\"foobar-x8664\",\"identity\":\"my-identity\",\"attempt_id\":\"my-attempt-id\",\"attempted_attrs\":[\"foo\"],\"skipped_attrs\":[\"bar\"]}");
let mut pr = p.path();
let mut s = String::new();
pr.push("routing-key-foo/attempt-id-foo");
File::open(pr).unwrap().read_to_string(&mut s).unwrap();
assert_eq!(&s, "line-1\n\n\n\nline-5\n");
let mut prf = p.path();
let mut sf = String::new();
prf.push("routing-key-foo/attempt-id-foo");
File::open(prf).unwrap().read_to_string(&mut sf).unwrap();
assert_eq!(&sf, "line-1\n\n\n\nline-5\n");
let mut pr = p.path();
@ -475,10 +476,10 @@ mod tests {
File::open(pr).unwrap().read_to_string(&mut s).unwrap();
assert_eq!(&s, "\n\nline-3\n");
let mut pr = p.path();
let mut s = String::new();
pr.push("routing-key-foo/attempt-id-foo.result.json");
File::open(pr).unwrap().read_to_string(&mut s).unwrap();
assert_eq!(&s, "{\"repo\":{\"owner\":\"NixOS\",\"name\":\"ofborg\",\"full_name\":\"NixOS/ofborg\",\"clone_url\":\"https://github.com/nixos/ofborg.git\"},\"pr\":{\"target_branch\":\"scratch\",\"number\":42,\"head_sha\":\"6dd9f0265d52b946dd13daf996f30b64e4edb446\"},\"system\":\"x86_64-linux\",\"output\":[],\"attempt_id\":\"attempt-id-foo\",\"request_id\":\"bogus-request-id\",\"success\":true,\"status\":\"Success\",\"skipped_attrs\":[\"bar\"],\"attempted_attrs\":[\"foo\"]}");
let mut prr = p.path();
let mut sr = String::new();
prr.push("routing-key-foo/attempt-id-foo.result.json");
File::open(prr).unwrap().read_to_string(&mut sr).unwrap();
assert_eq!(&sr, "{\"repo\":{\"owner\":\"NixOS\",\"name\":\"ofborg\",\"full_name\":\"NixOS/ofborg\",\"clone_url\":\"https://github.com/nixos/ofborg.git\"},\"pr\":{\"target_branch\":\"scratch\",\"number\":42,\"head_sha\":\"6dd9f0265d52b946dd13daf996f30b64e4edb446\"},\"system\":\"x86_64-linux\",\"output\":[],\"attempt_id\":\"attempt-id-foo\",\"request_id\":\"bogus-request-id\",\"success\":true,\"status\":\"Success\",\"skipped_attrs\":[\"bar\"],\"attempted_attrs\":[\"foo\"]}");
}
}

View file

@ -8,27 +8,34 @@ pub struct TestScratch {
impl TestScratch {
pub fn new_dir(ident: &str) -> TestScratch {
let path = TestScratch {
let scratch = TestScratch {
root: Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-scratch")
.join("dirs")
.join(&format!("dir-{}", ident)),
};
fs::create_dir_all(path.root.parent().unwrap()).unwrap();
return path;
TestScratch::create_dir(&scratch);
return scratch;
}
pub fn new_file(ident: &str) -> TestScratch {
let path = TestScratch {
let scratch = TestScratch {
root: Path::new(env!("CARGO_MANIFEST_DIR"))
.join("test-scratch")
.join("files")
.join(&format!("file-{}", ident)),
};
fs::create_dir_all(path.root.parent().unwrap()).unwrap();
return path;
TestScratch::create_dir(&scratch);
return scratch;
}
fn create_dir(path: &TestScratch) {
let target = path.root.parent().unwrap();
debug!("Creating directory {:?}", target);
fs::create_dir_all(target).unwrap();
}
pub fn path(&self) -> PathBuf {
@ -42,6 +49,7 @@ impl TestScratch {
impl Drop for TestScratch {
fn drop(&mut self) {
debug!("Deleting root {:?}", self.root);
Command::new("rm")
.arg("-rf")
.arg(self.root.clone())

View file

@ -4,7 +4,7 @@ in {
success = derivation {
name = "success";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; printf '1\n2\n3\n4\n'; echo ${toString builtins.currentTime} > $out" ];
@ -13,7 +13,7 @@ in {
failed = derivation {
name = "failed";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime}" ];

View file

@ -4,7 +4,7 @@ in {
success = derivation {
name = "success";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime} > $out" ];
@ -13,7 +13,7 @@ in {
failed = derivation {
name = "failed";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime}" ];

View file

@ -4,7 +4,7 @@ in rec {
success = derivation {
name = "success";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime} > $out" ];
@ -13,7 +13,7 @@ in rec {
failed = derivation {
name = "failed";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime}; echo ${success}" ];
@ -22,7 +22,7 @@ in rec {
passes-instantiation = derivation {
name = "passes-instantiation";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo this ones cool" ];

View file

@ -4,7 +4,7 @@ in rec {
success = derivation {
name = "success";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime} > $out" ];
@ -13,7 +13,7 @@ in rec {
failed = derivation {
name = "failed";
system = builtins.currentSystem;
builder = nix.shell;
builder = builtins.storePath nix.shell;
args = [
"-c"
"echo hi; echo ${toString builtins.currentTime}; echo ${success}" ];