forked from the-distro/ofborg
commit
ee6fb69566
6
.travis.yml
Normal file
6
.travis.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
language: nix
|
||||
matrix:
|
||||
include:
|
||||
- script:
|
||||
- nix-shell --run 'cd ofborg && cargo test --lib -- --nocapture'
|
||||
- nix-shell --run 'cd ofborg && cargo test --lib -- --nocapture' --arg useNix1 true
|
|
@ -269,10 +269,14 @@ mod tests {
|
|||
.current_dir(tpath("./test-srcs"))
|
||||
.arg(bare)
|
||||
.arg(co)
|
||||
.stderr(Stdio::null())
|
||||
.stdout(Stdio::piped())
|
||||
.output()
|
||||
.expect("building the test PR failed");
|
||||
|
||||
let stderr = String::from_utf8(output.stderr)
|
||||
.unwrap_or_else(|err| format!("warning: {}", err));
|
||||
println!("{}", stderr);
|
||||
|
||||
let hash = String::from_utf8(output.stdout).expect("Should just be a hash");
|
||||
return hash.trim().to_owned();
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ pub trait GitClonable {
|
|||
if result.success() {
|
||||
return Ok(());
|
||||
} else {
|
||||
return Err(Error::new(ErrorKind::Other, "Failed to clone"));
|
||||
return Err(Error::new(ErrorKind::Other, format!("Failed to clone from {:?} to {:?}", self.clone_from(), self.clone_to())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,8 @@ fn lines_from_file(file: File) -> Vec<String> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
fn nix() -> Nix {
|
||||
Nix::new("x86_64-linux".to_owned(), "daemon".to_owned(), 1800, None)
|
||||
let remote = env::var("NIX_REMOTE").unwrap_or("".to_owned());
|
||||
Nix::new("x86_64-linux".to_owned(), remote, 1800, None)
|
||||
}
|
||||
|
||||
fn noop(operation: Operation) -> Operation {
|
||||
|
@ -502,7 +503,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn safe_command_custom_gc() {
|
||||
let nix = Nix::new("x86_64-linux".to_owned(), "daemon".to_owned(), 1800, Some("4g".to_owned()));
|
||||
let remote = env::var("NIX_REMOTE").unwrap_or("".to_owned());
|
||||
let nix = Nix::new("x86_64-linux".to_owned(), remote, 1800, Some("4g".to_owned()));
|
||||
|
||||
let ret: Result<File, File> =
|
||||
nix.run(
|
||||
|
|
|
@ -400,6 +400,7 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
use ofborg::message::{Pr, Repo};
|
||||
use notifyworker::SimpleNotifyWorker;
|
||||
|
@ -408,7 +409,8 @@ mod tests {
|
|||
use ofborg::test_scratch::TestScratch;
|
||||
|
||||
fn nix() -> nix::Nix {
|
||||
nix::Nix::new("x86_64-linux".to_owned(), "daemon".to_owned(), 1800, None)
|
||||
let remote = env::var("NIX_REMOTE").unwrap_or("".to_owned());
|
||||
nix::Nix::new("x86_64-linux".to_owned(), remote, 1800, None)
|
||||
}
|
||||
|
||||
fn tpath(component: &str) -> PathBuf {
|
||||
|
|
|
@ -786,6 +786,7 @@ fn parse_commit_messages(messages: Vec<String>) -> Vec<String> {
|
|||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
|
@ -798,7 +799,8 @@ mod tests {
|
|||
let nixpkgs = String::from_utf8(output.stdout)
|
||||
.expect("nixpkgs required");
|
||||
|
||||
let nix = nix::Nix::new(String::from("x86_64-linux"), String::from("daemon"), 1200, None);
|
||||
let remote = env::var("NIX_REMOTE").unwrap_or("".to_owned());
|
||||
let nix = nix::Nix::new(String::from("x86_64-linux"), remote, 1200, None);
|
||||
let mut stdenv =
|
||||
Stdenvs::new(
|
||||
nix.clone(),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "$@"
|
||||
echo hi
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
env
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "$@"
|
||||
echo hi
|
||||
|
|
|
@ -1,36 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
set -o pipefail
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
bare=$1
|
||||
co=$2
|
||||
|
||||
(
|
||||
makepr() {
|
||||
git init --bare "$bare"
|
||||
git clone "$bare" "$co"
|
||||
|
||||
|
||||
(
|
||||
cp build/* "$co/"
|
||||
cd "$co/"
|
||||
git add .
|
||||
git commit --no-gpg-sign -m "initial repo commit"
|
||||
git push origin master
|
||||
)
|
||||
git -C "$co" add .
|
||||
git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "initial repo commit"
|
||||
git -C "$co" push origin master
|
||||
|
||||
(
|
||||
cp build-pr/* "$co/"
|
||||
cd "$co/"
|
||||
git checkout -b my-cool-pr
|
||||
git add .
|
||||
git commit --no-gpg-sign -m "check out this cool PR"
|
||||
git push origin my-cool-pr:refs/pull/1/head
|
||||
git -C "$co" checkout -b my-cool-pr
|
||||
git -C "$co" add .
|
||||
git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "check out this cool PR"
|
||||
git -C "$co" push origin my-cool-pr:refs/pull/1/head
|
||||
}
|
||||
|
||||
)
|
||||
) >&2
|
||||
|
||||
(
|
||||
cd "$co/"
|
||||
git rev-parse HEAD
|
||||
)
|
||||
makepr >&2
|
||||
git -C "$co" rev-parse HEAD
|
||||
|
|
13
shell.nix
13
shell.nix
|
@ -1,7 +1,6 @@
|
|||
{ pkgs ? import ./nix {}, useNix1 ? true }:
|
||||
|
||||
let
|
||||
pkgs = import ./nix {};
|
||||
|
||||
|
||||
inherit (pkgs) stdenv;
|
||||
|
||||
phpEnv = stdenv.mkDerivation rec {
|
||||
|
@ -11,12 +10,12 @@ let
|
|||
nix-prefetch-git
|
||||
php
|
||||
phpPackages.composer
|
||||
nix
|
||||
git
|
||||
php
|
||||
curl
|
||||
bash
|
||||
];
|
||||
]
|
||||
++ stdenv.lib.optional useNix1 nix;
|
||||
|
||||
# HISTFILE = "${src}/.bash_hist";
|
||||
};
|
||||
|
@ -32,7 +31,9 @@ let
|
|||
openssl.dev
|
||||
pkgconfig
|
||||
git
|
||||
] ++ (lib.optional stdenv.isDarwin pkgs.darwin.Security);
|
||||
]
|
||||
++ stdenv.lib.optional useNix1 nix
|
||||
++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security;
|
||||
|
||||
HISTFILE = "${toString ./.}/.bash_hist";
|
||||
passthru.phpEnv = phpEnv;
|
||||
|
|
Loading…
Reference in a new issue