Skip to content

Commit

Permalink
Add github action for building, testing, and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
veqryn committed Mar 18, 2024
1 parent 3d870ba commit 7936136
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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: Tests

on:
push:
tags:
branches:
- main
pull_request:
branches:

# Declare default permissions as read only.
permissions: read-all

jobs:

build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.21', '1.22' ]

steps:
- uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Display Go version ${{ matrix.go-version }}
run: go version

- name: Install dependencies ${{ matrix.go-version }}
run: |
go get -t -u golang.org/x/tools/cmd/cover
go mod download
- name: Build ${{ matrix.go-version }}
run: go build -v ./...

- name: Test ${{ matrix.go-version }}
run: go test -v -race -coverprofile=coverage.out -covermode=atomic

- name: Upload coverage reports to Codecov ${{ matrix.go-version }}
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: veqryn/slog-json

0 comments on commit 7936136

Please sign in to comment.