William Petit
d4637b26bc
All checks were successful
Cadoles/goweb-oidc/pipeline/head This commit looks good
81 lines
2.1 KiB
Makefile
81 lines
2.1 KiB
Makefile
SHELL := /bin/bash
|
|
|
|
IMAGE_NAME ?= reg.cadoles.com/cadoles/oidc-test
|
|
|
|
MKT_GITEA_RELEASE_ORG ?= Cadoles
|
|
MKT_GITEA_RELEASE_PROJECT ?= goweb-oidc
|
|
MKT_GITEA_RELEASE_VERSION ?= $(MKT_PROJECT_VERSION)
|
|
|
|
define MKT_GITEA_RELEASE_BODY
|
|
## Docker usage
|
|
|
|
```
|
|
docker pull $(IMAGE_NAME):$(MKT_PROJECT_VERSION)
|
|
```
|
|
endef
|
|
export MKT_GITEA_RELEASE_BODY
|
|
|
|
build:
|
|
CGO_ENABLED=0 go build -v -o ./bin/server ./cmd/server
|
|
|
|
test:
|
|
go test -v -race ./...
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
watch:
|
|
modd
|
|
|
|
lint:
|
|
golangci-lint run --enable-all
|
|
|
|
clean:
|
|
rm -rf release
|
|
rm -rf data
|
|
rm -rf bin
|
|
|
|
build-image:
|
|
docker build \
|
|
-t "${IMAGE_NAME}:latest" \
|
|
-f ./misc/docker/Dockerfile \
|
|
.
|
|
|
|
scan: build-image tools/trivy/bin/trivy
|
|
mkdir -p .trivy
|
|
tools/trivy/bin/trivy --cache-dir .trivy/.cache image --ignorefile .trivyignore.yaml $(TRIVY_ARGS) $(IMAGE_NAME):latest
|
|
|
|
tools/trivy/bin/trivy:
|
|
mkdir -p tools/trivy/bin
|
|
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b ./tools/trivy/bin v0.47.0
|
|
|
|
release: release-image release-gitea
|
|
|
|
release-archive:
|
|
@$(SHELL) ./misc/script/release.sh
|
|
|
|
release-gitea: .mktools release-archive
|
|
@[ ! -z "$(MKT_PROJECT_VERSION)" ] || ( echo "Just downloaded mktools. Please re-run command."; exit 1 )
|
|
$(MAKE) MKT_GITEA_RELEASE_ATTACHMENTS="$$(find release/* -maxdepth 0 -type f -printf '%p ')" mkt-gitea-release
|
|
|
|
release-image: .mktools build-image
|
|
@[ ! -z "$(MKT_PROJECT_VERSION)" ] || ( echo "Just downloaded mktools. Please re-run command."; exit 1 )
|
|
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:$(MKT_PROJECT_VERSION)"
|
|
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:$(MKT_PROJECT_SHORT_VERSION)"
|
|
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:$(MKT_PROJECT_VERSION_CHANNEL)-latest"
|
|
|
|
docker push "${IMAGE_NAME}:$(MKT_PROJECT_VERSION)"
|
|
docker push "${IMAGE_NAME}:$(MKT_PROJECT_SHORT_VERSION)"
|
|
docker push "${IMAGE_NAME}:$(MKT_PROJECT_VERSION_CHANNEL)-latest"
|
|
|
|
.PHONY: lint watch build tidy release
|
|
|
|
.PHONY: mktools
|
|
mktools:
|
|
rm -rf .mktools
|
|
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
|
|
|
|
.mktools:
|
|
$(MAKE) mktools
|
|
|
|
-include .mktools/*.mk |