Skip to content

Commit 07cb4e9

Browse files
feat(windows): add windows support and ci (#94)
1 parent 15d0a4e commit 07cb4e9

16 files changed

Lines changed: 119 additions & 31 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ build: binary-build
4545
@$(call check-static-binary,deis)
4646

4747
build-all:
48-
${DEV_ENV_CMD} gox -verbose ${GO_LDFLAGS} -os="linux darwin " -arch="amd64 386" -output="$(DIST_DIR)/deis-latest-{{.OS}}-{{.Arch}}" .
48+
${DEV_ENV_CMD} gox -verbose ${GO_LDFLAGS} -os="linux darwin windows" -arch="amd64 386" -output="$(DIST_DIR)/deis-latest-{{.OS}}-{{.Arch}}" .
4949
ifdef TRAVIS_TAG
50-
${DEV_ENV_CMD} gox -verbose ${GO_LDFLAGS} -os="linux darwin" -arch="amd64 386" -output="$(DIST_DIR)/${TRAVIS_TAG}/deis-${TRAVIS_TAG}-{{.OS}}-{{.Arch}}" .
50+
${DEV_ENV_CMD} gox -verbose ${GO_LDFLAGS} -os="linux darwin windows" -arch="amd64 386" -output="$(DIST_DIR)/${TRAVIS_TAG}/deis-${TRAVIS_TAG}-{{.OS}}-{{.Arch}}" .
5151
else
52-
${DEV_ENV_CMD} gox -verbose ${GO_LDFLAGS} -os="linux darwin" -arch="amd64 386" -output="$(DIST_DIR)/${VERSION}/deis-${VERSION}-{{.OS}}-{{.Arch}}" .
52+
${DEV_ENV_CMD} gox -verbose ${GO_LDFLAGS} -os="linux darwin windows" -arch="amd64 386" -output="$(DIST_DIR)/${VERSION}/deis-${VERSION}-{{.OS}}-{{.Arch}}" .
5353
endif
5454

5555
binary-build:

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Deis Client
22

33
[![Build Status](https://travis-ci.org/deis/workflow-cli.svg?branch=master)](https://travis-ci.org/deis/workflow-cli)
4+
[![Build status](https://ci.appveyor.com/api/projects/status/gduy4urj0q6lnrxx?svg=true)](https://ci.appveyor.com/project/mboersma/workflow-cli-fgqd7)
45
[![Go Report Card](https://goreportcard.com/badge/github.com/deis/workflow-cli)](https://goreportcard.com/report/github.com/deis/workflow-cli)
56
[![codebeat badge](https://codebeat.co/badges/05d314a8-ca61-4211-b69e-e7a3033662c8)](https://codebeat.co/projects/github-com-deis-workflow-cli)
67

@@ -10,6 +11,8 @@ Download Links:
1011
- [32 Bit Linux](https://storage.googleapis.com/workflow-cli/deis-latest-linux-386)
1112
- [64 Bit Mac OS X](https://storage.googleapis.com/workflow-cli/deis-latest-darwin-amd64)
1213
- [32 Bit Max OS X](https://storage.googleapis.com/workflow-cli/deis-latest-darwin-386)
14+
- [64 Bit Windows](https://storage.googleapis.com/workflow-cli/ddeis-latest-windows-amd64.exe)
15+
- [32 Bit Windows](https://storage.googleapis.com/workflow-cli/deis-latest-windows-386.exe)
1316

1417
(Note: Windows builds are not yet supported. [#26](https://github.com/deis/workflow-cli/issues/26) currently tracks the work to support them).
1518

@@ -47,9 +50,17 @@ curl -o deis https://storage.googleapis.com/workflow-cli/deis-latest-darwin-amd6
4750
curl -o deis https://storage.googleapis.com/workflow-cli/deis-latest-darwin-386 && chmod +x deis
4851
```
4952

50-
#### Windows
53+
#### 64 Bit Windows
5154

52-
Windows builds are not yet supported. [#26](https://github.com/deis/workflow-cli/issues/26) currently tracks the work to support them).
55+
```console
56+
powershell -NoProfile -ExecutionPolicy Bypass -Command "(new-object net.webclient).DownloadFile('https://storage.googleapis.com/workflow-cli/deis-latest-windows-amd64.exe', 'deis.exe')"
57+
```
58+
59+
#### 32 Bit Windows
60+
61+
```console
62+
powershell -NoProfile -ExecutionPolicy Bypass -Command "(new-object net.webclient).DownloadFile('https://storage.googleapis.com/workflow-cli/deis-latest-windows-386.exe', 'deis.exe')"
63+
```
5364

5465

5566
After you execute the appropriate command for your system, you'll have a `deis` binary in the current directory.
@@ -66,7 +77,7 @@ You can then move it anywhere in your path:
6677
$ mv deis /usr/local/bin
6778
```
6879

69-
### From Scratch
80+
### From Scratch on OS X and Linux
7081

7182
To compile the client from scratch, ensure you have Docker installed and run
7283

@@ -78,6 +89,18 @@ the client in the current directory.
7889

7990
$ ./deis --version
8091

92+
### From Scratch on Windows
93+
94+
To compile the client from scratch, open PowerShell and execute the following commands in the source directory.
95+
96+
$ .\make bootstrap
97+
$ .\make build
98+
99+
`.\make bootstrap` will fetch all required dependencies, while `.\make build` will compile and install
100+
the client in the current directory.
101+
102+
$ .\deis --version
103+
81104
## Usage
82105

83106
Running `deis help` will give you a up to date list of `deis` commands.

appveyor.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
clone_folder: c:\gopath\src\github.com\deis\workflow-cli
2+
3+
environment:
4+
GOPATH: C:\gopath
5+
6+
install:
7+
- ps: (new-object net.webclient).DownloadFile('https://github.com/Masterminds/glide/releases/download/0.10.2/glide-0.10.2-windows-amd64.zip', 'C:\glide.zip')
8+
- ps: 7z e C:\glide.zip -oC:\glide
9+
- ps: $env:Path += ";C:\glide\"
10+
- ps: .\make bootstrap
11+
12+
build_script:
13+
- ps: .\make build
14+
15+
test_script:
16+
- ps: .\make test
17+
18+
cache:
19+
- vendor
20+
21+
artifacts:
22+
- path: deis.exe
23+
name: deis.exe

cmd/colors_unix.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// +build linux darwin
2+
3+
package cmd
4+
5+
import "fmt"
6+
7+
// Choose an ANSI color by converting a string to an int.
8+
func chooseColor(input string) string {
9+
var sum uint8
10+
11+
for _, char := range []byte(input) {
12+
sum += uint8(char)
13+
}
14+
15+
// Seven possible terminal colors
16+
color := (sum % 7) + 1
17+
18+
if color == 7 {
19+
color = 9
20+
}
21+
22+
return fmt.Sprintf("\033[3%dm", color)
23+
}

cmd/colors_windows.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// +build windows
2+
3+
package cmd
4+
5+
// Windows doesn't support colored terminal output, so this is just a dummy method.
6+
func chooseColor(input string) string {
7+
return input
8+
}

cmd/keys_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"testing"
1111

1212
"github.com/deis/controller-sdk-go/api"
13+
"github.com/deis/workflow-cli/settings"
1314
)
1415

1516
func TestGetKey(t *testing.T) {
@@ -83,7 +84,7 @@ func TestListKeys(t *testing.T) {
8384
t.Fatal(err)
8485
}
8586

86-
os.Setenv("HOME", name)
87+
settings.SetHome(name)
8788

8889
folder := filepath.Join(name, ".ssh")
8990

cmd/utils.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,6 @@ func progress() chan bool {
3636
return quit
3737
}
3838

39-
// Choose an ANSI color by converting a string to an int.
40-
func chooseColor(input string) string {
41-
var sum uint8
42-
43-
for _, char := range []byte(input) {
44-
sum += uint8(char)
45-
}
46-
47-
// Seven possible terminal colors
48-
color := (sum % 7) + 1
49-
50-
if color == 7 {
51-
color = 9
52-
}
53-
54-
return fmt.Sprintf("\033[3%dm", color)
55-
}
56-
5739
func load(appID string) (*deis.Client, string, error) {
5840
c, err := settings.Load()
5941

make.bat

Lines changed: 0 additions & 2 deletions
This file was deleted.

make.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
if ($args[0] -eq "build") {
2+
go build -a -installsuffix cgo -ldflags "-s -X github.com/deis/workflow-cli/version.BuildVersion=$(git rev-parse --short HEAD)" -o deis.exe .
3+
} elseif ($args[0] -eq "test") {
4+
go test --cover --race -v $(glide novendor)
5+
} elseif ($args[0] -eq "bootstrap") {
6+
glide install
7+
} else {
8+
echo "Unknown command: '$args'"
9+
exit 1
10+
}
11+
12+
exit $LASTEXITCODE

0 commit comments

Comments
 (0)