From 5043cc309eb8a4d101d67d30fc40168381e31ae4 Mon Sep 17 00:00:00 2001 From: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:39:20 +0000 Subject: [PATCH 1/2] base migration --- .drone.yml | 36 ------------------------------------ .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 36 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/ci.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index d642f57..0000000 --- a/.drone.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -kind: pipeline -type: docker -name: sqlds - -platform: - os: linux - arch: amd64 - -services: - - image: mysql:8.0 - name: "mysql" - environment: - MYSQL_USER: mysql - MYSQL_PASSWORD: mysql - MYSQL_DATABASE: mysql - MYSQL_ALLOW_EMPTY_PASSWORD: "true" - -steps: - - name: "test" - image: golang:1.23 - commands: - - go test ./... - - name: "integraiton_tests" - image: golang:1.23 - environment: - INTEGRATION_TESTS: "true" - MYSQL_URL: "mysql:mysql@tcp(mysql:3306)/mysql" - commands: - - go test ./... - ---- -kind: signature -hmac: c0180c482d09eb104459401b1d169bfbd14c204804b823ac21703ea9e3ce284b - -... diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0a41ca1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: ci +on: + pull_request: + push: + branches: + - main +permissions: + contents: read +env: + GO_VERSION: 1.23 +jobs: + tests: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: mysql + MYSQL_USER: mysql + MYSQL_PASSWORD: mysql + MYSQL_HOST: 127.0.0.1 + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - name: checkout + uses: actions/checkout@v4 + - name: setup Go environment + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: "**/*.sum" + - name: Test + run: go test ./... + - name: Integration tests + run: go test ./... + env: + INTEGRATION_TESTS: "true" + MYSQL_URL: "mysql:mysql@tcp(127.0.0.1:3306)/mysql" From 1161da6d3c3ad13641625d624b2ad2cad6f82f55 Mon Sep 17 00:00:00 2001 From: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:47:11 +0000 Subject: [PATCH 2/2] enable verbose log --- .github/workflows/ci.yml | 4 ++-- query_integration_test.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a41ca1..660c24b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,9 +32,9 @@ jobs: go-version: ${{ env.GO_VERSION }} cache-dependency-path: "**/*.sum" - name: Test - run: go test ./... + run: go test -v ./... - name: Integration tests - run: go test ./... + run: go test -v ./... env: INTEGRATION_TESTS: "true" MYSQL_URL: "mysql:mysql@tcp(127.0.0.1:3306)/mysql" diff --git a/query_integration_test.go b/query_integration_test.go index 51d6c9e..d39d0ad 100644 --- a/query_integration_test.go +++ b/query_integration_test.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "errors" - "log" "os" "strings" "testing" @@ -55,7 +54,7 @@ func TestQuery_MySQL(t *testing.T) { // Attempt to connect multiple times because these tests are ran in Drone, where the mysql server may not be immediately available when this test is ran. limit := 10 for i := 0; i < limit; i++ { - log.Println("Attempting mysql connection...") + t.Log("Attempting mysql connection...") d, err := sql.Open("mysql", args.MySQLURL) if err == nil { if err := d.Ping(); err == nil {