Skip to content

Bump safer-golangci-lint.yml to 1.52.2 #107

Bump safer-golangci-lint.yml to 1.52.2

Bump safer-golangci-lint.yml to 1.52.2 #107

Workflow file for this run

# Copyright 2020-present Montgomery Edwards⁴⁴⁸ (github.com/x448).
# This file is licensed under MIT License.
#
# Go Cover - GitHub Actions Workflow
# This GitHub Actions workflow checks if Go code coverage satisfies the required minimum.
# The required minimum is specified in the workflow name. This keeps badge.svg and verified minimum in sync.
#
# To help protect your privacy, this workflow avoids external services.
# Using script visible here, this workflow simply runs `go test -short -cover` --> grep --> python.
#
# Steps to install and set minimum required coverage:
# 0. Copy this file to github.com/OWNER_NAME/REPO_NAME/.github/workflows/cover.yml
# 1. Change workflow name from "cover 100%" to "cover ≥92.5%". Script will automatically use 92.5%.
# 2. Change README.md to use the new path to badge.svg because the path includes the workflow name.
name: cover 100%
# Remove default permissions
permissions: {}
on: [push]
jobs:
# Verify minimum coverage is reached using `go test -short -cover` on latest-ubuntu with default version of Go.
# The grep expression can't be too strict, it needed to be relaxed to work with different versions of Go.
cover:
name: Coverage
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Go Coverage
run: |
go version
go test -short -cover | grep "^.*coverage:.*of statements$" | python -c "import os,re,sys; cover_rpt = sys.stdin.read(); print(cover_rpt) if len(cover_rpt) != 0 else sys.exit(1); min_cover = float(re.findall(r'\d*\.\d+|\d+', os.environ['GITHUB_WORKFLOW'])[0]); cover = float(re.findall(r'\d*\.\d+|\d+', cover_rpt)[0]); sys.exit(1) if (cover > 100) or (cover < min_cover) else sys.exit(0)"
shell: bash