From 1b81814d8c86492b42c494d896ae93872f5dfc7e Mon Sep 17 00:00:00 2001 From: Quentin JEROME Date: Fri, 15 Sep 2023 09:50:08 +0200 Subject: [PATCH] ci workflow Signed-off-by: Quentin JEROME --- .github/workflows/go.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..a34ad55 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,44 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Build + run: make ci-build + + - name: Test + run: go test -failfast ./... + + - uses: actions/checkout@v3 + with: + ref: coverage + path: coverage-branch + + - name: Coverage + run: | + cd $GITHUB_WORKSPACE/coverage-branch + curl -s "https://img.shields.io/badge/coverage-$(go test -cover | grep -oP '\s.*?%'| tr -d ' ' | sed 's/%/%25/')-informational?style=for-the-badge" > badge.svg + git config --local user.name "Coverage Bot" + git config --local user.email "<>" + git add -A + git commit -m "Coverage updated commit=$GITHUB_SHA" || true + git push +