Skip to content

chore: Split lint and test workflows #23

chore: Split lint and test workflows

chore: Split lint and test workflows #23

Workflow file for this run

name: "Test"
on:
push:
branches:
- master
paths-ignore:
- '*.md'
pull_request:
types: [ opened, synchronize ]
paths-ignore:
- '*.md'
branches:
- master
workflow_dispatch:
jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.0
- name: Install dependencies and run tests
run: |
go mod download
go test -v ./... -coverpkg=./... -short -coverprofile=unit_coverage.out
code_coverage:
name: "Code coverage report"
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
actions: read # to download code coverage results from "test" job
pull-requests: write # write permission needed to comment on PR
steps:
- uses: fgrosse/[email protected]
with:
coverage-artifact-name: "code-coverage" # can be omitted if you used this default value
coverage-file-name: unit_coverage.out