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:
1111 strategy :
1212 matrix :
1313 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+
1443 env :
1544 GOFLAGS : " -mod=vendor"
1645 GODEBUG : " x509sha1=1"
46+ BUILD_TAGS : " postgresql"
47+ PGHOST : localhost
48+ MYSQL_HOST : 127.0.0.1
1749 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;
1853 - uses : actions/checkout@v2
1954
2055 - name : Set up Go
@@ -24,11 +59,11 @@ jobs:
2459
2560 - name : Build
2661 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;
2865 - name : Test
2966 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
3267 - uses : codecov/codecov-action@v3
3368
3469 golangci :
Original file line number Diff line number Diff line change 11development :
22 driver : postgres
3- open : dbname=certdb_development sslmode=disable
3+ open : dbname=certdb_development sslmode=disable user=postgres
44
55test :
66 driver : postgres
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ func MySQLDB() *sqlx.DB {
6060
6161// PostgreSQLDB returns a PostgreSQL db instance for certdb testing.
6262func PostgreSQLDB () * sqlx.DB {
63- connStr := "dbname=certdb_development sslmode=disable"
63+ connStr := "dbname=certdb_development sslmode=disable user=postgres "
6464
6565 if dbURL := os .Getenv ("DATABASE_URL" ); dbURL != "" {
6666 connStr = dbURL
You can’t perform that action at this time.
0 commit comments