[chore] make contrib tests more efficient (#12490)
Instead of having each test group edit modules, tidy and generate, do it once and share the output in each subtest to save 5 minutes per branch.
This commit is contained in:
parent
80fd8563cc
commit
9861e0a775
|
|
@ -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
|
||||
|
|
@ -40,16 +58,20 @@ 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
|
||||
- name: Run 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
|
||||
chmod +x /tmp/contrib/.tools/*
|
||||
make CONTRIB_PATH=/tmp/contrib SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib
|
||||
|
||||
contrib_tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
10
Makefile
10
Makefile
|
|
@ -261,10 +261,8 @@ 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)%)))"
|
||||
|
|
@ -272,6 +270,10 @@ check-contrib:
|
|||
|
||||
@$(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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue