Replace Travis with Github CI

github-ci-wip
Jack Christensen 2021-01-30 17:17:42 -06:00
parent 14050e286d
commit 922508c785
5 changed files with 44 additions and 56 deletions

38
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [1.14, 1.15]
pg_version: [9.6, 10, 11, 12, 13]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Setup database server for testing
run: ci/setup_test.bash
env:
PGVERSION: ${{ matrix.pg_version }}
- name: Test
run: go test -v -race ./...
env:
PGX_TEST_DATABASE: postgres://pgx_md5:secret@127.0.0.1/pgx_test

View File

@ -1,33 +0,0 @@
language: go
go:
- 1.15.x
- 1.14.x
- tip
# Derived from https://github.com/lib/pq/blob/master/.travis.yml
before_install:
- ./travis/before_install.bash
env:
global:
- GO111MODULE=on
- PGX_TEST_DATABASE=postgres://pgx_md5:secret@127.0.0.1/pgx_test
matrix:
- CRATEVERSION=2.1 PGX_TEST_CRATEDB_CONN_STRING="host=127.0.0.1 port=6543 user=pgx database=pgx_test"
- PGVERSION=12
- PGVERSION=11
- PGVERSION=10
- PGVERSION=9.6
- PGVERSION=9.5
before_script:
- ./travis/before_script.bash
script:
- ./travis/script.bash
matrix:
allow_failures:
- go: tip

View File

@ -13,10 +13,6 @@ then
echo "local all postgres trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf
echo "local all all trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
echo "host all pgx_md5 127.0.0.1/32 md5" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
echo "host all pgx_pw 127.0.0.1/32 password" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
echo "hostssl all pgx_ssl 127.0.0.1/32 md5" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
echo "host replication pgx_replication 127.0.0.1/32 md5" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
echo "host pgx_test pgx_replication 127.0.0.1/32 md5" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
sudo chmod 777 /etc/postgresql/$PGVERSION/main/postgresql.conf
if $(dpkg --compare-versions $PGVERSION ge 9.6) ; then
echo "wal_level='logical'" >> /etc/postgresql/$PGVERSION/main/postgresql.conf
@ -24,6 +20,12 @@ then
echo "max_replication_slots=5" >> /etc/postgresql/$PGVERSION/main/postgresql.conf
fi
sudo /etc/init.d/postgresql restart
psql -U postgres -c 'create database pgx_test'
psql -U postgres pgx_test -c 'create extension hstore'
psql -U postgres pgx_test -c 'create domain uint64 as numeric(20,0)'
psql -U postgres -c "create user pgx_md5 SUPERUSER PASSWORD 'secret'"
psql -U postgres -c "create user `whoami`"
fi
if [ "${CRATEVERSION-}" != "" ]

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
set -eux
if [ "${PGVERSION-}" != "" ]
then
psql -U postgres -c 'create database pgx_test'
psql -U postgres pgx_test -c 'create domain uint64 as numeric(20,0)'
psql -U postgres -c "create user pgx_md5 SUPERUSER PASSWORD 'secret'"
fi

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -eux
if [ "${PGVERSION-}" != "" ]
then
go test -v -race ./...
elif [ "${CRATEVERSION-}" != "" ]
then
go test -v -race -run 'TestCrateDBConnect'
fi