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
23 changes: 23 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,36 @@ runs:
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- name: Run tests
shell: bash
run: make test

- name: Run lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.1

- name: Build
shell: bash
run: make ${{ inputs.build-target }}

- name: Generate coverage report
if: github.event_name == 'pull_request'
shell: bash
run: make coverage

- name: Convert coverage report to Markdown
if: github.event_name == 'pull_request'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage.xml
format: markdown
output: both

- name: Post coverage report to PR
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
contents: read
id-token: write
packages: write
pull-requests: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
coverage.txt
keruu
example/*.html
.makerc.mk
.envrc
coverage.*
code-coverage-results.md
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ $(TARGET): go.* $(SOURCES)
lint:
golangci-lint run -v --skip-dirs '(^|/)\.go($|/)'

.PHONY: test
test:
coverage.txt: go.* $(SOURCES)
$(GO) version
CGO_ENABLED=1 $(GO) test \
-race \
-coverprofile=coverage.txt \
-coverprofile=$@ \
-covermode=atomic \
$(GO_LOCAL_MODS)

coverage.txt: test

coverage.xml: coverage.txt
$(GO) tool gocover-cobertura < $< > $@

.PHONY: coverage
coverage: coverage.xml

.PHONY: test
test: coverage.txt

.PHONY: clean
clean:
rm -f keruu
Expand Down