-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f3b4d6
commit 8f7607e
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
env: | ||
TEST_RESULTS: /tmp/test-results # path to where test results will be saved | ||
|
||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21.6" | ||
- 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 | ||
# to create test results report | ||
- name: Install go-junit-report | ||
run: go install github.com/jstemmer/go-junit-report@latest | ||
- name: Setup Test Report Dir | ||
run: mkdir -p $TEST_RESULTS | ||
# this will run all tests and exclude test files from code coverage report | ||
- name: Run Tests | ||
run: | | ||
go test -v ./... \ | ||
-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: | ||
name: code-coverage-report | ||
path: $TEST_RESULTS/results.xml | ||
- name: Store cover.out | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cover.out | ||
path: cover.out | ||
- name: Store test-results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-results | ||
path: /tmp/test-results |