You've already forked prometheus-fail2ban-exporter
All checks were successful
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-amd64) (push) Successful in 40s
Lint Golang files / Run golang CI linter (stable, ubuntu-latest-arm64) (push) Successful in 1m5s
Run Golang tests / Run unit tests (stable, ubuntu-latest-amd64) (push) Successful in 30s
Run Golang tests / Run unit tests (stable, ubuntu-latest-arm64) (push) Successful in 1m0s
Lint Markdown files / Run markdown linter (push) Successful in 9s
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: "Run Golang tests"
|
|
|
|
on:
|
|
pull_request:
|
|
types: [ "opened", "reopened", "synchronize" ]
|
|
push:
|
|
branches: [ '**' ]
|
|
tags-ignore: [ '**' ]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
# integration-test:
|
|
# name: "Run integration tests"
|
|
# runs-on: ${{ matrix.os }}
|
|
# strategy:
|
|
# matrix:
|
|
# go: [ stable ]
|
|
# os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
|
# steps:
|
|
# - uses: actions/checkout@v4.3.0
|
|
# - uses: actions/setup-go@v5.5.0
|
|
# with:
|
|
# go-version: ${{ matrix.go }}
|
|
# - env:
|
|
# GOPROXY: ${{ vars.GOPROXY }}
|
|
# run: make test/integration
|
|
|
|
unit-test:
|
|
name: "Run unit tests"
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
go: [ stable ]
|
|
os: [ ubuntu-latest-amd64, ubuntu-latest-arm64 ]
|
|
steps:
|
|
- uses: actions/checkout@v5.0.0
|
|
- uses: actions/setup-go@v6.0.0
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
- env:
|
|
GOPROXY: ${{ vars.GOPROXY }}
|
|
run: make test/unit
|
|
- id: coverage
|
|
name: Check coverage
|
|
run: |
|
|
coverage="$(make test/coverage | grep total | awk '{ print substr($3, 1, length($3)-1); }')"
|
|
echo "total_coverage=$coverage" >> $GITHUB_OUTPUT
|
|
echo "Total coverage: ${coverage}%"
|
|
- name: Fail if coverage is to low
|
|
run: |
|
|
threshold=5
|
|
total_coverage=${{ steps.coverage.outputs.total_coverage }}
|
|
|
|
if (( ${total_coverage%.*} < ${threshold} )); then
|
|
echo "ERROR: Coverage (${total_coverage}%) is below the threshold (${threshold}%)." 1>&2
|
|
exit 1
|
|
fi |