Skip to content

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #66

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #66

Workflow file for this run

name: Go
on:
push:
branches:
- master
pull_request:
branches:
- master
defaults:
run:
shell: bash
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
test:
name: Testing
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1.21
- name: Download gocov
run: go install github.com/axw/gocov/gocov@master
- name: Checkout code
uses: actions/checkout@v3
- name: Run tests
run: gocov test ./... -race -failfast -timeout 3m > coverage.out
- name: Save coverage
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: coverage.out
coverage:
name: Coverage
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1.21
- name: Download gocov
run: go install github.com/axw/gocov/gocov@master
- name: Load coverage report
uses: actions/[email protected]
with:
name: coverage-data
- name: Check coverage
run: |
cov=$(gocov report coverage.out | sed -nE 's/^Total Coverage: (.+)%.*$/\1/p')
if [[ -z "${cov}" || "${cov}" == "NaN" ]]; then
echo "Invalid coverage data"
exit 1
fi
readonly MIN_COV=96.96
if (( "$(echo "${cov} < ${MIN_COV}" | bc)" )); then
echo "Coverage: ${cov}%, minimum allowed: ${MIN_COV}%"
exit 1
fi
echo "Coverage: ${cov}%"