OnMergeRelease #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OnMergeRelease | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release/*' | |
tags: | |
- '**' | |
jobs: | |
build-test-scan: | |
runs-on: [ ubuntu-20.04 ] | |
env: | |
http_proxy: ${{ secrets.HTTP_PROXY }} | |
https_proxy: ${{ secrets.HTTPS_PROXY }} | |
no_proxy: ${{ secrets.NO_PROXY }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Style Checker | |
run: | | |
make go-fmt | |
if [ "$(make go-fmt | tail -n 1 | grep gofmt | wc -l)" -eq 0 ]; then | |
exit 1 | |
fi | |
- name: Unit Test | |
run: | | |
make test | |
if [ $? -ne 0 ]; then | |
exit 1 | |
fi | |
- name: Unit Test Coverage | |
run: | | |
make test-coverage | |
COVERAGE=$(make test-coverage | grep 'total' | awk '{print $3}' | awk -F. '{print $1}') | |
echo "Unit test coverage is - $COVERAGE%" | |
if [[ $COVERAGE -lt 80 ]]; then | |
echo "Unit test coverage must be above 80% " | |
exit 1 | |
fi |