From 8371a713887b23813ec30a3312b7abe6883cd9ae Mon Sep 17 00:00:00 2001 From: songy23 Date: Fri, 9 Aug 2019 12:21:18 -0700 Subject: [PATCH 1/5] Add Makefile and Circle CI config Fixes #13. Currently the only job is misspell check. --- .circleci/config.yaml | 14 ++++++++++++++ Makefile | 21 +++++++++++++++++++++ go.mod | 5 +++++ go.sum | 2 ++ internal/tools.go | 27 +++++++++++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 .circleci/config.yaml create mode 100644 Makefile create mode 100644 go.mod create mode 100644 go.sum create mode 100644 internal/tools.go diff --git a/.circleci/config.yaml b/.circleci/config.yaml new file mode 100644 index 000000000..78a10166f --- /dev/null +++ b/.circleci/config.yaml @@ -0,0 +1,14 @@ +version: 2 + +jobs: + misspell: + docker: + - image: circleci/golang:1.12 + steps: + - checkout + - run: + name: Install tools + command: make install-tools + - run: + name: Verify + command: make circle-ci diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..30576cd33 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# All documents to be used in spell check. +ALL_DOC := $(shell find . -name '*.md' -type f | sort) + +MISSPELL=misspell -error +MISSPELL_CORRECTION=misspell -w + +.PHONY: circle-ci +circle-ci: misspell + +.PHONY: misspell +misspell: + $(MISSPELL) $(ALL_DOC) + +.PHONY: misspell-correction +misspell-correction: + $(MISSPELL_CORRECTION) $(ALL_DOC) + +.PHONY: install-tools +install-tools: + GO111MODULE=on go install \ + github.com/client9/misspell/cmd/misspell diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..6825a9cce --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/open-telemetry/rfcs + +go 1.12 + +require github.com/client9/misspell v0.3.4 diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..ee5948021 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= diff --git a/internal/tools.go b/internal/tools.go new file mode 100644 index 000000000..239c89ea5 --- /dev/null +++ b/internal/tools.go @@ -0,0 +1,27 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// +build tools + +package internal + +// This file follows the recommendation at +// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module +// on how to pin tooling dependencies to a go.mod file. +// This ensures that all systems use the same version of tools in addition to regular dependencies. + +import ( + _ "github.com/client9/misspell/cmd/misspell" +) From 396b2499df6fe0cd3c2e83356518efc60aa6a180 Mon Sep 17 00:00:00 2001 From: songy23 Date: Fri, 9 Aug 2019 13:38:11 -0700 Subject: [PATCH 2/5] Install tools locally to guarantee same version --- .circleci/config.yaml | 5 +---- .gitignore | 1 + Makefile | 20 +++++++++----------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yaml b/.circleci/config.yaml index 78a10166f..289e393ed 100644 --- a/.circleci/config.yaml +++ b/.circleci/config.yaml @@ -6,9 +6,6 @@ jobs: - image: circleci/golang:1.12 steps: - checkout - - run: - name: Install tools - command: make install-tools - run: name: Verify - command: make circle-ci + command: make precommit diff --git a/.gitignore b/.gitignore index e69de29bb..d0d16ba71 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +.tools diff --git a/Makefile b/Makefile index 30576cd33..40fde0eab 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,19 @@ # All documents to be used in spell check. -ALL_DOC := $(shell find . -name '*.md' -type f | sort) +ALL_DOCS := $(shell find . -name '*.md' -type f | sort) -MISSPELL=misspell -error -MISSPELL_CORRECTION=misspell -w +TOOLS_DIR := ./.tools -.PHONY: circle-ci -circle-ci: misspell +$(TOOLS_DIR)/misspell: go.mod go.sum internal/tools.go + go build -o $(TOOLS_DIR)/misspell github.com/client9/misspell/cmd/misspell + +.PHONY: precommit +precommit: $(TOOLS_DIR)/misspell misspell .PHONY: misspell misspell: - $(MISSPELL) $(ALL_DOC) + $(TOOLS_DIR)/misspell -error $(ALL_DOCS) .PHONY: misspell-correction misspell-correction: - $(MISSPELL_CORRECTION) $(ALL_DOC) + $(TOOLS_DIR)/misspell -w $(ALL_DOCS) -.PHONY: install-tools -install-tools: - GO111MODULE=on go install \ - github.com/client9/misspell/cmd/misspell From d3803761a777fd2de437336ce35d367e8db6fdd1 Mon Sep 17 00:00:00 2001 From: songy23 Date: Fri, 9 Aug 2019 13:46:46 -0700 Subject: [PATCH 3/5] Make Makefile less ambiguous --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 40fde0eab..3520a754a 100644 --- a/Makefile +++ b/Makefile @@ -2,18 +2,20 @@ ALL_DOCS := $(shell find . -name '*.md' -type f | sort) TOOLS_DIR := ./.tools - -$(TOOLS_DIR)/misspell: go.mod go.sum internal/tools.go - go build -o $(TOOLS_DIR)/misspell github.com/client9/misspell/cmd/misspell +MISSPELL_BINARY=$(TOOLS_DIR)/misspell .PHONY: precommit -precommit: $(TOOLS_DIR)/misspell misspell +precommit: install-misspell misspell + +.PHONY: install-misspell +install-misspell: go.mod go.sum internal/tools.go + go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell .PHONY: misspell misspell: - $(TOOLS_DIR)/misspell -error $(ALL_DOCS) + $(MISSPELL_BINARY) -error $(ALL_DOCS) .PHONY: misspell-correction misspell-correction: - $(TOOLS_DIR)/misspell -w $(ALL_DOCS) + $(MISSPELL_BINARY) -w $(ALL_DOCS) From eaeeaf2a1563894d8ac402e38ac8d98acbbaaf41 Mon Sep 17 00:00:00 2001 From: songy23 Date: Fri, 9 Aug 2019 14:46:32 -0700 Subject: [PATCH 4/5] Change config file to yml --- .circleci/{config.yaml => config.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .circleci/{config.yaml => config.yml} (100%) diff --git a/.circleci/config.yaml b/.circleci/config.yml similarity index 100% rename from .circleci/config.yaml rename to .circleci/config.yml From 0c3733e15604e57ca00ce9e03c2d857c9ae97451 Mon Sep 17 00:00:00 2001 From: songy23 Date: Fri, 9 Aug 2019 14:48:38 -0700 Subject: [PATCH 5/5] Top level job should be 'build' --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 289e393ed..933eac61a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - misspell: + build: docker: - image: circleci/golang:1.12 steps: