diff --git a/.github/workflows/contrib-tests.yml b/.github/workflows/contrib-tests.yml new file mode 100644 index 00000000..deee8171 --- /dev/null +++ b/.github/workflows/contrib-tests.yml @@ -0,0 +1,23 @@ +name: contrib-tests +on: + push: + branches: [ main ] + tags: + - v[0-9]+.[0-9]+.[0-9]+.* + pull_request: + +jobs: + contrib_tests: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.17 + - name: Run Contrib Tests + run: | + contrib_path=/tmp/opentelemetry-collector-contrib + git clone https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path + ./check-contrib.sh diff --git a/check-contrib.sh b/check-contrib.sh new file mode 100755 index 00000000..8548232b --- /dev/null +++ b/check-contrib.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +CURDIR=$(pwd) +CONTRIB_PATH="/tmp/opentelemetry-collector-contrib" +LOG_COLLECTION_MOD_NAME="github.com/open-telemetry/opentelemetry-log-collection" +LOG_COLLECTION_MODULES=$(find ${CONTRIB_PATH} ! -path ${CONTRIB_PATH}/go.mod ! -path ${CONTRIB_PATH}/cmd/configschema/go.mod -type f -name "go.mod" -exec grep -l ${LOG_COLLECTION_MOD_NAME} {} \; | xargs -L 1 dirname | sort) +echo "Log collection modules - ${LOG_COLLECTION_MODULES}" + +for module in ${LOG_COLLECTION_MODULES} +do + pushd ${module} + go mod edit -replace github.com/open-telemetry/opentelemetry-log-collection=${CURDIR} + rm -fr go.sum + go mod tidy -compat=1.17 + go test + go mod edit -dropreplace github.com/open-telemetry/opentelemetry-log-collection + popd +done