2024-01-13 03:09:44 +00:00
# Inspired from https://dustinspecker.com/posts/go-combined-unit-integration-code-coverage/ and https://netdevops.me/2023/test-coverage-for-go-integration-tests/
2024-04-06 19:33:56 +00:00
BIN_DIR = $( CURDIR) /artifacts
2024-01-13 03:09:44 +00:00
BINARY = $( BIN_DIR) /lyricdownloader
2024-04-06 19:33:56 +00:00
CURRENT_DIR = $( shell pwd )
CUR_TAG = $( shell git tag | sort -g | tail -1 | cut -c 2-)
VERSION_NUMBER ?= 0.0.0
i f n e q ( $( CI_COMMIT_TAG ) , )
VERSION_NUMBER := $( CI_COMMIT_TAG:v%= %)
e l s e
VERSION_NUMBER := ${ CUR_TAG }
e n d i f
2024-01-13 03:09:44 +00:00
.PHONY : clean
clean :
go clean
.PHONY : dep
dep :
go mod tidy
.PHONY : fmt
fmt :
go fmt ./...
.PHONY : lint
lint :
2024-04-20 11:17:45 +00:00
golangci-lint run --timeout 3m --verbose
2024-01-13 03:09:44 +00:00
.PHONY : build
build :
go build -o $( BINARY)
2024-04-06 19:33:56 +00:00
.PHONY : release
release :
mv ${ BINARY } ${ BINARY } -${ VERSION_NUMBER }
cd ${ BIN_DIR }
mkdir ${ BIN_DIR } /tmp
mv ${ BINARY } -${ VERSION_NUMBER } ${ BIN_DIR } /tmp
# From here https://www.baeldung.com/linux/tar-archive-without-directory-structure
tar -zcvf ${ BINARY } -${ VERSION_NUMBER } .tar.gz -C ${ BIN_DIR } /tmp .
rm -rf ${ BIN_DIR } /tmp
cd ${ CURRENT_DIR }
2024-04-07 08:32:16 +00:00
.PHONY : changelog -full
changelog-full :
python3 generate_notes.py --full
.PHONY : changelog -draft
changelog-draft :
python3 generate_notes.py --draft
2024-01-13 03:09:44 +00:00
.PHONY : lint -all
lint-all :
golangci-lint run --enable-all