Skip to content

chore: update readme #19

chore: update readme

chore: update readme #19

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- main
- 'release/*'
pull_request:
branches:
- main
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
jobs:
testing:
name: testing
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
check-latest: true
cache-dependency-path: subdir/go.sum
- name: Run tests
run: go test ./... -v
- name: Test coverage
run: go test -coverprofile=coverage.out ./...
- name: Check coverage
run: |
go tool cover -func=coverage.out
COVERAGE=$(go tool cover -func=coverage.out | grep "total:" | awk '{ print substr($3, 1, length($3)-1) }')
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "Total coverage is below 90%"
exit 1
fi
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.out
golint:
name: golint
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
check-latest: true
cache-dependency-path: subdir/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
version:
name: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
WITH_V: false
badge:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
golang-version: [ 1.20 ]
permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
discussions: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: './go.mod'
check-latest: true
cache-dependency-path: subdir/go.sum
- name: Unit Test
run: |
make test
- name: Go Coverage Badge
uses: tj-actions/[email protected]
with:
filename: coverage.out
- name: Verify Changed files
uses: tj-actions/[email protected]
id: verify-changed-files
with:
files: README.md
- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: updated coverage badge"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GIT_TOKEN }}
branch: main