Skip to content

feat: add SQLDB() to get the underlying database/sql.(*DB) from a store #790

feat: add SQLDB() to get the underlying database/sql.(*DB) from a store

feat: add SQLDB() to get the underlying database/sql.(*DB) from a store #790

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
mysql-tests:
name: MySQL tests - Go v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.17.x"
- "1.18.x"
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root#
ports:
- 3307:3306
# needed because the mysql container does not provide a healthcheck
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 5s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Setup MySQL environment
run: |
mysqldump --version
echo $HOME
echo -e "[mysqldump]\ncolumn-statistics=0" > $HOME/.my.cnf
- name: Build and run soda
env:
SODA_DIALECT: "mysql"
MYSQL_PORT: 3307
run: |
go build -v -tags sqlite -o tsoda ./soda
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "mysql"
MYSQL_PORT: 3307
run: |
go test -tags sqlite -race -cover ./...
pg-tests:
name: PostgreSQL tests - Go v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.17.x"
- "1.18.x"
services:
postgres:
image: postgres:10
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres#
POSTGRES_DB: postgres
ports:
- 5433:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Build and run soda
env:
SODA_DIALECT: "postgres"
POSTGRESQL_URL: "postgres://postgres:postgres%[email protected]:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable"
run: |
go build -v -tags sqlite -o tsoda ./soda
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "postgres"
POSTGRESQL_URL: "postgres://postgres:postgres%[email protected]:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable"
run: |
go test -tags sqlite -race -cover ./...
crdbssl-tests:
name: Cockroach SSL tests - Go v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.17.x"
- "1.18.x"
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Install Cockroach SSL
run: |
mkdir -p crdb/certs
pushd crdb
wget -qO- https://binaries.cockroachdb.com/cockroach-v21.1.19.linux-amd64.tgz | tar -xz
mv cockroach-v21.1.19.linux-amd64/* .
ln -s `pwd`/cockroach /usr/local/bin/
cockroach version
./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-single-node --certs-dir certs --listen-addr localhost --port 26259 --http-port 8089 --background
popd
- name: Build and run soda
env:
SODA_DIALECT: "cockroach_ssl"
run: |
go build -v -tags sqlite -o tsoda ./soda
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "cockroach_ssl"
run: |
go test -tags sqlite -race -cover ./...
crdb-tests:
name: Cockroach tests
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.17.x"
- "1.18.x"
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Install Cockroach
run: |
mkdir -p crdb
pushd crdb
wget -qO- https://binaries.cockroachdb.com/cockroach-v21.1.19.linux-amd64.tgz | tar -xz
mv cockroach-v21.1.19.linux-amd64/* .
ln -s `pwd`/cockroach /usr/local/bin/
./cockroach start-single-node --insecure --background
popd
- name: Build and run soda
env:
SODA_DIALECT: "cockroach"
COCKROACH_PORT: 26257
run: |
go build -v -tags sqlite -o tsoda ./soda
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "cockroach"
COCKROACH_PORT: 26257
run: |
go test -tags sqlite -race -cover ./...
sqlite-tests:
name: SQLite tests ${{ matrix.os }} - Go v${{ matrix.go-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version:
- "1.17.x"
- "1.18.x"
os:
- "macos-latest"
- "windows-latest"
- "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Build and run soda
env:
SODA_DIALECT: "sqlite"
run: |
go build -v -tags sqlite -o tsoda ./soda
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
shell: bash
- name: Test
if: ${{ matrix.os != 'windows-latest' }}
env:
SODA_DIALECT: "sqlite"
run: |
go test -tags sqlite -race -cover ./...
- name: Short Test
if: ${{ matrix.os == 'windows-latest' }}
env:
SODA_DIALECT: "sqlite"
run: |
go test -tags sqlite ./...