Skip to content

Commit

Permalink
ci: add build workflow
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bevzzz committed Jan 15, 2024
1 parent a778511 commit 0162ffd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 0162ffd

Please sign in to comment.