Skip to content

Commit 4339ec7

Browse files
committed
Add integration test workflow.
1 parent 86c7d37 commit 4339ec7

3 files changed

Lines changed: 68 additions & 35 deletions

File tree

.github/workflows/golang.yml

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
test:
99
strategy:
10-
fail-fast: false
10+
fail-fast: true
1111
matrix:
1212
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20']
1313
runs-on: ubuntu-latest
@@ -42,5 +42,70 @@ jobs:
4242
- name: go mod tidy
4343
run: go mod tidy
4444
- name: check for any changes
45-
run: >
45+
run: |
4646
[[ $(git status --porcelain) == "" ]] || (echo "changes detected" && exit 1)
47+
integration:
48+
needs:
49+
- test
50+
- lint
51+
runs-on: ubuntu-latest
52+
strategy:
53+
fail-fast: true
54+
matrix:
55+
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20']
56+
services:
57+
mysql:
58+
image: mysql:8.0
59+
env:
60+
MYSQL_ALLOW_EMPTY_PASSWORD: '1'
61+
MYSQL_ROOT_PASSWORD: ''
62+
MYSQL_DATABASE: 'test'
63+
ports:
64+
- 3306:3306
65+
options: >-
66+
--health-cmd="mysqladmin ping"
67+
--health-interval=10s
68+
--health-timeout=5s
69+
--health-retries=3
70+
postgres:
71+
image: postgres:15
72+
env:
73+
POSTGRES_PASSWORD: 'password'
74+
ports:
75+
- 5432:5432
76+
options: >-
77+
--health-cmd pg_isready
78+
--health-interval 10s
79+
--health-timeout 5s
80+
--health-retries 5
81+
env:
82+
MYSQL_HOST: '127.0.0.1'
83+
PGHOST: '127.0.0.1'
84+
PGUSER: 'postgres'
85+
PGPASSWORD: 'password'
86+
steps:
87+
- name: checkout
88+
uses: actions/checkout@v3
89+
- name: setup-go
90+
uses: actions/setup-go@v4
91+
with:
92+
go-version: ${{ matrix.go-version }}
93+
cache: true
94+
cache-dependency-path: go.sum
95+
- name: setup databases
96+
run: |
97+
mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test;'
98+
mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test_env;'
99+
psql -U postgres -c 'CREATE DATABASE test;'
100+
- name: install sql-migrate
101+
run: go install ./...
102+
- name: postgres
103+
run: bash ./test-integration/postgres.sh
104+
- name: mysql
105+
run: bash ./test-integration/mysql.sh
106+
- name: mysql-flag
107+
run: bash ./test-integration/mysql-flag.sh
108+
- name: mysql-env
109+
run: bash ./test-integration/mysql-env.sh
110+
- name: sqlite
111+
run: bash ./test-integration/sqlite.sh

.travis.yml

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Up/down migrations to allow rollback
1515
* Supports multiple database types in one project
1616
* Works great with other libraries such as [sqlx](https://jmoiron.github.io/sqlx/)
17+
* Supported on go1.13+
1718

1819
## Installation
1920

0 commit comments

Comments
 (0)