| 1 |
name: contrib-tests |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: [main] |
| 5 |
tags: |
| 6 |
- v[0-9]+.[0-9]+.[0-9]+.* |
| 7 |
pull_request: |
| 8 |
types: [opened, ready_for_review, synchronize, reopened, labeled, unlabeled] |
| 9 |
branches: [main] |
| 10 |
merge_group: |
| 11 |
types: [checks_requested] |
| 12 |
|
| 13 |
concurrency: |
| 14 |
group: ${{ github.workflow }}-${{ github.ref_name }} |
| 15 |
cancel-in-progress: true |
| 16 |
|
| 17 |
permissions: read-all |
| 18 |
|
| 19 |
jobs: |
| 20 |
contrib-tests-prepare: |
| 21 |
runs-on: ubuntu-latest |
| 22 |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }} |
| 23 |
steps: |
| 24 |
- name: Checkout Repo |
| 25 |
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 |
| 26 |
- name: Prepare Contrib Tests |
| 27 |
run: | |
| 28 |
contrib_path=/tmp/opentelemetry-collector-contrib |
| 29 |
git clone --depth=1 https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path |
| 30 |
make CONTRIB_PATH=$contrib_path prepare-contrib |
| 31 |
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 32 |
with: |
| 33 |
name: contrib |
| 34 |
path: /tmp/opentelemetry-collector-contrib/ |
| 35 |
include-hidden-files: true |
| 36 |
|
| 37 |
contrib-tests-matrix: |
| 38 |
runs-on: ubuntu-latest |
| 39 |
needs: [contrib-tests-prepare] |
| 40 |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }} |
| 41 |
strategy: |
| 42 |
fail-fast: false |
| 43 |
matrix: |
| 44 |
group: |
| 45 |
- receiver-0 |
| 46 |
- receiver-1 |
| 47 |
- receiver-2 |
| 48 |
- receiver-3 |
| 49 |
- processor |
| 50 |
- exporter-0 |
| 51 |
- exporter-1 |
| 52 |
- extension |
| 53 |
- connector |
| 54 |
- internal |
| 55 |
- pkg |
| 56 |
- cmd-0 |
| 57 |
- other |
| 58 |
steps: |
| 59 |
- name: Checkout Repo |
| 60 |
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 |
| 61 |
- name: Download contrib |
| 62 |
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 |
| 63 |
with: |
| 64 |
name: contrib |
| 65 |
path: /tmp/contrib |
| 66 |
- name: Setup Go |
| 67 |
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 |
| 68 |
with: |
| 69 |
go-version: oldstable |
| 70 |
cache: false |
| 71 |
|
| 72 |
- name: Cache Go |
| 73 |
id: go-cache |
| 74 |
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 |
| 75 |
with: |
| 76 |
path: | |
| 77 |
~/go/bin |
| 78 |
~/go/pkg/mod |
| 79 |
key: go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }} |
| 80 |
|
| 81 |
- name: Run tests |
| 82 |
run: | |
| 83 |
chmod +x /tmp/contrib/.tools/* |
| 84 |
make CONTRIB_PATH=/tmp/contrib SKIP_RESTORE_CONTRIB=true GROUP=${{ matrix.group }} check-contrib |
| 85 |
|
| 86 |
contrib_tests: |
| 87 |
runs-on: ubuntu-latest |
| 88 |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Contrib Tests') }} |
| 89 |
needs: [contrib-tests-matrix] |
| 90 |
steps: |
| 91 |
- name: Print result |
| 92 |
run: echo ${{ needs.contrib-tests-matrix.result }} |
| 93 |
- name: Interpret result |
| 94 |
run: | |
| 95 |
if [[ success == ${{ needs.contrib-tests-matrix.result }} ]] |
| 96 |
then |
| 97 |
echo "All matrix jobs passed!" |
| 98 |
else |
| 99 |
echo "One or more matrix jobs failed." |
| 100 |
false |
| 101 |
fi |