From 70b71371c025cb47e521c21eb46d073fb70085f0 Mon Sep 17 00:00:00 2001 From: Sakthi Santhosh Date: Tue, 12 Aug 2025 17:44:16 +0530 Subject: [PATCH 1/3] Add: CI Pipeline --- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a3b7039 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + push: + branches-ignore: + - main + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Set-up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + - name: Perform Linting with golangci-lint + uses: golangci/golangci-lint-action@v8 + + test: + runs-on: ubuntu-latest + needs: lint + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Set-up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + - name: Go Vet + run: go vet ./... + - name: Perform Unit Testing + run: go test -race -coverprofile=coverage.out -covermode=atomic ./... + - name: Generate HTML Coverage + run: go tool cover -html=coverage.out -o coverage.html + - name: Upload Coverage Artifacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: Test Coverage + path: | + coverage.out + coverage.html From bca949f97ab777934bd502815ef98e84289f3f54 Mon Sep 17 00:00:00 2001 From: Sakthi Santhosh Date: Tue, 12 Aug 2025 17:47:40 +0530 Subject: [PATCH 2/3] Update: Run `test` Job Regardless of `lint` Job's Success of Failure --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3b7039..283cd0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,8 @@ on: branches-ignore: - main + workflow_dispatch: + permissions: contents: read @@ -28,7 +30,6 @@ jobs: test: runs-on: ubuntu-latest - needs: lint steps: - name: Checkout Code uses: actions/checkout@v4 From a6868a607a286870060b68e59e459c5685f242b3 Mon Sep 17 00:00:00 2001 From: Sakthi Santhosh Date: Tue, 12 Aug 2025 17:53:09 +0530 Subject: [PATCH 3/3] Update: Remove Vetting (taken care by golangci-lint) --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 283cd0c..8356278 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ concurrency: jobs: lint: + name: Perform Code Linting runs-on: ubuntu-latest steps: - name: Checkout Code @@ -29,6 +30,7 @@ jobs: uses: golangci/golangci-lint-action@v8 test: + name: Perform Unit Tests and Generate Coverage File runs-on: ubuntu-latest steps: - name: Checkout Code @@ -38,8 +40,6 @@ jobs: with: go-version-file: go.mod cache: true - - name: Go Vet - run: go vet ./... - name: Perform Unit Testing run: go test -race -coverprofile=coverage.out -covermode=atomic ./... - name: Generate HTML Coverage @@ -50,5 +50,5 @@ jobs: with: name: Test Coverage path: | - coverage.out - coverage.html + ./coverage.out + ./coverage.html