Skip to content

Commit

Permalink
Add integration test workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterldowns committed May 30, 2023
1 parent 86c7d37 commit 4339ec7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 35 deletions.
69 changes: 67 additions & 2 deletions .github/workflows/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
test:
strategy:
fail-fast: false
fail-fast: true
matrix:
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20']
runs-on: ubuntu-latest
Expand Down Expand Up @@ -42,5 +42,70 @@ jobs:
- name: go mod tidy
run: go mod tidy
- name: check for any changes
run: >
run: |
[[ $(git status --porcelain) == "" ]] || (echo "changes detected" && exit 1)
integration:
needs:
- test
- lint
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
go-version: [ '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20']
services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: '1'
MYSQL_ROOT_PASSWORD: ''
MYSQL_DATABASE: 'test'
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: 'password'
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MYSQL_HOST: '127.0.0.1'
PGHOST: '127.0.0.1'
PGUSER: 'postgres'
PGPASSWORD: 'password'
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup-go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: go.sum
- name: setup databases
run: |
mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test;'
mysql --user=root -e 'CREATE DATABASE IF NOT EXISTS test_env;'
psql -U postgres -c 'CREATE DATABASE test;'
- name: install sql-migrate
run: go install ./...
- name: postgres
run: bash ./test-integration/postgres.sh
- name: mysql
run: bash ./test-integration/mysql.sh
- name: mysql-flag
run: bash ./test-integration/mysql-flag.sh
- name: mysql-env
run: bash ./test-integration/mysql-env.sh
- name: sqlite
run: bash ./test-integration/sqlite.sh
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

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

## Installation

Expand Down

0 comments on commit 4339ec7

Please sign in to comment.