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

add osx to travis #95

Merged
merged 2 commits into from
Jan 13, 2017
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
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
sudo: false
notifications:
email: false
os:
- linux
go:
- 1.7
- tip
matrix:
include:
- os: linux
go: 1.7
- os: linux
go: tip
- os: osx
go: 1.7
install:
- echo "This is an override of the default install deps step in travis."
script:
Expand Down
3 changes: 1 addition & 2 deletions ensure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ func main() {
t.Fatalf("expected %s, got %s", expectedManifest, manifest)
}

sysCommit, err := getRepoLatestCommit("golang/sys")
tg.must(err)
sysCommit := tg.getCommit("go.googlesource.com/sys")
expectedLock := `{
"memo": "595716d270828e763c811ef79c9c41f85b1d1bfbdfe85280036405c03772206c",
"projects": [
Expand Down
11 changes: 11 additions & 0 deletions hoard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,3 +502,14 @@ func (tg *testgoData) readLock() string {
tg.must(err)
return string(f)
}

func (tg *testgoData) getCommit(repo string) string {
repoPath := tg.path("pkg/hoard/sources/https---" + strings.Replace(repo, "/", "-", -1))
cmd := exec.Command("git", "rev-parse", "HEAD")
cmd.Dir = repoPath
out, err := cmd.CombinedOutput()
if err != nil {
tg.t.Fatalf("git commit failed: out -> %s err -> %v", string(out), err)
}
return strings.TrimSpace(string(out))
}
28 changes: 1 addition & 27 deletions init_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package main

import (
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -169,8 +165,7 @@ const Qux = "yo yo!"
t.Fatalf("expected %s, got %s", expectedManifest, manifest)
}

sysCommit, err := getRepoLatestCommit("golang/sys")
tg.must(err)
sysCommit := tg.getCommit("go.googlesource.com/sys")
expectedLock := `{
"projects": [
{
Expand Down Expand Up @@ -210,24 +205,3 @@ var memoRE = regexp.MustCompile(`\s+"memo": "[a-z0-9]+",`)
func wipeMemo(s string) string {
return memoRE.ReplaceAllString(s, "")
}

type commit struct {
Sha string `json:"sha"`
}

func getRepoLatestCommit(repo string) (string, error) {
resp, err := http.Get(fmt.Sprintf("https://api.github.com/repos/%s/commits?per_page=1", repo))
if err != nil {
return "", err
}

var commits []commit
if err := json.NewDecoder(resp.Body).Decode(&commits); err != nil {
return "", err
}

if len(commits) < 1 {
return "", errors.New("got no commits")
}
return commits[0].Sha, nil
}
3 changes: 1 addition & 2 deletions remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ func main() {
t.Fatalf("expected %s, got %s", expectedManifest, manifest)
}

sysCommit, err := getRepoLatestCommit("golang/sys")
tg.must(err)
sysCommit := tg.getCommit("go.googlesource.com/sys")
expectedLock := `{
"projects": [
{
Expand Down