From b01eefb91da53f029346e0c38214486ffb55a22c Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 6 May 2021 11:55:39 +0200 Subject: [PATCH] add ci-format make target --- .bingo/Variables.mk | 6 ++++++ .bingo/buildifier.mod | 5 +++++ .bingo/variables.env | 2 ++ Makefile | 4 ++++ docs/ocis/development/continuous-integration.md | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .bingo/buildifier.mod diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk index 9e869d7b2d..b38d278d82 100644 --- a/.bingo/Variables.mk +++ b/.bingo/Variables.mk @@ -29,6 +29,12 @@ $(BUF): $(BINGO_DIR)/buf.mod @echo "(re)installing $(GOBIN)/buf-v0.40.0" @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=buf.mod -o=$(GOBIN)/buf-v0.40.0 "github.com/bufbuild/buf/cmd/buf" +BUILDIFIER := $(GOBIN)/buildifier-v0.0.0-20210227132407-f2aed9ee205d +$(BUILDIFIER): $(BINGO_DIR)/buildifier.mod + @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. + @echo "(re)installing $(GOBIN)/buildifier-v0.0.0-20210227132407-f2aed9ee205d" + @cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=buildifier.mod -o=$(GOBIN)/buildifier-v0.0.0-20210227132407-f2aed9ee205d "github.com/bazelbuild/buildtools/buildifier" + CALENS := $(GOBIN)/calens-v0.2.0 $(CALENS): $(BINGO_DIR)/calens.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. diff --git a/.bingo/buildifier.mod b/.bingo/buildifier.mod new file mode 100644 index 0000000000..85b1bfb8ef --- /dev/null +++ b/.bingo/buildifier.mod @@ -0,0 +1,5 @@ +module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT + +go 1.16 + +require github.com/bazelbuild/buildtools v0.0.0-20210227132407-f2aed9ee205d // buildifier diff --git a/.bingo/variables.env b/.bingo/variables.env index e796dc5845..4b63d2258b 100644 --- a/.bingo/variables.env +++ b/.bingo/variables.env @@ -12,6 +12,8 @@ BINGO="${GOBIN}/bingo-v0.4.0" BUF="${GOBIN}/buf-v0.40.0" +BUILDIFIER="${GOBIN}/buildifier-v0.0.0-20210227132407-f2aed9ee205d" + CALENS="${GOBIN}/calens-v0.2.0" FILEB0X="${GOBIN}/fileb0x-v1.1.4" diff --git a/Makefile b/Makefile index 95b99d7fd7..efd15621ca 100644 --- a/Makefile +++ b/Makefile @@ -191,3 +191,7 @@ l10n-write: @for extension in $(L10N_MODULES); do \ make -C $$extension l10n-write; \ done + +.PHONY: ci-format +ci-format: $(BUILDIFIER) + $(BUILDIFIER) --mode=fix .drone.star diff --git a/docs/ocis/development/continuous-integration.md b/docs/ocis/development/continuous-integration.md index ce3d07587b..d1c0d9f81e 100644 --- a/docs/ocis/development/continuous-integration.md +++ b/docs/ocis/development/continuous-integration.md @@ -13,7 +13,7 @@ oCIS uses [DRONE](https://www.drone.io/) as CI system. You can find the pipeline ## Concepts -The pipeline is defined in [Starlark](https://github.com/bazelbuild/starlark) and transformed to YAML upon pipeline run. This enables us to do a highly dynamic and non repeating pipeline configuration. +The pipeline is defined in [Starlark](https://github.com/bazelbuild/starlark) and transformed to YAML upon pipeline run. This enables us to do a highly dynamic and non repeating pipeline configuration. We enforce Starlark format guidelines with Bazel Buildifier. You can format the .drone.star file by running `make ci-format`. Upon running the pipeline, your branch gets merged to the master branch. This ensures that we always test your changeset if as it was applied to the master of oCIS. Please note that this does not apply to the pipeline definition (`.drone.star`).