Skip to content

Commit

Permalink
Refactoring actions
Browse files Browse the repository at this point in the history
  • Loading branch information
safaci2000 committed Oct 4, 2024
1 parent 96b447a commit ce848d0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 15 deletions.
63 changes: 51 additions & 12 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Go

on:
workflow_call:
push:
branches:
- master
Expand All @@ -9,10 +10,11 @@ on:
env:
TEST_RESULTS: /tmp/test-results # path to where test results will be saved
GH_ACTIONS: "1"
GO_VERSION: "1.21.6"


jobs:
test:
initialize_data:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand All @@ -22,17 +24,60 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21.6"
go-version: ${{ env.GO_VERSION }}
- name: Verify go version
run: go version
- name: Install GoTest
run: go install gotest.tools/gotestsum@latest
# - name: Install jet generator
# run: cd tests && make install-jet-gen
- name: Init database
run: |
cd tests
go run ./init/init.go -testsuite all
- uses: actions/upload-artifact@master
with:
name: generated-data
path: tests/.gentestdata
maria_test:
needs: initialize_data
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: generated-data
path: tests/.gentestdata
# run mariaDB and cockroachdb tests. No need to collect coverage, because coverage is already included with mysql and postgres tests
- name: Run MariaDB tests
run: MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/
couchdb_test:
needs: initialize_data
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: generated-data
path: tests/.gentestdata
- name: Run cockroach DB
run: PG_SOURCE=COCKROACH_DB go test -v ./tests/postgres/
standard_test:
needs: initialize_data
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: generated-data
path: tests/.gentestdata
# - name: Checkout Repository
# uses: actions/checkout@v4
# with:
# submodules: 'true'
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version: $GO_VERSION
# - name: Install GoTest
# run: go install gotest.tools/gotestsum@latest
# - uses: actions/download-artifact@master
# with:
# name: my-artifact
# path: tests/.gentestdata
# to create test results report
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report@latest
Expand All @@ -45,12 +90,6 @@ jobs:
-covermode=atomic \
-coverpkg=github.com/go-jet/jet/v2/postgres/...,github.com/go-jet/jet/v2/mysql/...,github.com/go-jet/jet/v2/sqlite/...,github.com/go-jet/jet/v2/qrm/...,github.com/go-jet/jet/v2/generator/...,github.com/go-jet/jet/v2/internal/... \
-coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml
# run mariaDB and cockroachdb tests. No need to collect coverage, because coverage is already included with mysql and postgres tests
- name: Run MariaDB tests
run: MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/
- name: Run cockroach DB
run: PG_SOURCE=COCKROACH_DB go test -v ./tests/postgres/
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/go-jet/jet/v2

go 1.22

toolchain go1.22.5
go 1.23

require (
github.com/go-sql-driver/mysql v1.8.1
Expand Down
11 changes: 11 additions & 0 deletions tests/mysql/generator_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mysql

import (
"fmt"
"github.com/go-jet/jet/v2/tests/internal/utils/common"
"os"
"os/exec"
Expand Down Expand Up @@ -245,6 +246,16 @@ func TestSQLBuilderColumnComment(t *testing.T) {
if common.IsHack() {
t.SkipNow()
}
x := 0
f1 := func(yield func() bool) {

}
for range f1 {
fmt.Println(x)
x++

}

testutils.AssertFileContent(t, "./../.gentestdata/mysql/test_sample/table/link.go", `
//
// Code generated by go-jet DO NOT EDIT.
Expand Down

0 comments on commit ce848d0

Please sign in to comment.