Skip to content

Commit

Permalink
[chore] add pipx, brewfile, and yamllint automation
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielp committed Jul 21, 2024
1 parent 5b640ca commit 4046d54
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ package-lock.json

# Python
venv

# Homebrew
Brewfile.lock.json
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brew "pipx"
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ environment configured:
npm install
```

- If [Homebrew](https://brew.sh) is installed on your system, you can install
GNU Sed and pipx with the following command:

```bash
brew bundle --force
```

- If you don't have Homebrew installed, you can install GNU Sed and pipx by
following the corresponding instructions for your operating system:
- [GNU Sed](https://www.gnu.org/software/sed/)
- [pipx](https://pypi.org/project/pipx/)
### 1. Modify the YAML model
Refer to the
Expand Down
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
ALL_DOCS := $(shell find . -type f -name '*.md' -not -path './.github/*' -not -path './node_modules/*' | sort)
PWD := $(shell pwd)

# Determine OS & Arch for specific OS only tools on Unix based systems
OS := $(shell uname | tr '[:upper:]' '[:lower:]')

TOOLS_DIR := ./internal/tools

MISSPELL_BINARY=bin/misspell
Expand All @@ -27,9 +30,8 @@ SEMCONVGEN_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
WEAVER_CONTAINER=$(WEAVER_CONTAINER_REPOSITORY)/otel/weaver:$(WEAVER_VERSION)
SEMCONVGEN_CONTAINER=$(SEMCONVGEN_CONTAINER_REPOSITORY)/otel/semconvgen:$(SEMCONVGEN_VERSION)

# TODO: add `yamllint` step to `all` after making sure it works on Mac.
.PHONY: all
all: install-tools markdownlint markdown-link-check misspell table-check compatibility-check schema-check \
all: install-tools markdownlint markdown-link-check misspell yamllint table-check compatibility-check schema-check \
check-file-and-folder-names-in-docs

.PHONY: check-file-and-folder-names-in-docs
Expand Down Expand Up @@ -94,14 +96,16 @@ markdownlint-old:
|| exit 1; \
done

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

.PHONY: yamllint
yamllint:
yamllint .
@if ! command -v pipx; then \
echo "pipx not found, please install pipx to run yamllint"; \
echo "see CONTRIBUTING.md for more information on pre-requisites"; \
exit 1; \
else \
pipx run "yamllint~=1.26.1" . -f github; \
fi


# Generate markdown tables from YAML definitions
.PHONY: table-generation
Expand Down Expand Up @@ -185,6 +189,7 @@ fix: table-generation attribute-registry-generation misspell-correction fix-form
install-tools: $(MISSPELL)
npm install
@echo "All tools installed"
if ()

$(CHLOGGEN):
cd $(TOOLS_DIR) && go build -o $(CHLOGGEN_BINARY) go.opentelemetry.io/build-tools/chloggen
Expand Down

0 comments on commit 4046d54

Please sign in to comment.