From 74eb19720c5b6597f2442bf71c31fe89219940cb Mon Sep 17 00:00:00 2001 From: Jean-Marc MEESSEN Date: Tue, 11 Aug 2020 16:36:40 +0200 Subject: [PATCH] Enable makefile as a multi-purpose tool --- .github/workflows/ci.yml | 9 +++--- .gitignore | 1 + Makefile | 39 +++++++++++++++++++++++ README.md | 4 +-- build.sh | 11 ------- doc/whats_new.md | 12 +++---- notes/buildNotes.md | 7 +++- docker-FLEcli.sh => test/docker-FLEcli.sh | 0 test.sh => test/test.sh | 0 todo.md | 36 --------------------- 10 files changed, 59 insertions(+), 60 deletions(-) create mode 100644 Makefile delete mode 100755 build.sh rename docker-FLEcli.sh => test/docker-FLEcli.sh (100%) rename test.sh => test/test.sh (100%) delete mode 100644 todo.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d3d6ab..a463aeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,10 @@ jobs: - name: Lint Go Code run: | - go get -u golang.org/x/lint/golint - golint -set_exit_status ./... + make lint + - name: Vet Go Code + run: | + make vet test: name: Test @@ -41,8 +43,7 @@ jobs: - name: Run Unit tests. run: | - go test -short -coverprofile cover.out -covermode=atomic ./... - cat cover.out >> coverage.txt + make test-coverage - name: Upload Coverage report to CodeCov uses: codecov/codecov-action@v1.0.0 diff --git a/.gitignore b/.gitignore index 3099afc..36a470c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ notes/help.txt # Output of the go coverage tool, specifically when used with LiteIDE *.out +coverage.txt # Dependency directories (remove the comment below to include it) # vendor/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..62a03ba --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +# PROJECT_NAME := "github-actions-demo-go" +# PKG := "github.com/brpaz/$(PROJECT_NAME)" +# PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/) +# GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go) + +## GITHUB_ACTIONS is set when running as a Github Action + +.PHONY: all lint vet test test-coverage build clean + +all: build + +dep: ## Get the dependencies + @go mod download + +lint: ## Lint Golang files + @go get -u golang.org/x/lint/golint + @golint -set_exit_status ./... + +vet: ## Run go vet + @go vet ./... + +test: ## Run unit tests + @go test ./... + +test-coverage: ## Run tests with coverage + @go test -short -coverprofile cover.out -covermode=atomic ./... + @cat cover.out >> coverage.txt + +build: ## Build the binary file + @goreleaser --snapshot --skip-publish --rm-dist + @cp dist/FLEcli_darwin_amd64/FLEcli . + +clean: ## Remove previous build + @rm -f ./FLEcli + @rm -f ./cover.out + @rm -f ./coverage.txt + +help: ## Display this help screen + @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' \ No newline at end of file diff --git a/README.md b/README.md index 465e60d..0edb347 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ To generate a WWFF-ready ADIF file: ``` ./FLEcli adif -i --wwff ON4KJM@ONFF-025920200524.txt ``` -The `--wwff` indicates the adif flavour to produce. -You can use the `--sota` switch to generate an ADIF file containing SOTA details. +The `--wwff` (or `-w` in the short form) indicates the adif flavour to produce. +You can also use the `--sota` switch to generate an ADIF file containing SOTA details. The switch can be used together with `--wwff` As we didn't provide an output filename, the default output, `ON4KJM@ONFF-025920200524.adi` will be used. diff --git a/build.sh b/build.sh deleted file mode 100755 index bd7099e..0000000 --- a/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -go test ./... - -commitRef=$(git rev-parse HEAD) -tag=$(git describe --tags) -version="${tag}_(PrivateBuild)" -buildDate=$(date -u +"%FT%TZ") -go build -ldflags="-s -w -X=FLEcli/flecmd.version=${version} -X=FLEcli/flecmd.commit=${commitRef} -X=FLEcli/flecmd.date=${buildDate} -X=FLEcli/flecmd.builtBy=${USER}" diff --git a/doc/whats_new.md b/doc/whats_new.md index 697d84d..8c30956 100644 --- a/doc/whats_new.md +++ b/doc/whats_new.md @@ -1,14 +1,14 @@ # What's new? -## V0.1.1 -* improved test coverage -* improved build automation -* improved release notes publication +## v0.1.1 +* Improved test coverage +* Improved build automation +* Improved release notes publication ## Previous releases -### V0.1.0 +### v0.1.0 * First public MVP (Minimal Viable Product relase). Supports only SOTA and WWFF type log files. Some header keywords are missing as well as date increments. -### V0.0.0 +### v0.0.0 * Initial release diff --git a/notes/buildNotes.md b/notes/buildNotes.md index ccfd26d..fd0c6fc 100644 --- a/notes/buildNotes.md +++ b/notes/buildNotes.md @@ -2,4 +2,9 @@ * `goreleaser --snapshot --skip-publish --rm-dist` * `dist/FLEcli_darwin_amd64/FLEcli` -* `docker build -f docker/Dockerfile -t test/test dist/FLEcli_linux_arm64` \ No newline at end of file +* `docker build -f docker/Dockerfile -t test/test dist/FLEcli_linux_arm64` + +## to push a release + +* on the master branch `git tag v0.1.1` +* `git push --tag` \ No newline at end of file diff --git a/docker-FLEcli.sh b/test/docker-FLEcli.sh similarity index 100% rename from docker-FLEcli.sh rename to test/docker-FLEcli.sh diff --git a/test.sh b/test/test.sh similarity index 100% rename from test.sh rename to test/test.sh diff --git a/todo.md b/todo.md deleted file mode 100644 index c8eb34f..0000000 --- a/todo.md +++ /dev/null @@ -1,36 +0,0 @@ -# TODO - -## Input protocol -* [ ] document the FLE input format - -## Test & Build framework -* [ ] Perform the test of the complete app -* [-] Implement MacOS codesigning (issue #9) -* [x] Add quality badges to main page -* [x] Make a more reasonable/richer version display (issue #10) -* [x] Create standalone documentation, separate from README (issue #13) -* [x] Re-visit the release notes (far too verbose) -* [x] Implement and track code coverage - - - -## Input processing -* [ ] New MYGRID keyword -* [ ] Support different date delimiter -* [ ] Support extrapolated date -* [ ] Support date not prefixed by "date" (non header mode) DATE keyword is now optional -* [ ] Support date increment ("date +" and "date ++") -* [ ] Support WWFF keyword -* [x] Validate that we have the necessary data for the output -* [ ] Support the contest related fields - -## Output processing -* [ ] Implement CABRILLO output - - -## Later -* [ ] Process contest reports -* [ ] Infer digital mode report -* [ ] add unit test for the DefaultReport validate function -* [-] look how to make it work as a CGI -