Skip to content

Commit

Permalink
Improve infra/ci (open-telemetry#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang authored Apr 27, 2022
1 parent 9308e50 commit 6a01bcc
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ labels: bug
Which version of the demo you are using? (please provide either a specific
[commit
hash](https://github.com/open-telemetry/opentelemetry-demo-webstore/commits/main)
or a specific release).
or a specific
[release](https://github.com/open-telemetry/opentelemetry-demo-webstore/releases)).

## Symptom

A clear and concise description of what the bug is.

**What is the expected behavior?**

What did you expect to see?
What do you expect to see?

**What is the actual behavior?**

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ labels: question

# Question

Use [Github Discussions](https://github.com/open-telemetry/opentelemetry-dotnet/discussions/new).
Use [Github Discussions](https://github.com/open-telemetry/opentelemetry-demo-webstore/discussions/).
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/stale@v5
with:
stale-pr-message: 'This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day.'
stale-pr-message: 'This PR was marked stale due to lack of activity. It will be closed in 7 days.'
close-pr-message: 'Closed as inactive. Feel free to reopen if this PR is still being worked on.'
operations-per-run: 400
days-before-pr-stale: 7
Expand Down
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# IntelliJ IDEA
.idea
*.iml

# Eclipse
.classpath
.project
.settings
bin

# NetBeans
/.nb-gradle
/.nb-gradle-properties

# OS X
.DS_Store

# Emacs
*~
\#*\#

# Vim
.swp

# Misspell binary
internal/tools/bin

# Node.js files for tools (e.g. markdown-toc)
node_modules/
package-lock.json
15 changes: 15 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends: default

rules:
document-start: disable
octal-values: enable
truthy:
allowed-values: ['true', 'false', 'on'] # 'on' for GH action trigger
line-length:
max: 200
indentation:
check-multi-line-strings: false
indent-sequences: consistent
brackets:
max-spaces-inside: 1
max-spaces-inside-empty: 0
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# All documents to be used in spell check.
ALL_DOCS := $(shell find . -type f -name '*.md' -not -path './.github/*' -not -path './node_modules/*' | sort)
PWD := $(shell pwd)

TOOLS_DIR := ./internal/tools
MISSPELL_BINARY=bin/misspell
MISSPELL = $(TOOLS_DIR)/$(MISSPELL_BINARY)

# see https://github.com/open-telemetry/build-tools/releases for semconvgen updates
# Keep links in semantic_conventions/README.md and .vscode/settings.json in sync!
SEMCONVGEN_VERSION=0.11.0

# TODO: add `yamllint` step to `all` after making sure it works on Mac.
.PHONY: all
all: install-tools markdownlint misspell

$(MISSPELL):
cd $(TOOLS_DIR) && go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell

.PHONY: misspell
misspell: $(MISSPELL)
$(MISSPELL) -error $(ALL_DOCS)

.PHONY: misspell-correction
misspell-correction: $(MISSPELL)
$(MISSPELL) -w $(ALL_DOCS)

.PHONY: markdownlint
markdownlint:
@if ! npm ls markdownlint; then npm install; fi
@for f in $(ALL_DOCS); do \
echo $$f; \
npx --no -p markdownlint-cli markdownlint -c .markdownlint.yaml $$f \
|| exit 1; \
done

.PHONY: install-yamllint
install-yamllint:
# Using a venv is recommended
pip install -U yamllint~=1.26.1

.PHONY: yamllint
yamllint:
yamllint .

# Run all checks in order of speed / likely failure.
.PHONY: check
check: misspell markdownlint
@echo "All checks complete"

# Attempt to fix issues / regenerate tables.
.PHONY: fix
fix: misspell-correction
@echo "All autofixes complete"

.PHONY: install-tools
install-tools: $(MISSPELL)
npm install
@echo "All tools installed"
5 changes: 5 additions & 0 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/open-telemetry/opentelemetry-specification/internal/tools

go 1.12

require github.com/client9/misspell v0.3.4
2 changes: 2 additions & 0 deletions internal/tools/go.sum
Original file line number Diff line number Diff line change
@@ -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=
27 changes: 27 additions & 0 deletions internal/tools/tools.go
Original file line number Diff line number Diff line change
@@ -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 tools

// 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"
)
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"devDependencies": {
"markdown-link-check": "^3.9.3",
"markdown-toc": "^1.2.0",
"markdownlint-cli": "0.31.0"
}
}

0 comments on commit 6a01bcc

Please sign in to comment.