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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ permissions:

jobs:
build-and-verify:
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/build-and-verify.yml@v1.0.0
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/build-and-verify.yml@v1.0.1
secrets:
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
with:
program: cbuild2cmake
go-version-file: ./go.mod
enable-code-climate: true
artifact-retention-days: 7
enable-qlty-coverage: true

publish-test-results:
name: "Publish Tests Results"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions: read-all

jobs:
markdown-check:
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/markdown-lint.yml@v1.0.0
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/markdown-lint.yml@v1.0.1
with:
lint-config: '.github/markdownlint.jsonc'
link-check-config: '.github/markdown-link-check.jsonc'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:

jobs:
build-and-verify:
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/build-and-verify.yml@v1.0.0
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/build-and-verify.yml@v1.0.1
with:
program: cbuild2cmake
go-version-file: ./go.mod
enable-code-climate: false
enable-qlty-coverage: false

goreleaser:
needs: [ build-and-verify ]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ permissions:

jobs:
update-workflows:
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/update-workflow.yml@v1.0.0
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/update-workflow.yml@v1.0.1
secrets:
TOKEN_ACCESS: ${{ secrets.GITHUB_TOKEN }}
TOKEN_ACCESS: ${{ secrets.GRASCI_WORKFLOW_UPDATE }}
30 changes: 22 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
OS ?= $(shell uname)

# Having this will allow CI scripts to build for many OS's and ARCH's
ARCH := $(or $(ARCH),amd64)
ARCH ?= $(shell uname -m)

# Retrieve version from git history
VERSION ?= $(shell git describe --tags 2>/dev/null || echo unknown)

# Path to lint tool
GOLINTER ?= golangci-lint
Expand All @@ -20,6 +23,14 @@ else
# Default to Linux
OS=linux
endif
ifneq (,$(findstring x86_64,$(ARCH)))
ARCH=amd64
else ifneq (,$(findstring aarch64,$(ARCH)))
ARCH=arm64
else ifneq (,$(findstring unknown,$(ARCH)))
# fallback
ARCH=amd64
endif

SOURCES := $(wildcard cmd/cbuild2cmake/*.go) $(wildcard pkg/*/*.go)

Expand Down Expand Up @@ -53,7 +64,8 @@ all:

$(PROG): $(SOURCES)
@echo Building project
GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags "-X main.version=`git describe 2>/dev/null || echo unknown`" -o $(PROG) ./cmd/cbuild2cmake
GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags "-X main.version=$(VERSION)" -o $(PROG) ./cmd/cbuild2cmake


build: $(PROG)

Expand All @@ -67,21 +79,22 @@ format:
$(GOFORMATTER) -s -w .

format-check:
mkdir -p build && $(GOFORMATTER) -d . | tee build/format-check.out
test ! -s build/format-check.out
$(GOFORMATTER) -d . | tee format-check.out
test ! -s format-check.out

.PHONY: test release config
test: $(SOURCES)
mkdir -p build && GOOS=$(OS) GOARCH=$(ARCH) go test $(ARGS) -v ./... -coverprofile build/cover.out
GOOS=$(OS) GOARCH=$(ARCH) go test $(ARGS) -v ./... -coverprofile ./cover.out

test-all: format-check coverage-check lint

coverage-report: test
go tool cover -html=build/cover.out
go tool cover -html=./cover.out

coverage-check: test
@echo "Current coverage is: $(shell go tool cover -func ./cover.out | tail -1 | awk '{print ($$3 + 0)}')"%
@echo Checking if test coverage is above 80%
test `go tool cover -func build/cover.out | tail -1 | awk '{print ($$3 + 0)*10}'` -ge 800
test `go tool cover -func ./cover.out | tail -1 | awk '{print ($$3 + 0)*10}'` -ge 800

release: test-all $(PROG)
@./scripts/release
Expand All @@ -93,5 +106,6 @@ config:

# Install pre-commit hooks
cp scripts/pre-commit .git/hooks/pre-commit

clean:
rm -rf build
rm -rf build/*
Loading