Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run crosslink before checking for clean work tree #2623

Closed
wants to merge 3 commits into from
Closed

Run crosslink before checking for clean work tree #2623

wants to merge 3 commits into from

Conversation

dmathieu
Copy link
Member

This goes alongside my suggestion in #2613 (comment)

It runs make crosslink before checking for a clean work tree, so anything modifying go.mod in an invalid way would trigger a test failure.

This shouldn't need a changelog entry.

@pellared pellared added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Feb 17, 2022
@@ -41,6 +41,8 @@ jobs:
run: make dependabot-check license-check lint vanity-import-check
- name: Build
run: make build
- name: Run code generators
run: make crosslink
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about also adding it here https://github.com/open-telemetry/opentelemetry-go/blob/main/Makefile#L29?

Side note: Any reason why the GH workflow is not simply executing make ci?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems make ci sets things up and runs the tests, when this part of the workflow only sets things up, and they later run in separate steps?

@@ -38,7 +38,7 @@ jobs:
path: ~/.tools
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }}
- name: Run linters
run: make dependabot-check license-check lint vanity-import-check
run: make dependabot-check license-check lint vanity-import-check crosslink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get why this might be added here, but I want to point out that crosslink makes changes to files unlike all the other linters here. So if it does make a change, the error will be in the Check clean repository step. Which can make debugging this more difficult.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first commit added that as its own step. Though that seemed a bit overkill, I'm happy to bring it back.

Makefile Outdated
@@ -26,7 +26,7 @@ TIMEOUT = 60

.PHONY: precommit ci
precommit: license-check misspell go-mod-tidy golangci-lint-fix test-default
ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage
ci: dependabot-check license-check lint vanity-import-check crosslink build test-default check-clean-work-tree test-coverage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably just be part of the build target instead. Like, generate the proper replaces should exist before trying to build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved it there.

@@ -38,7 +38,7 @@ jobs:
path: ~/.tools
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }}
- name: Run linters
run: make dependabot-check license-check lint vanity-import-check
run: make dependabot-check license-check lint vanity-import-check crosslink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crosslink is a dependency of lint there is no need to add this.

@@ -79,7 +79,7 @@ generate/%: | $(STRINGER) $(PORTO)
&& cd $(DIR) \
&& PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && $(PORTO) -w .

build: generate $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%)
build: crosslink generate $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separating the build from module linting is the current design of this Makefile. These targets are joined together in the precommit and ci targets. I prefer to keep that design.

@dmathieu dmathieu closed this Feb 18, 2022
@dmathieu dmathieu deleted the ci-crosslink branch February 18, 2022 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants