name: CI on: push: branches: [ develop ] pull_request: branches: [ develop ] jobs: build-test: runs-on: docker container: image: gitea.jeanlucmakiola.de/makiolaj/docker-node-and-go:064281efa4401d6f440edd18dc467929b89d7f71 env: GOTOOLCHAIN: local steps: - name: Checkout code uses: actions/checkout@v6 - name: Check formatting run: | unformatted=$(gofmt -l .) if [ -n "$unformatted" ]; then echo "Unformatted files:" echo "$unformatted" exit 1 fi - name: Run go vet run: go vet ./... - name: Run tests with coverage run: | go test -v -coverprofile=coverage.out -coverpkg=./... ./... go tool cover -func=coverage.out | tee coverage.txt cov=$(go tool cover -func=coverage.out | grep total: | awk '{print substr($3, 1, length($3)-1)}') cov=${cov%.*} if [ "$cov" -lt 80 ]; then echo "::warning::Test coverage is below 80% ($cov%)" fi - name: Build binary run: go build ./...