Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Fix osx builds #35

Merged
merged 4 commits into from
Apr 18, 2019
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
37 changes: 19 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
language: rust
dist: xenial
osx_image: xcode10.2

cache:
- cargo
- directories:
- "${HOME}/kcov/"

os:
- linux

addons:
apt:
packages:
Expand All @@ -21,6 +19,9 @@ addons:
- binutils-dev
sources:
- kalakris-cmake
homebrew:
packages:
- cmake

matrix:
fast_finish: true
Expand All @@ -36,15 +37,15 @@ matrix:
- os: linux
rust: stable
env: TARGET=x86_64-unknown-linux-musl
# - os: osx
# rust: nightly
# env: TARGET=x86_64-apple-darwin
# - os: osx
# rust: beta
# env: TARGET=x86_64-apple-darwin
# - os: osx
# rust: stable
# env: TARGET=x86_64-apple-darwin
- os: osx
rust: nightly
env: TARGET=x86_64-apple-darwin
- os: osx
rust: beta
env: TARGET=x86_64-apple-darwin
- os: osx
rust: stable
env: TARGET=x86_64-apple-darwin

before_script:
- rustup target add $TARGET
Expand All @@ -65,9 +66,8 @@ script:
- cp target/$TARGET/release/gitkv target/$TARGET/release/gitkv-$TARGET && chmod +x target/$TARGET/release/gitkv-$TARGET

after_success:
# Generates repo test coverage and pushes it codecov
- cargo coverage --target $TARGET --kcov-build-location "${HOME}/kcov/"
- bash <(curl -s https://codecov.io/bash)
- test $TRAVIS_OS_NAME = "linux" && cargo coverage --target $TARGET --kcov-build-location "${HOME}/kcov/"
- test $TRAVIS_OS_NAME = "linux" && bash <(curl -s https://codecov.io/bash)

deploy:
# Push binaries to the GitHub release for this version.
Expand All @@ -83,9 +83,10 @@ deploy:
# Push Docker container to Docker Hub tagger for this version.
- provider: script
skip_cleanup: true
script: ./docker/build.sh $TRAVIS_BRANCH $TARGET && docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" && docker push intenthq/gitkv:$TRAVIS_BRANCH
script:
- ./docker/build.sh $TRAVIS_BRANCH $TARGET && docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" && docker push intenthq/gitkv:$TRAVIS_BRANCH
on:
condition: $TRAVIS_OS_NAME = "linux"
rust: stable
os: linux
tags: true
branch: /^v\d+\.\d+\.\d+.*$/
24 changes: 13 additions & 11 deletions git/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ mod tests {

use super::{GitOps, LibGitOps};

use git2::Repository;
use git2::{Repository, Signature, Time};
use std::fs;
use std::io::Write;
use std::path::Path;
Expand Down Expand Up @@ -138,16 +138,18 @@ mod tests {
index
.add_path(Path::new(file))
.expect("can't add file to index");
repo.signature().and_then(|sig| {
index
.write_tree()
.and_then(|tid| repo.find_tree(tid))
.and_then(|tree| {
repo.commit(Some("HEAD"), &sig, &sig, "Initial commit", &tree, &[])
})
})
})
.expect("can't do first commit");

let time = Time::new(123_456_789, 0);
let sig = Signature::new("Foo McBarson", "foo.mcbarson@iamarealboy.net", &time)
.expect("couldn't create signature for commit");

index
.write_tree()
.and_then(|tid| repo.find_tree(tid))
.and_then(|tree| {
repo.commit(Some("HEAD"), &sig, &sig, "Initial commit", &tree, &[])
})
}).expect("can't do first commit");;

callback(&repo);
dir.close().expect("couldn't close the dir");
Expand Down