Skip to content

Commit

Permalink
Add appveyor builds for CLI, fix Windows filepath splitting (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi authored Aug 6, 2018
1 parent 10f10a6 commit 6f533af
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 20 deletions.
45 changes: 45 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "{build}-{branch}"

# Source Config

clone_folder: c:\gopath\src\github.com\ubclaunchpad\inertia

# Build host

environment:
GOPATH: c:\gopath
DEPTESTBYPASS501: 1
GOVERSION: "1.10"

init:
- git config --global core.autocrlf input

# Build

install:
# Install the specific Go version.
- rmdir c:\go /s /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi
- msiexec /i go%GOVERSION%.windows-amd64.msi /q
- set Path=c:\go\bin;c:\gopath\bin;%PATH%
- go version
- go env
- go get -u github.com/golang/dep/cmd/dep
- dep ensure

deploy: false

build_script:
- ps: Write-Host "$env:APPVEYOR_REPO_BRANCH"
- ps: Write-Host "$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"
- ps: git checkout -q $env:APPVEYOR_REPO_BRANCH
- git branch
- go build

test_script:
- go test ./cfg -short --cover
- go test ./client -short --cover
- go test ./cmd -short --cover
- go test ./common -short --cover
- go test ./local -short --cover
- go test ./provision -short --cover
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,23 @@
<p align="center">
<a href="https://travis-ci.org/ubclaunchpad/inertia">
<img src="https://travis-ci.org/ubclaunchpad/inertia.svg?branch=master"
alt="Build Status" />
alt="Travis Build Status" />
</a>

<a href="https://ci.appveyor.com/project/ubclaunchpad/inertia">
<img src="https://ci.appveyor.com/api/projects/status/2fll6p9677bujb7q/branch/master?svg=true"
alt="Appveyor Build Status" />
</a>

<a href="https://goreportcard.com/report/github.com/ubclaunchpad/inertia">
<img src="https://goreportcard.com/badge/github.com/ubclaunchpad/inertia"
alt="Clean code" />
</a>

<a href="https://github.com/ubclaunchpad/inertia/blob/master/CONTRIBUTING.md">
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg"
alt="Contributions welcome"/>
</a>

<a href="https://godoc.org/github.com/ubclaunchpad/inertia">
<img src="https://godoc.org/github.com/ubclaunchpad/inertia?status.svg"
alt="GoDocs available" />
</a>

<a href="https://microbadger.com/images/ubclaunchpad/inertia">
<img src="https://img.shields.io/microbadger/image-size/ubclaunchpad/inertia.svg"
alt="Docker image" />
</a>

<a href="https://github.com/ubclaunchpad/inertia/releases/latest">
<img src="https://img.shields.io/github/release/ubclaunchpad/inertia.svg"
Expand Down
6 changes: 3 additions & 3 deletions local/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package local

import (
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -30,9 +31,8 @@ func GetRepoCurrentBranch() (string, error) {
// checkForGit returns an error if we're not in a git repository.
func checkForGit(cwd string) error {
// Quick failure if no .git folder.
gitFolder := filepath.Join(cwd, ".git")
if _, err := os.Stat(gitFolder); os.IsNotExist(err) {
return errors.New("this does not appear to be a git repository")
if _, err := os.Stat(filepath.Join(cwd, ".git")); os.IsNotExist(err) {
return fmt.Errorf("directory %s does not appear to be a git repository", cwd)
}

// Also fail if no origin detected
Expand Down
4 changes: 2 additions & 2 deletions local/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package local
import (
"fmt"
"os"
"path"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -32,6 +32,6 @@ func TestCheckForGit(t *testing.T) {
cwd, err := os.Getwd()
assert.Nil(t, err)
assert.NotNil(t, checkForGit(cwd))
inertia, _ := path.Split(cwd)
inertia, _ := filepath.Split(cwd)
assert.Nil(t, checkForGit(inertia))
}
5 changes: 1 addition & 4 deletions local/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestConfigCreateAndWriteAndRead(t *testing.T) {
// Get config and add remotes
config, configPath, err := GetProjectConfigFromDisk("inertia.toml")
assert.Nil(t, err)
defer os.Remove(configPath)
config.AddRemote(&cfg.RemoteVPS{
Name: "test",
IP: "1234",
Expand Down Expand Up @@ -69,10 +70,6 @@ func TestConfigCreateAndWriteAndRead(t *testing.T) {
assert.Equal(t, "12343:80801", client.GetIPAndPort())
_, _, err = GetClient("asdf", "inertia.toml")
assert.NotNil(t, err)

// Test config remove
err = os.Remove(configPath)
assert.Nil(t, err)
}

func TestSaveKey(t *testing.T) {
Expand Down

0 comments on commit 6f533af

Please sign in to comment.