Skip to content

Commit

Permalink
[chore][scoped-test] Don't do a literal expansion for changed files (#…
Browse files Browse the repository at this point in the history
…37298)

Doing in place expansion leads to hitting bash line size limits, this is
a cheap improvement that makes less likely to hit cases like #37287.

Tests on my fork
https://github.com/pjanotti/opentelemetry-service-contrib/actions/runs/12836050460/job/35796880868
  • Loading branch information
pjanotti authored Jan 18, 2025
1 parent 9cd3a36 commit 3f1d256
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ CHANGED_GOLANG_SOURCES?=$(shell git diff main --name-only | grep -E '.*\.go$$' |
.PHONY: for-affected-components
for-affected-components:
@echo "Checking for affected components..."
@if [ -z '$(CHANGED_GOLANG_SOURCES)' ]; then \
@if [ -z '$${CHANGED_GOLANG_SOURCES}' ]; then \
echo "No go source changes detected in shippable code."; \
else \
cd $(SRC_ROOT); \
DEPENDENT_PKGS=$$(echo $(CHANGED_GOLANG_SOURCES) | xargs sed -n 's|^package .* // import "\(.*\)"$$|\1|p' | uniq); \
DEPENDENT_PKGS=$$(echo $${CHANGED_GOLANG_SOURCES} | xargs sed -n 's|^package .* // import "\(.*\)"$$|\1|p' | uniq); \
if [ -z '$${DEPENDENT_PKGS}' ]; then \
echo "No other package depends on the one being changed."; \
else \
Expand All @@ -289,11 +289,11 @@ CHANGED_GOLANG_TESTS?=$(shell git diff main --name-only | grep -E '.*_test\.go$$
.PHONY: run-changed-tests
run-changed-tests:
@echo "Checking for affected tests..."
@if [ -z '$(CHANGED_GOLANG_TESTS)' ]; then \
@if [ -z '$${CHANGED_GOLANG_TESTS}' ]; then \
echo "No go test changes detected."; \
else \
cd $(SRC_ROOT); \
AFFECTED_TEST_DIRS=$$(echo $(CHANGED_GOLANG_TESTS) | tr ' ' '\n' | xargs dirname | uniq); \
AFFECTED_TEST_DIRS=$$(echo $${CHANGED_GOLANG_TESTS} | tr ' ' '\n' | xargs dirname | uniq); \
if [ -z '$${AFFECTED_TEST_DIRS}' ]; then \
echo "Failed to find the affected test directories."; \
else \
Expand Down

0 comments on commit 3f1d256

Please sign in to comment.