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