From 152d3ed094b29de80ab337aefde5f3532e2aabdc Mon Sep 17 00:00:00 2001 From: Samir Faci Date: Thu, 3 Oct 2024 20:28:46 -0400 Subject: [PATCH] Refactoring actions --- .github/workflows/integration_tests.yml | 63 ++++++++++++++++++++----- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 6052baa6..182cb1e5 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -1,6 +1,7 @@ name: Go on: + workflow_call: push: branches: - master @@ -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.22.5" jobs: - test: + initialize_data: runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -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@v4 + with: + name: testData + include-hidden-files: true + path: ${{ github.workspace }}/tests/.gentestdata/ + maria_test: + needs: initialize_data + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/download-artifact@v4 + with: + name: testData + path: ./tests/.gentestdata + - name: Run MariaDB tests + run: MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/ + couchdb_test: + needs: initialize_data + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/download-artifact@v4 + with: + name: testData + 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: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/download-artifact@v4 + with: + name: testData + path: ./tests/.gentestdata + - name: Install GoTest + run: go install gotest.tools/gotestsum@latest # to create test results report - name: Install go-junit-report run: go install github.com/jstemmer/go-junit-report@latest @@ -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: