Skip to content

IND-2460 test.yaml updated with unit test coverage, .go-version file … #18

IND-2460 test.yaml updated with unit test coverage, .go-version file …

IND-2460 test.yaml updated with unit test coverage, .go-version file … #18

Workflow file for this run

name: CI Tests
on:
pull_request:
paths-ignore:
- 'README.md'
push:
branches:
- 'main'
paths-ignore:
- 'README.md'
permissions:
contents: read
jobs:
go-fmt-and-vet:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Setup Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: '>=1.21'
cache: true
- name: Go formatting
run: |
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
go-test:
needs: go-fmt-and-vet
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Setup Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: '>=1.21'
cache: true
- name: Run test and generate coverage report
run: |
go test -race ./... -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