Skip to content

Update Patch and digest updates #131

Update Patch and digest updates

Update Patch and digest updates #131

Workflow file for this run

name: Golang Test
on:
push:
pull_request:
jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
with:
# Hard-coding version due to this bug: https://github.com/golangci/golangci-lint-action/issues/535
version: v1.52.2
test:
name: go test
runs-on: ubuntu-latest
env:
GITHUB_ACTION: true
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4
with:
go-version: 1.18
- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-test-${{ hashFiles('**/go.sum') }}
restore-keys: go-test-
- name: Run go test
run: |
set -euo pipefail
go generate
go test -coverprofile /tmp/coverage.out -json -v ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
echo "# Code coverage summary" > /tmp/coverage.md
echo "|File|Type|Coverage|" >> /tmp/coverage.md
echo "|----|----|--------|" >> /tmp/coverage.md
go tool cover -func /tmp/coverage.out | sed -e 's/\s\s*/|/g' -e 's/^/|/g' -e 's/$/|/g' >> /tmp/coverage.md
cat /tmp/coverage.md >> $GITHUB_STEP_SUMMARY
echo "::group::Code coverage summary"
go tool cover -func /tmp/coverage.out
echo "::endgroup::"
- name: Upload test log
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
if: always()
with:
name: test-results
path: |
/tmp/gotest.log
/tmp/coverage.out
/tmp/coverage.md
if-no-files-found: error