Skip to content

Commit

Permalink
[chore] Add test to ensure metadata.yaml is present for all components (
Browse files Browse the repository at this point in the history
open-telemetry#24643)

**Description:**
This PR uses the checkfile tool introduced in
open-telemetry/opentelemetry-go-build-tools#348
in order to validate the presence of the metadata.yaml file in all
components. It also removes the checkdoc tool in favor of the checkfile
tool, which is now also used to validate the presence of README.md.

**Link to tracking Issue:**
open-telemetry#23376
  • Loading branch information
mackjmr committed Jul 27, 2023
1 parent bca4670 commit bd5439c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ jobs:
run: make install-tools
- name: CheckDoc
run: make checkdoc
- name: CheckMetadata
run: make checkmetadata
- name: Porto
run: |
make -j2 goporto
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,13 @@ build-examples:

# Verify existence of READMEs for components specified as default components in the collector.
.PHONY: checkdoc
checkdoc: $(CHECKDOC)
$(CHECKDOC) --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME)
checkdoc: $(CHECKFILE)
$(CHECKFILE) --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME) --file-name "README.md"

# Verify existence of metadata.yaml for components specified as default components in the collector.
.PHONY: checkmetadata
checkmetadata: $(CHECKFILE)
$(CHECKFILE) --project-path $(CURDIR) --component-rel-path $(COMP_REL_PATH) --module-name $(MOD_NAME) --file-name "metadata.yaml"

.PHONY: all-checklinks
all-checklinks:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ MULITMOD := $(TOOLS_BIN_DIR)/multimod
CHLOGGEN := $(TOOLS_BIN_DIR)/chloggen
GOIMPORTS := $(TOOLS_BIN_DIR)/goimports
PORTO := $(TOOLS_BIN_DIR)/porto
CHECKDOC := $(TOOLS_BIN_DIR)/checkdoc
CHECKFILE := $(TOOLS_BIN_DIR)/checkfile
CROSSLINK := $(TOOLS_BIN_DIR)/crosslink
GOJUNIT := $(TOOLS_BIN_DIR)/go-junit-report
BUILDER := $(TOOLS_BIN_DIR)/builder
Expand Down
4 changes: 2 additions & 2 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/google/addlicense v1.1.1
github.com/jcchavezs/porto v0.4.0
github.com/jstemmer/go-junit-report v1.0.0
go.opentelemetry.io/build-tools/checkdoc v0.9.0
go.opentelemetry.io/build-tools/checkfile v0.10.0
go.opentelemetry.io/build-tools/chloggen v0.9.0
go.opentelemetry.io/build-tools/crosslink v0.9.0
go.opentelemetry.io/build-tools/issuegenerator v0.9.0
Expand Down Expand Up @@ -197,7 +197,7 @@ require (
github.com/yeya24/promlinter v0.2.0 // indirect
github.com/ykadowak/zerologlint v0.1.2 // indirect
gitlab.com/bosi/decorder v0.2.3 // indirect
go.opentelemetry.io/build-tools v0.9.0 // indirect
go.opentelemetry.io/build-tools v0.10.0 // indirect
go.tmz.dev/musttag v0.7.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions internal/tools/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
_ "github.com/google/addlicense"
_ "github.com/jcchavezs/porto/cmd/porto"
_ "github.com/jstemmer/go-junit-report"
_ "go.opentelemetry.io/build-tools/checkdoc"
_ "go.opentelemetry.io/build-tools/checkfile"
_ "go.opentelemetry.io/build-tools/chloggen"
_ "go.opentelemetry.io/build-tools/crosslink"
_ "go.opentelemetry.io/build-tools/issuegenerator"
Expand Down

0 comments on commit bd5439c

Please sign in to comment.