Skip to content

update latest package 20240106 (#118) #177

update latest package 20240106 (#118)

update latest package 20240106 (#118) #177

Workflow file for this run

name: Unit tests
on:
pull_request:
push:
paths:
- "**.go"
- "go.mod"
- "go.sum"
- ".github/workflows/*.yml"
- "example/hasura/docker-compose.yaml"
jobs:
test-go:
name: Run Go lint and unit tests
runs-on: ubuntu-20.04
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
run: |
go get -t -v ./...
go install ./...
- name: Format
run: diff -u <(echo -n) <(gofmt -d -s .)
- name: Vet
run: go vet ./...
- name: Setup integration test infrastructure
run: |
cd ./example/hasura
docker-compose up -d
- name: Run Go unit tests
run: go test -v -race -timeout 3m -coverprofile=coverage.out ./...
- name: Go coverage format
run: |
go get github.com/boumenot/gocover-cobertura
go install github.com/boumenot/gocover-cobertura
gocover-cobertura < coverage.out > coverage.xml
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: "60 80"
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name == 'pull_request_target' }}
with:
path: code-coverage-results.md
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2