Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ci-kotlin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: sqlc kotlin test suite
on: [push, pull_request]
jobs:

build:
name: Build And Test
runs-on: ubuntu-latest

services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@master
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: eskatos/gradle-command-action@v1
env:
PG_USER: postgres
PG_HOST: localhost
PG_DATABASE: postgres
PG_PASSWORD: postgres
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
with:
build-root-directory: examples/kotlin
wrapper-directory: examples/kotlin
arguments: test --scan
4 changes: 3 additions & 1 deletion examples/kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ compileKotlin {
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}

buildScan { termsOfServiceUrl = "https://gradle.com/terms-of-service"; termsOfServiceAgree = "yes" }
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class QueriesImplTest {
@BeforeEach
fun setup() {
val user = System.getenv("PG_USER") ?: "postgres"
val port = System.getenv("PG_PORT") ?: "5432"
val pass = System.getenv("PG_PASSWORD") ?: "mysecretpassword"
val host = System.getenv("PG_HOST") ?: "127.0.0.1"
val db = System.getenv("PG_DB") ?: "postgres"
val pass = System.getenv("PG_PASS") ?: "postgres"
val port = System.getenv("PG_PORT") ?: "5432"
val db = System.getenv("PG_DATABASE") ?: "dinotest"
val url = "jdbc:postgresql://$host:$port/$db?user=$user&password=$pass&sslmode=disable"
println("db: $url")

Expand Down
4 changes: 2 additions & 2 deletions internal/endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func cmpDirectory(t *testing.T, dir string, actual map[string]string) {
if file.IsDir() {
return nil
}
if !strings.HasSuffix(path, ".go") {
if !strings.HasSuffix(path, ".go") && !strings.HasSuffix(path, ".kt") {
return nil
}
if strings.HasSuffix(path, "_test.go") {
if strings.HasSuffix(path, "_test.go") || strings.Contains(path, "src/test/") {
return nil
}
blob, err := ioutil.ReadFile(path)
Expand Down
4 changes: 4 additions & 0 deletions internal/sqltest/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ func PostgreSQL(t *testing.T, migrations string) (*sql.DB, func()) {
pgUser = "postgres"
}

if pgPass == "" {
pgPass = "mysecretpassword"
}

if pgPort == "" {
pgPort = "5432"
}
Expand Down