-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
99 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,21 +21,23 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Ensures all tags are fetched | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "stable" | ||
|
||
- name: Build | ||
run: go build -v ./cmd/... | ||
run: make | ||
|
||
- name: vet | ||
run: go vet ./... | ||
|
||
- uses: dominikh/staticcheck-action@v1.2.0 | ||
- uses: dominikh/staticcheck-action@v1 | ||
with: | ||
version: "2022.1.1" | ||
version: "latest" | ||
|
||
- name: gofmt | ||
uses: Jerome1337/[email protected] | ||
|
@@ -45,5 +47,3 @@ jobs: | |
- name: Revive Action | ||
uses: morphy2k/[email protected] | ||
|
||
- name: Tests | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This file is Free Software under the Apache-2.0 License | ||
# without warranty, see README.md and LICENSES/Apache-2.0.txt for details. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# SPDX-FileCopyrightText: 2025 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de> | ||
# Software-Engineering: 2025 Intevation GmbH <https://intevation.de> | ||
|
||
.PHONY: all fakedoc createtemplate test | ||
|
||
all: fakedoc createtemplate test | ||
|
||
# See comment here (2024-11-15) | ||
# https://github.com/gocsaf/csaf/blob/3093f717817b9369d390e56d1012eaedcfa19e32/Makefile#L40-L49 | ||
GITDESC := $(shell git describe --tags --always) | ||
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/') | ||
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 ))) | ||
# Hint: The second regexp in the next line only matches | ||
# if there is a hyphen (`-`) followed by a number, | ||
# by which we assume that git describe has added a string after the tag | ||
SEMVER := $(shell echo '$(GITDESC)' | sed -E -e 's/^v//' -e 's/([0-9]+\.[0-9]+\.)([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH)\3/' ) | ||
testsemver: | ||
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\' | ||
|
||
LDFLAGS=-ldflags "-X github.com/gocsaf/fakedoc/pkg/fakedoc.SemVersion=$(SEMVER)" | ||
GO_FLAGS=$(LDFLAGS) | ||
|
||
# Build for coverage profile generation | ||
ifeq ($(BUILD_COVER), true) | ||
GO_FLAGS += "-cover" | ||
endif | ||
|
||
|
||
fakedoc: build_pkg | ||
cd cmd/fakedoc && go build $(GO_FLAGS) | ||
|
||
createtemplate: build_pkg | ||
cd cmd/createtemplate && go build $(GO_FLAGS) | ||
|
||
build_pkg: | ||
cd pkg && go build $(GO_FLAGS) ./... | ||
|
||
test: | ||
go test ./... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// This file is Free Software under the Apache-2.0 License | ||
// without warranty, see README.md and LICENSES/Apache-2.0.txt for details. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// SPDX-FileCopyrightText: 2024 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de> | ||
// Software-Engineering: 2024 Intevation GmbH <https://intevation.de> | ||
|
||
package fakedoc | ||
|
||
// SemVersion the version in semver.org format, MUST be overwritten during | ||
// the linking stage of the build process | ||
var SemVersion = "0.0.0" |