From 27aff6a8aa95c869b97bec410a396b4c7819d454 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Wed, 17 Sep 2025 10:15:42 +0200 Subject: [PATCH 1/4] Updated workflow versions --- .github/workflows/ci.yml | 5 ++--- .github/workflows/markdown.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/update-workflows.yml | 2 +- makefile | 30 +++++++++++++++++++------- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a56bbf9..e5340c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index af44d8a..368a2fc 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6814e30..1a6309d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 ] diff --git a/.github/workflows/update-workflows.yml b/.github/workflows/update-workflows.yml index 7ebfb9a..aec242f 100644 --- a/.github/workflows/update-workflows.yml +++ b/.github/workflows/update-workflows.yml @@ -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 }} diff --git a/makefile b/makefile index 0cb07ee..f0958c9 100644 --- a/makefile +++ b/makefile @@ -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 @@ -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) @@ -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) @@ -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 @@ -93,5 +106,6 @@ config: # Install pre-commit hooks cp scripts/pre-commit .git/hooks/pre-commit + clean: - rm -rf build + rm -rf build/* From e779841ed113faf3e5e5f9074dd258829c523e74 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta <73165318+soumeh01@users.noreply.github.com> Date: Wed, 17 Sep 2025 13:51:48 +0200 Subject: [PATCH 2/4] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5340c0..77c4fb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: go-version-file: ./go.mod enable-qlty-coverage: true + publish-test-results: name: "Publish Tests Results" needs: [ build-and-verify ] From ea4781669523f103440553b6851a4924456c33e2 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta <73165318+soumeh01@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:29:15 +0200 Subject: [PATCH 3/4] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77c4fb7..e5340c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,6 @@ jobs: go-version-file: ./go.mod enable-qlty-coverage: true - publish-test-results: name: "Publish Tests Results" needs: [ build-and-verify ] From 9cd9fa6ea51170452207fab47a0bdb64f7efbf59 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta <73165318+soumeh01@users.noreply.github.com> Date: Wed, 17 Sep 2025 15:04:32 +0200 Subject: [PATCH 4/4] Update update-workflows.yml --- .github/workflows/update-workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-workflows.yml b/.github/workflows/update-workflows.yml index aec242f..756d55a 100644 --- a/.github/workflows/update-workflows.yml +++ b/.github/workflows/update-workflows.yml @@ -13,4 +13,4 @@ jobs: update-workflows: 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 }}