Skip to content

Commit

Permalink
WIP azure pipelines (#44)
Browse files Browse the repository at this point in the history
Azure pipelines
  • Loading branch information
stanislas-m authored Mar 16, 2019
1 parent cae45fa commit ac4b9af
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 85 deletions.
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

97 changes: 97 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

variables:
GOBIN: "$(GOPATH)/bin" # Go binaries path
GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path
modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code

jobs:
- job: Windows
pool:
vmImage: "vs2017-win2016"
strategy:
matrix:
# SQLite3
go 1.12 (on) sqlite:
go_version: "1.12"
GO111MODULE: "on"
SODA_DIALECT: "sqlite"
go 1.12 (off) sqlite:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
- template: azure-tests.yml

- job: macOS
pool:
vmImage: "macOS-10.13"
strategy:
matrix:
# SQLite3
go 1.12 (on) sqlite:
go_version: "1.12"
GO111MODULE: "on"
SODA_DIALECT: "sqlite"
go 1.12 (off) sqlite:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
- template: azure-tests.yml

- job: Linux
pool:
vmImage: "ubuntu-16.04"
strategy:
matrix:
# Postgres
go 1.10 postgres:
go_version: "1.10"
SODA_DIALECT: "postgres"
go 1.11 (on) postgres:
go_version: "1.11.5"
GO111MODULE: "on"
SODA_DIALECT: "postgres"
go 1.11 (off) postgres:
go_version: "1.11.5"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
go 1.12 (on) postgres:
go_version: "1.12"
GO111MODULE: "on"
SODA_DIALECT: "postgres"
go 1.12 (off) postgres:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
# Cockroach
go 1.12 (on) cockroach:
go_version: "1.12"
GO111MODULE: "on"
SODA_DIALECT: "cockroach"
go 1.12 (off) cockroach:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "cockroach"
# MySQL
go 1.12 (on) mysql:
go_version: "1.12"
GO111MODULE: "on"
SODA_DIALECT: "mysql"
MYSQL_PORT: "3307"
go 1.12 (off) mysql:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "mysql"
MYSQL_PORT: "3307"
# SQLite3
go 1.12 (on) sqlite:
go_version: "1.12"
GO111MODULE: "on"
SODA_DIALECT: "sqlite"
go 1.12 (off) sqlite:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
- template: azure-tests.yml
58 changes: 58 additions & 0 deletions azure-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
steps:
- task: GoTool@0
inputs:
version: $(go_version)
- task: Bash@3
inputs:
targetType: inline
script: |
mkdir -p "$(GOBIN)"
mkdir -p "$(GOPATH)/pkg"
mkdir -p "$(modulePath)"
shopt -s extglob
mv !(gopath) "$(modulePath)"
displayName: "Setup Go Workspace"
- task: Docker@1
displayName: Run postgres image
inputs:
command: run
imageName: postgres:9.6
ports: "5432:5432"
envVars: POSTGRES_DB=pop_test
condition: and(succeeded(), eq(variables['SODA_DIALECT'], 'postgres'))
- task: Docker@1
displayName: Run mysql image
inputs:
command: run
imageName: mysql:5.7
ports: "3307:3306"
envVars: |
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=pop_test
MYSQL_USER=pop
MYSQL_PASSWORD=pop
condition: and(succeeded(), eq(variables['SODA_DIALECT'], 'mysql'))
- task: Docker@1
displayName: Run cockroach image
inputs:
command: run
imageName: cockroachdb/cockroach:v1.1.1
ports: "26257:26257"
containerCommand: start --insecure
condition: and(succeeded(), eq(variables['SODA_DIALECT'], 'cockroach'))
- task: Bash@3
inputs:
targetType: inline
script: |
GO111MODULE=off go get -v -tags sqlite github.com/gobuffalo/pop/soda
displayName: "Install soda"
- script: |
$(GOBIN)/soda create -e $(SODA_DIALECT)
$(GOBIN)/soda migrate -e $(SODA_DIALECT)
workingDirectory: "$(modulePath)"
displayName: "Create DB & run migrations"
- script: |
go get -t -v ./...
go test -race -v ./...
workingDirectory: "$(modulePath)"
displayName: "Tests"
5 changes: 3 additions & 2 deletions bubbler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fizz

import (
"bytes"
"strings"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -15,7 +16,7 @@ func Test_Exec(t *testing.T) {
bb := &bytes.Buffer{}
c := f.Exec(bb)
c("echo hello")
r.Equal("hello\n", bb.String())
r.Equal("hello", strings.TrimSpace(bb.String()))
}

func Test_ExecQuoted(t *testing.T) {
Expand All @@ -27,5 +28,5 @@ func Test_ExecQuoted(t *testing.T) {
c := f.Exec(bb)
// without proper splitting we would get "'a b c'"
c("echo 'a b c'")
r.Equal("a b c\n", bb.String())
r.Equal("a b c", strings.TrimSpace(bb.String()))
}
10 changes: 2 additions & 8 deletions database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ mysql:
user: {{ envOr "MYSQL_USER" "root" }}
password: {{ envOr "MYSQL_PASSWORD" "root" }}

mysql_travis:
dialect: "mysql"
database: "pop_test"
host: {{ envOr "MYSQL_HOST" "127.0.0.1" }}
port: {{ envOr "MYSQL_PORT" "3306" }}
user: {{ envOr "MYSQL_USER" "root" }}
password: {{ envOr "MYSQL_PASSWORD" "" }}

postgres:
url: "postgres://postgres:postgres@localhost:5432/pop_test?sslmode=disable"
pool: 25
Expand All @@ -26,6 +18,8 @@ cockroach:
port: {{ envOr "COCKROACH_PORT" "26257" }}
user: {{ envOr "COCKROACH_USER" "root" }}
password: {{ envOr "COCKROACH_PASSWORD" "" }}
options:
sslmode: disable

sqlserver:
dialect: "sqlserver"
Expand Down
3 changes: 3 additions & 0 deletions tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func (t *Table) Column(name string, colType string, options Options) error {
Options: options,
Primary: primary,
}
if t.columnsCache == nil {
t.columnsCache = make(map[string]struct{})
}
t.columnsCache[name] = struct{}{}
// Ensure id is first
if name == "id" {
Expand Down

0 comments on commit ac4b9af

Please sign in to comment.