simplify ci
This commit is contained in:
13
justfile
13
justfile
@@ -1,5 +1,6 @@
|
||||
platforms := env_var_or_default("PLATFORMS", "linux/amd64")
|
||||
tag := if env_var_or_default("CI_COMMIT_TAG", "main") == "main" { "latest" } else { env_var_or_default("CI_COMMIT_TAG", "latest") }
|
||||
repo := trim_end_match(replace(replace_regex(env_var_or_default("CI_REPOSITORY_URL", `git remote get-url origin`), ".*@|", ""), ":", "/"),".git")
|
||||
repo := trim_end_match(replace(replace_regex(env_var_or_default("CI_REPOSITORY_URL", `git remote get-url origin`), ".*@|", ""), ":", "/"), ".git")
|
||||
project := file_name(repo)
|
||||
gitlab_image := "registry." + repo + ":" + tag
|
||||
etke_image := replace(gitlab_image, "gitlab.com", "etke.cc")
|
||||
@@ -23,6 +24,14 @@ lint:
|
||||
lintfix:
|
||||
golangci-lint run --fix ./...
|
||||
|
||||
# generate mocks
|
||||
mocks:
|
||||
@mockery --all --inpackage --testonly --exclude vendor
|
||||
|
||||
# run cpu or mem profiler UI
|
||||
profile type:
|
||||
go tool pprof -http 127.0.0.1:8000 .pprof/{{ type }}.prof
|
||||
|
||||
# run unit tests
|
||||
test:
|
||||
@go test -cover -coverprofile=cover.out -coverpkg=./... -covermode=set ./...
|
||||
@@ -44,4 +53,4 @@ login:
|
||||
# docker build
|
||||
docker:
|
||||
docker buildx create --use
|
||||
docker buildx build --pull --platform linux/arm64/v8,linux/amd64 --push -t {{ gitlab_image }} -t {{ etke_image }} .
|
||||
docker buildx build --pull --platform {{ platforms }} --push -t {{ gitlab_image }} -t {{ etke_image }} .
|
||||
|
||||
Reference in New Issue
Block a user