From 5058b02404b18d571adde19ba1ff32d64d30c2d5 Mon Sep 17 00:00:00 2001 From: NagaTulasi Date: Thu, 19 Sep 2024 12:01:58 +0530 Subject: [PATCH] add tests to the CI/CD tests --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6d1517e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Tests + +on: + pull_request: + push: + branches: + - main + +concurrency: + group: ci-${{ github.ref }}-tests + cancel-in-progress: true + +jobs: + tests: + name: Tests and code coverage + runs-on: ubuntu-latest + steps: + - name: Install GO + uses: actions/setup-go@v3 + with: + go-version: "1.22" + - name: Checkout code + uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.0 + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - name: run all tests and generate coverage + run: go test -v -mod=readonly -timeout 30m -coverprofile=coverage.txt -tags='norace' -covermode=atomic `go list ./... | grep -v simapp` + if: env.GIT_DIFF + - name: Upload codecov report + uses: codecov/codecov-action@v3.1.0 + with: + file: coverage.txt + if: env.GIT_DIFF \ No newline at end of file