Skip to content

Commit

Permalink
Add "Integration with CI tool"
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed May 20, 2018
1 parent 053ce5a commit b5fc9d3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: go
go:
- 1.10.x
services:
- docker
before_script:
- docker-compose up -d
- sleep 5s
script:
- make test
- DIFF=`./tbls diff pg://postgres:pgpass@localhost:55432/testdb?sslmode=disable ./sample` && if [ ! -z "$DIFF" ]; then echo "document does not updated."; echo $DIFF; exit 1; fi
after_script:
- make cover
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`tbls` is a tool for document a database, written in Go.

[Usage](#usage) | [Sample](sample/) | [Install](#install) | [Database Support](#database-support)
[Usage](#usage) | [Sample](sample/) | [Integration with CI tools](#integration-with-ci-tools) | [Installation](#installation) | [Database Support](#database-support)

## Usage

Expand All @@ -11,7 +11,7 @@
`tbls doc` analyzes a database and generate document in GitHub Friendly Markdown format.

``` sh
$ tbls doc postgres://user:pass@hostname:3306/dbname ./dbdoc
$ tbls doc postgres://user:pass@hostname:5432/dbname ./dbdoc
```

Sample [document](sample/) and [schema](test/pg.sql).
Expand All @@ -21,10 +21,21 @@ Sample [document](sample/) and [schema](test/pg.sql).
`tbls diff` shows the difference between database schema and generated document.

``` sh
$ tbls diff postgres://user:pass@hostname:3306/dbname ./dbdoc
$ tbls diff postgres://user:pass@hostname:5432/dbname ./dbdoc
```

## Install
## Integration with CI tools

1. Commit document using `tbls doc`.
2. Check document updates using `tbls diff`

Set following code to [`your-ci-config.yml`](.travis.yml).

``` sh
DIFF=`./tbls diff postgres://user:pass@localhost:5432/testdb?sslmode=disable ./dbdoc` && if [ ! -z "$DIFF" ]; then echo "document does not updated."; echo $DIFF; exit 1; fi
```

## Installation

``` sh
$ go get github.com/k1LoW/tbls
Expand Down

0 comments on commit b5fc9d3

Please sign in to comment.