File tree Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Expand file tree Collapse file tree 3 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,45 @@ jobs:
11
11
strategy :
12
12
matrix :
13
13
go : ["1.18", "1.19"]
14
+ services :
15
+ # Label used to access the service container
16
+ postgres :
17
+ # Docker Hub image
18
+ image : postgres
19
+ # Provide the password for postgres
20
+ env :
21
+ POSTGRES_DB : postgres_db
22
+ POSTGRES_PASSWORD : " "
23
+ POSTGRES_HOST_AUTH_METHOD : trust # allow no password
24
+ POSTGRES_PORT : 5432
25
+ POSTGRES_USER : postgres
26
+ # Set health checks to wait until postgres has started
27
+ options : >-
28
+ --health-cmd pg_isready
29
+ --health-interval 10s
30
+ --health-timeout 5s
31
+ --health-retries 5
32
+ ports :
33
+ - 5432:5432
34
+ mysql :
35
+ image : mysql
36
+ env :
37
+ MYSQL_ALLOW_EMPTY_PASSWORD : yes
38
+ MYSQL_ROOT_PASSWORD : " "
39
+ ports :
40
+ - 3306:3306
41
+ options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
42
+
14
43
env :
15
44
GOFLAGS : " -mod=vendor"
16
45
GODEBUG : " x509sha1=1"
46
+ BUILD_TAGS : " postgresql"
47
+ PGHOST : localhost
48
+ MYSQL_HOST : 127.0.0.1
17
49
steps :
50
+ - run : psql -c 'create database certdb_development;' -U postgres;
51
+ - run : mysql -e 'create database certdb_development;' -u root;
52
+ - run : mysql -e 'SET global sql_mode = 0;' -u root;
18
53
- uses : actions/checkout@v2
19
54
20
55
- name : Set up Go
@@ -24,11 +59,11 @@ jobs:
24
59
25
60
- name : Build
26
61
run : go build -v ./...
27
-
62
+ - run : make bin/goose;
63
+ - run : ./bin/goose -path certdb/pg up;
64
+ - run : ./bin/goose -path certdb/mysql up;
28
65
- name : Test
29
66
run : ./test.sh
30
- # todo: these Actions tests still need to be updated to run the database tests
31
- # that used to run in travis
32
67
- uses : codecov/codecov-action@v3
33
68
34
69
golangci :
Original file line number Diff line number Diff line change 1
1
development :
2
2
driver : postgres
3
- open : dbname=certdb_development sslmode=disable
3
+ open : dbname=certdb_development sslmode=disable user=postgres
4
4
5
5
test :
6
6
driver : postgres
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ func MySQLDB() *sqlx.DB {
60
60
61
61
// PostgreSQLDB returns a PostgreSQL db instance for certdb testing.
62
62
func PostgreSQLDB () * sqlx.DB {
63
- connStr := "dbname=certdb_development sslmode=disable"
63
+ connStr := "dbname=certdb_development sslmode=disable user=postgres "
64
64
65
65
if dbURL := os .Getenv ("DATABASE_URL" ); dbURL != "" {
66
66
connStr = dbURL
You can’t perform that action at this time.
0 commit comments