Skip to content

Commit

Permalink
Add workflow for testing contrib repo (open-telemetry#232)
Browse files Browse the repository at this point in the history
* Add workflow for testing contrib repo

Fixes open-telemetry#199

* Add changes suggested by @djaglowski in code review

* Ignore top level module and add -compat to go mod tidy
  • Loading branch information
prasadkatti authored Sep 9, 2021
1 parent 049d0cb commit 85bc3f4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions check-contrib.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 85bc3f4

Please sign in to comment.