From f7ca1411f542fa80abe875d730bb5e9d820841fc Mon Sep 17 00:00:00 2001 From: KaushikiAnand Date: Mon, 17 Mar 2025 16:27:55 +0530 Subject: [PATCH 1/2] workflow updations --- .github/workflows/golangci.yml | 26 +++++++++++++++++++------- .go-version | 2 +- go.mod | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml index 75c590f..d46eaf3 100644 --- a/.github/workflows/golangci.yml +++ b/.github/workflows/golangci.yml @@ -3,8 +3,7 @@ name: golangci on: push: branches: - - main - pull_request: + - coverage-test permissions: contents: read @@ -16,7 +15,8 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - name: Checkout code + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install Go uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 @@ -33,7 +33,8 @@ jobs: name: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - name: Checkout code + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install Go uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 @@ -41,13 +42,23 @@ jobs: go-version-file: '.go-version' - name: run go test - run: go test -v ./... + run: go test -v -coverprofile=coverage.out ./... + + - name: upload coverage report + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 + with: + path: coverage.out + name: coverage-report + + - name: display coverage report + run: go tool cover -func=coverage.out go-mod-tidy: name: tidy runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - name: Checkout code + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install Go uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 @@ -61,7 +72,8 @@ jobs: name: build executables runs-on: 'ubuntu-latest' steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - name: Checkout code + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Install Go uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 diff --git a/.go-version b/.go-version index d2ab029..a1b6e17 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.21 +1.23 diff --git a/go.mod b/go.mod index c102eab..2869b63 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/copywrite -go 1.21 +go 1.23 toolchain go1.23.1 From 5c3b9b92f471c61acaead1f19fdc33ce5953ef8d Mon Sep 17 00:00:00 2001 From: KaushikiAnand Date: Mon, 17 Mar 2025 16:53:49 +0530 Subject: [PATCH 2/2] IND-2618 workflow updated with unit test coverage --- .github/workflows/golangci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml index d46eaf3..7a2c7f2 100644 --- a/.github/workflows/golangci.yml +++ b/.github/workflows/golangci.yml @@ -3,7 +3,8 @@ name: golangci on: push: branches: - - coverage-test + - main + pull_request: permissions: contents: read