feat: publish release manifests as github release asset #181
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: test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
ci: | |
name: Continuous Integration | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # pin@v5 | |
with: | |
go-version: "1.22" | |
# see https://github.com/actions/setup-go?tab=readme-ov-file#caching-dependency-files-and-build-outputs | |
cache-dependency-path: | | |
go.sum | |
- name: Checkout Repo | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 | |
- name: Get dependencies | |
run: go mod download | |
- name: Build | |
run: make | |
- name: Run Unit-Tests | |
run: make test | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: cover.out | |
coverage: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
needs: ci | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4 | |
- name: Download Coverage Report | |
uses: actions/download-artifact@v4 | |
with: | |
name: code-coverage | |
- name: Print Coverage | |
run: | | |
echo "Code coverage report:" | |
go tool cover -func=cover.out | |
- name: Check Coverage Threlshold | |
env: | |
COVERAGE_THRESHOLD: 70 | |
run: | | |
echo "Checking if test coverage is above threshold..." | |
echo "Threlshold: $COVERAGE_THRESHOLD%" | |
totalCoverage=$(go tool cover -func=cover.out | grep total | awk '{print substr($3, 1, length($3)-1)}') | |
echo "Total project's coverage: $totalCoverage%" | |
if (( $(echo "$totalCoverage $COVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then | |
echo "OK" | |
else | |
echo "Current total test coverage is below the projects threshold." | |
echo "Please add more tests." | |
exit 1 | |
fi |