Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: CI

on: [pull_request, workflow_dispatch]
on:
pull_request:
workflow_dispatch:
push:
branches:
- main

env:
CODE_COVERAGE_FILE_NAME: "coverage.out" # must be the same as in Makefile
CODE_COVERAGE_ARTIFACT_NAME: "code-coverage"

jobs:
main:
Expand All @@ -26,8 +35,15 @@ jobs:
- name: Test
run: make test

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }}
path: ${{ env.CODE_COVERAGE_FILE_NAME }}

config:
name: Check GoReleaser config
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -36,4 +52,19 @@ jobs:
- name: Check GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: check
args: check

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: main
permissions:
contents: read
actions: read # to download code coverage results from "main" job
pull-requests: write # write permission needed to comment on PR
steps:
- uses: fgrosse/[email protected]
with:
coverage-artifact-name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }}
coverage-file-name: ${{ env.CODE_COVERAGE_FILE_NAME }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ lint: lint-golangci-lint lint-yamllint
# Test
test:
@echo ">> Running tests for the CLI application"
@go test ./... -count=1
@go test ./... -count=1 -coverprofile=coverage.out

# Test coverage
coverage:
Expand Down
Loading