Skip to content

Commit

Permalink
Azure pipelines (gobuffalo#367)
Browse files Browse the repository at this point in the history
* WIP Azure pipelines

* Fix typo

* Fix soda install script

* Fix binary name

* Fix tsoda call

* Build soda without modules

* Use Bash to install soda

* Fix pipeline

* Fix soda build

* Remove go module builds

* Fix soda install

* Install soda with go install

* Fix config parse test

* Do not create Docker default DBs

* Remove Travis

* Update badge in Readme
  • Loading branch information
stanislas-m authored Mar 18, 2019
1 parent 7ba6947 commit 669c04a
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 149 deletions.
133 changes: 0 additions & 133 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p align="center">
<a href="https://godoc.org/github.com/gobuffalo/pop"><img src="https://godoc.org/github.com/gobuffalo/pop?status.svg" alt="GoDoc" /></a>
<a href="https://travis-ci.org/gobuffalo/pop"><img src="https://travis-ci.org/gobuffalo/pop.svg?branch=master" alt="Build Status" /></a>
<a href="https://dev.azure.com/stanislasmichalak/pop/_build/latest?definitionId=1&branchName=master"><img src="https://dev.azure.com/stanislasmichalak/pop/_apis/build/status/gobuffalo.pop?branchName=master" alt="Build Status" /></a>
</p>

# POP
Expand Down
72 changes: 72 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
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 (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 (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 (off) postgres:
go_version: "1.11.5"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
go 1.12 (off) postgres:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "postgres"
# Cockroach
go 1.12 (off) cockroach:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "cockroach"
# Cockroach SSL
go 1.12 (off) cockroach SSL:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "cockroach_ssl"
# MySQL
go 1.12 (off) mysql:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "mysql"
MYSQL_PORT: "3307"
# SQLite3
go 1.12 (off) sqlite:
go_version: "1.12"
GO111MODULE: "off"
SODA_DIALECT: "sqlite"
steps:
- template: azure-tests.yml
69 changes: 69 additions & 0 deletions azure-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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"
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
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
displayName: Install Cockroach SSL
inputs:
targetType: inline
script: |
cd $(modulePath)
mkdir -p crdb/certs
pushd crdb
wget -qO- https://binaries.cockroachdb.com/cockroach-v2.1.0.linux-amd64.tgz | tar zxv
mv cockroach-v2.1.0.linux-amd64/cockroach .
./cockroach cert create-ca --certs-dir certs --ca-key key
./cockroach cert create-client root --certs-dir certs --ca-key key
./cockroach cert create-node localhost 127.0.0.1 `hostname -s` `hostname -f` --certs-dir certs --ca-key key
./cockroach start --certs-dir certs --listen-addr localhost --port 26259 --http-port 8089 --background
popd
condition: and(succeeded(), eq(variables['SODA_DIALECT'], 'cockroach_ssl'))
- script: |
go get -t -v ./...
go install -v -tags sqlite ./soda
workingDirectory: "$(modulePath)"
displayName: "Install soda"
- script: |
$(GOBIN)/soda drop -e $(SODA_DIALECT)
$(GOBIN)/soda create -e $(SODA_DIALECT)
$(GOBIN)/soda migrate -e $(SODA_DIALECT)
workingDirectory: "$(modulePath)"
displayName: "Create DB & run migrations"
- script: |
go test -tags sqlite ./... -v
workingDirectory: "$(modulePath)"
displayName: "Tests"
10 changes: 5 additions & 5 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Test_LoadsConnectionsFromConfig(t *testing.T) {
r := require.New(t)

conns := Connections
r.Equal(6, len(conns))
r.Equal(5, len(conns))
}

func Test_AddLookupPaths(t *testing.T) {
Expand All @@ -28,10 +28,10 @@ func Test_ParseConfig(t *testing.T) {
mysql:
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" "root" }}
host: "127.0.0.1"
port: "3306"
user: "root"
password: "root"
options:
readTimeout: 5s`)
conns, err := ParseConfig(config)
Expand Down
10 changes: 0 additions & 10 deletions database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ mysql:
options:
readTimeout: 5s

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" "" }}
options:
readTimeout: 10s

postgres:
url: "postgres://postgres:postgres@localhost:5432/pop_test?sslmode=disable"
pool: 25
Expand Down

0 comments on commit 669c04a

Please sign in to comment.