From 7537058c1c4b3c2df137be0b24aab4afd5a2f1e3 Mon Sep 17 00:00:00 2001 From: ArchitectBot <61872893+architectbot@users.noreply.github.com> Date: Tue, 15 Dec 2020 08:28:50 +0000 Subject: [PATCH] Align files (#69) Co-authored-by: github-actions --- .github/dependabot.yml | 60 +++++----- .../zz_generated.create_release.yaml | 10 +- .../zz_generated.create_release_pr.yaml | 2 +- .github/workflows/zz_generated.gitleaks.yaml | 2 +- .github/workflows/zz_generated.gomodtidy.yaml | 44 -------- Makefile | 105 +----------------- Makefile.gen.go.mk | 105 ++++++++++++++++++ 7 files changed, 149 insertions(+), 179 deletions(-) delete mode 100644 .github/workflows/zz_generated.gomodtidy.yaml create mode 100644 Makefile.gen.go.mk diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 142fcfc..0fefd96 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,34 +1,36 @@ # DO NOT EDIT. Generated with: # -# devctl gen dependabot +# devctl@4.0.1 # version: 2 updates: -- package-ecosystem: docker - directory: "/" - schedule: - interval: weekly - time: "04:00" - target-branch: master - reviewers: - - giantswarm/team-batman-engineers -- package-ecosystem: github-actions - directory: "/" - schedule: - interval: weekly - time: "04:00" - target-branch: master - reviewers: - - giantswarm/team-batman-engineers -- package-ecosystem: gomod - directory: "/" - schedule: - interval: weekly - time: "04:00" - open-pull-requests-limit: 10 - reviewers: - - giantswarm/team-batman-engineers - ignore: - - dependency-name: k8s.io/* - versions: - - ">=0.19.0" + - package-ecosystem: docker + directory: "/" + schedule: + interval: weekly + time: "04:00" + open-pull-requests-limit: 10 + reviewers: + - giantswarm/team-batman-engineers + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + time: "04:00" + open-pull-requests-limit: 10 + reviewers: + - giantswarm/team-batman-engineers + ignore: + - dependency-name: zricethezav/gitleaks-action + - package-ecosystem: gomod + directory: "/" + schedule: + interval: weekly + time: "04:00" + open-pull-requests-limit: 10 + reviewers: + - giantswarm/team-batman-engineers + ignore: + - dependency-name: k8s.io/* + versions: + - ">=0.19.0" diff --git a/.github/workflows/zz_generated.create_release.yaml b/.github/workflows/zz_generated.create_release.yaml index d5aab8d..99b2da8 100644 --- a/.github/workflows/zz_generated.create_release.yaml +++ b/.github/workflows/zz_generated.create_release.yaml @@ -1,6 +1,6 @@ # DO NOT EDIT. Generated with: # -# devctl gen workflows +# devctl@4.0.1 # name: Create Release on: @@ -196,8 +196,14 @@ jobs: - name: Create long-lived release branch run: | current_version="${{ needs.gather_facts.outputs.version }}" - parent_version="$(git describe --tags --abbrev=0 HEAD^)" + parent_version="$(git describe --tags --abbrev=0 HEAD^ || true)" parent_version="${parent_version#v}" # Strip "v" prefix. + + if [[ -z "$parent_version" ]] ; then + echo "Unable to find a parent tag version. No branch to create." + exit 0 + fi + echo "current_version=$current_version parent_version=$parent_version" current_major=$(semver get major $current_version) diff --git a/.github/workflows/zz_generated.create_release_pr.yaml b/.github/workflows/zz_generated.create_release_pr.yaml index 1756ea3..25fecf3 100644 --- a/.github/workflows/zz_generated.create_release_pr.yaml +++ b/.github/workflows/zz_generated.create_release_pr.yaml @@ -1,6 +1,6 @@ # DO NOT EDIT. Generated with: # -# devctl gen workflows +# devctl@4.0.1 # name: Create Release PR on: diff --git a/.github/workflows/zz_generated.gitleaks.yaml b/.github/workflows/zz_generated.gitleaks.yaml index d7c6139..eaafa0f 100644 --- a/.github/workflows/zz_generated.gitleaks.yaml +++ b/.github/workflows/zz_generated.gitleaks.yaml @@ -1,6 +1,6 @@ # DO NOT EDIT. Generated with: # -# devctl gen workflows +# devctl@4.0.1 # name: gitleaks diff --git a/.github/workflows/zz_generated.gomodtidy.yaml b/.github/workflows/zz_generated.gomodtidy.yaml deleted file mode 100644 index be8fd79..0000000 --- a/.github/workflows/zz_generated.gomodtidy.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# DO NOT EDIT. Generated with: -# -# devctl gen dependabot -# -# Credit: https://github.com/crazy-max/diun -name: auto-go-mod-tidy - -on: - push: - branches: - - 'dependabot/**' - -jobs: - fix: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v1 - - - # https://github.com/actions/checkout/issues/6 - name: Fix detached HEAD - run: git checkout ${GITHUB_REF#refs/heads/} - - - name: Tidy - run: | - rm -f go.sum - go mod tidy - - - name: Set up Git - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git - - - name: Commit and push changes - run: | - git add . - if output=$(git status --porcelain) && [ ! -z "$output" ]; then - git commit -m 'Fix go modules' - git push - fi diff --git a/Makefile b/Makefile index eb8e971..963401e 100644 --- a/Makefile +++ b/Makefile @@ -1,111 +1,12 @@ # DO NOT EDIT. Generated with: # -# devctl gen makefile +# devctl@4.0.1 # -PACKAGE_DIR := ./bin-dist - -APPLICATION := $(shell go list . | cut -d '/' -f 3) -BUILDTIMESTAMP := $(shell date -u '+%FT%TZ') -GITSHA1 := $(shell git rev-parse --verify HEAD) -OS := $(shell go env GOOS) -SOURCES := $(shell find . -name '*.go') -VERSION := $(shell architect project version) -LDFLAGS ?= -w -linkmode 'auto' -extldflags '-static' \ - -X '$(shell go list .)/pkg/project.buildTimestamp=${BUILDTIMESTAMP}' \ - -X '$(shell go list .)/pkg/project.gitSHA=${GITSHA1}' -.DEFAULT_GOAL := build - -.PHONY: build build-darwin build-linux -## build: builds a local binary -build: $(APPLICATION) - @echo "====> $@" -## build-darwin: builds a local binary for darwin/amd64 -build-darwin: $(APPLICATION)-darwin - @echo "====> $@" -## build-linux: builds a local binary for linux/amd64 -build-linux: $(APPLICATION)-linux - @echo "====> $@" - -$(APPLICATION): $(APPLICATION)-v$(VERSION)-$(OS)-amd64 - @echo "====> $@" - cp -a $< $@ - -$(APPLICATION)-darwin: $(APPLICATION)-v$(VERSION)-darwin-amd64 - @echo "====> $@" - cp -a $< $@ - -$(APPLICATION)-linux: $(APPLICATION)-v$(VERSION)-linux-amd64 - @echo "====> $@" - cp -a $< $@ - -$(APPLICATION)-v$(VERSION)-%-amd64: $(SOURCES) - @echo "====> $@" - CGO_ENABLED=0 GOOS=$* GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $@ . - -.PHONY: package-darwin package-linux -## package-darwin: prepares a packaged darwin/amd64 version -package-darwin: $(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-darwin-amd64.tar.gz - @echo "====> $@" -## package-linux: prepares a packaged linux/amd64 version -package-linux: $(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-linux-amd64.tar.gz - @echo "====> $@" - -$(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-%-amd64.tar.gz: DIR=$(PACKAGE_DIR)/$< -$(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-%-amd64.tar.gz: $(APPLICATION)-v$(VERSION)-%-amd64 - @echo "====> $@" - mkdir -p $(DIR) - cp $< $(DIR)/$(APPLICATION) - cp README.md LICENSE $(DIR) - tar -C $(PACKAGE_DIR) -cvzf $(PACKAGE_DIR)/$<.tar.gz $< - rm -rf $(DIR) - rm -rf $< - -.PHONY: install -## install: install the application -install: - @echo "====> $@" - go install -ldflags "$(LDFLAGS)" . - -.PHONY: run -## run: runs go run main.go -run: - @echo "====> $@" - go run -ldflags "$(LDFLAGS)" -race . - -.PHONY: clean -## clean: cleans the binary -clean: - @echo "====> $@" - rm -f $(APPLICATION)* - go clean - -.PHONY: imports -## imports: runs goimports -imports: - @echo "====> $@" - goimports -local $(shell go list .) -w . - -.PHONY: lint -## lint: runs golangci-lint -lint: - @echo "====> $@" - golangci-lint run -E gosec -E goconst --timeout=15m ./... - -.PHONY: test -## test: runs go test with default values -test: - @echo "====> $@" - go test -ldflags "$(LDFLAGS)" -race ./... - -.PHONY: build-docker -## build-docker: builds docker image to registry -build-docker: build-linux - @echo "====> $@" - docker build -t ${APPLICATION}:${VERSION} . +include Makefile.*.mk .PHONY: help ## help: prints this help message help: @echo "Usage: \n" - @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' + @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' | sort diff --git a/Makefile.gen.go.mk b/Makefile.gen.go.mk new file mode 100644 index 0000000..af95fc5 --- /dev/null +++ b/Makefile.gen.go.mk @@ -0,0 +1,105 @@ +# DO NOT EDIT. Generated with: +# +# devctl@4.0.1 +# + +PACKAGE_DIR := ./bin-dist + +APPLICATION := $(shell go list . | cut -d '/' -f 3) +BUILDTIMESTAMP := $(shell date -u '+%FT%TZ') +GITSHA1 := $(shell git rev-parse --verify HEAD) +OS := $(shell go env GOOS) +SOURCES := $(shell find . -name '*.go') +VERSION := $(shell architect project version) +LDFLAGS ?= -w -linkmode 'auto' -extldflags '-static' \ + -X '$(shell go list .)/pkg/project.buildTimestamp=${BUILDTIMESTAMP}' \ + -X '$(shell go list .)/pkg/project.gitSHA=${GITSHA1}' +.DEFAULT_GOAL := build + +.PHONY: build build-darwin build-linux +## build: builds a local binary +build: $(APPLICATION) + @echo "====> $@" +## build-darwin: builds a local binary for darwin/amd64 +build-darwin: $(APPLICATION)-darwin + @echo "====> $@" +## build-linux: builds a local binary for linux/amd64 +build-linux: $(APPLICATION)-linux + @echo "====> $@" + +$(APPLICATION): $(APPLICATION)-v$(VERSION)-$(OS)-amd64 + @echo "====> $@" + cp -a $< $@ + +$(APPLICATION)-darwin: $(APPLICATION)-v$(VERSION)-darwin-amd64 + @echo "====> $@" + cp -a $< $@ + +$(APPLICATION)-linux: $(APPLICATION)-v$(VERSION)-linux-amd64 + @echo "====> $@" + cp -a $< $@ + +$(APPLICATION)-v$(VERSION)-%-amd64: $(SOURCES) + @echo "====> $@" + CGO_ENABLED=0 GOOS=$* GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $@ . + +.PHONY: package-darwin package-linux +## package-darwin: prepares a packaged darwin/amd64 version +package-darwin: $(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-darwin-amd64.tar.gz + @echo "====> $@" +## package-linux: prepares a packaged linux/amd64 version +package-linux: $(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-linux-amd64.tar.gz + @echo "====> $@" + +$(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-%-amd64.tar.gz: DIR=$(PACKAGE_DIR)/$< +$(PACKAGE_DIR)/$(APPLICATION)-v$(VERSION)-%-amd64.tar.gz: $(APPLICATION)-v$(VERSION)-%-amd64 + @echo "====> $@" + mkdir -p $(DIR) + cp $< $(DIR)/$(APPLICATION) + cp README.md LICENSE $(DIR) + tar -C $(PACKAGE_DIR) -cvzf $(PACKAGE_DIR)/$<.tar.gz $< + rm -rf $(DIR) + rm -rf $< + +.PHONY: install +## install: install the application +install: + @echo "====> $@" + go install -ldflags "$(LDFLAGS)" . + +.PHONY: run +## run: runs go run main.go +run: + @echo "====> $@" + go run -ldflags "$(LDFLAGS)" -race . + +.PHONY: clean +## clean: cleans the binary +clean: + @echo "====> $@" + rm -f $(APPLICATION)* + go clean + +.PHONY: imports +## imports: runs goimports +imports: + @echo "====> $@" + goimports -local $(shell go list .) -w . + +.PHONY: lint +## lint: runs golangci-lint +lint: + @echo "====> $@" + golangci-lint run -E gosec -E goconst --timeout=15m ./... + +.PHONY: test +## test: runs go test with default values +test: + @echo "====> $@" + go test -ldflags "$(LDFLAGS)" -race ./... + +.PHONY: build-docker +## build-docker: builds docker image to registry +build-docker: build-linux + @echo "====> $@" + docker build -t ${APPLICATION}:${VERSION} .