Skip to content

chore: Fix linter warning πŸ› πŸ’š #53

chore: Fix linter warning πŸ› πŸ’š

chore: Fix linter warning πŸ› πŸ’š #53

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: golangci/[email protected]
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
# Alternatively, install using go install
- name: Set up gotestfmt
run: go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
# Run tests with nice formatting. Save the original log in /tmp/gotest.log
- name: Run tests and Check Coverage
run: |
set -euo pipefail
go test -json -race -covermode=atomic -coverprofile=coverage.out ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
COVERAGE=$(cat /tmp/gotest.log | sed -nr "s/.*coverage:.([0-9.]+).*/\1/p" | uniq)
echo "COVERAGE=${COVERAGE}" >> $GITHUB_ENV
- name: Check coverage tolerance
if: ${{ env.COVERAGE < env.COVER_THRESHOLD }}
run: |
echo "Coverage test of ${{ env.COVERAGE }} below tolerance of ${{ env.COVER_THRESHOLD }}"
exit 1
- name: Update coverage badge
uses: cybercinch/dynamic-badges-action@master
with:
auth: ${{ secrets.BADGE_API_TOKEN }}
host: https://badges.cybercinch.nz/go-semantic-release/provider-gitea/coverage
label: Coverage
message: ${{ env.COVERAGE }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.COVERAGE }}
if: github.event_name != 'pull_request'
build:
runs-on: ${{ matrix.os }}
needs:
- lint
- test
strategy:
fail-fast: true
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- run: go build ./_cmd/provider-gitea/
# - run: go test -v ./...
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: go-semantic-release/action@v1
with:
hooks: goreleaser,plugin-registry-update
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
PLUGIN_REGISTRY_ADMIN_ACCESS_TOKEN: ${{ secrets.PLUGIN_REGISTRY_ADMIN_ACCESS_TOKEN }}
if: github.event_name != 'pull_request'