Skip to content

Commit

Permalink
[chore] make contrib tests more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Feb 25, 2025
1 parent 5812712 commit 7cae2eb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,26 @@ concurrency:
permissions: read-all

jobs:
contrib-tests-prepare:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Prepare Contrib Tests
run: |
contrib_path=/tmp/opentelemetry-collector-contrib
git clone --depth=1 https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path
make CONTRIB_PATH=$contrib_path prepare-contrib
- uses: actions/upload-artifact@v4
with:
name: contrib
path: /tmp/opentelemetry-collector-contrib/
include-hidden-files: true

contrib-tests-matrix:
runs-on: ubuntu-latest
needs: [contrib-tests-prepare]
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }}
strategy:
fail-fast: false
Expand All @@ -41,16 +59,18 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download contrib
uses: actions/download-artifact@v4
with:
name: contrib
path: /tmp/contrib
- name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ~1.23.6
cache: false
- name: Run Contrib Tests
run: |
contrib_path=/tmp/opentelemetry-collector-contrib
git clone --depth=1 https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path
make CONTRIB_PATH=$contrib_path SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib
- name: Run tests
run: make CONTRIB_PATH=/tmp/contrib SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib

contrib_tests:
runs-on: ubuntu-latest
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,19 @@ gensemconv: $(SEMCONVGEN) $(SEMCONVKIT)

ALL_MOD_PATHS := "" $(ALL_MODULES:.%=%)

# Checks that the HEAD of the contrib repo checked out in CONTRIB_PATH compiles
# against the current version of this repo.
.PHONY: check-contrib
check-contrib:
.PHONY: prepare-contrib
prepare-contrib:
@echo Setting contrib at $(CONTRIB_PATH) to use this core checkout
@$(MAKE) -j2 -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit \
$(addprefix -replace ,$(join $(ALL_MOD_PATHS:%=go.opentelemetry.io/collector%=),$(ALL_MOD_PATHS:%=$(CURDIR)%)))"
@$(MAKE) -j2 -C $(CONTRIB_PATH) gotidy

@$(MAKE) generate-contrib

# Checks that the HEAD of the contrib repo checked out in CONTRIB_PATH compiles
# against the current version of this repo.
.PHONY: check-contrib
check-contrib:
@echo -e "\nRunning tests"
@$(MAKE) -C $(CONTRIB_PATH) gotest

Expand Down

0 comments on commit 7cae2eb

Please sign in to comment.