From 0162ffdbba090a53c4fe10ee033b0e1e1f59d363 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Mon, 15 Jan 2024 12:31:07 +0100 Subject: [PATCH] ci: add build workflow This workflow will build and test the project and calculate test coverage on every: - push to main - new PR to main created - commits added to PRs targeting main --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2c76654 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +# 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: Build and test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v4 + with: + go-version: '1.18' + + - name: Build + run: go build -v ./... + + - name: Test with coverage + run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./... + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}