Dependency Test #265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dependency Test | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/deps-test.yml | |
- internal/buildscripts/update-deps | |
schedule: | |
- cron: '0 12 * * 1-5' | |
env: | |
OTEL_VERSION: latest | |
jobs: | |
deps-test: | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19.0 | |
- name: Setup Go Environment | |
run: | | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Cache Go | |
id: module-cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-go-modules | |
with: | |
path: | | |
/home/runner/go/pkg/mod | |
key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.mod', '**/go.sum') }} | |
- name: Update Core/Contrib Dependencies to ${{ env.OTEL_VERSION }} | |
id: update-deps | |
shell: bash | |
run: | | |
OTEL_VERSION=${{ env.OTEL_VERSION }} ./internal/buildscripts/update-deps 2>&1 | tee -a /tmp/output.txt | |
if git diff --exit-code; then | |
echo "::set-output name=has_changes::false" | |
else | |
echo "::set-output name=has_changes::true" | |
fi | |
- name: Compile | |
shell: bash | |
if: success() && (steps.update-deps.outputs.has_changes == 'true') | |
run: make binaries-all-sys 2>&1 | tee -a output.txt | |
- name: Run Unit Tests | |
shell: bash | |
if: success() && (steps.update-deps.outputs.has_changes == 'true') | |
run: make test 2>&1 | tee -a /tmp/output.txt | |
- name: Build Image | |
shell: bash | |
if: success() && (steps.update-deps.outputs.has_changes == 'true') | |
env: | |
DOCKER_BUILDKIT: '1' | |
SKIP_COMPILE: "true" | |
run: make docker-otelcol 2>&1 | tee -a /tmp/output.txt | |
- name: Run Integration Tests | |
shell: bash | |
if: success() && (steps.update-deps.outputs.has_changes == 'true') | |
env: | |
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest' | |
run: make integration-test 2>&1 | tee -a output.txt | |
- name: Generate Report | |
if: failure() && (steps.update-deps.outputs.has_changes == 'true') | |
run: | | |
run_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | |
echo "[$run_url]($run_url)" > deps-test.md | |
if [ -f /tmp/output.txt ]; then | |
echo "\`\`\`" >> deps-test.md | |
tail -n50 /tmp/output.txt >> deps-test.md | |
echo "\`\`\`" >> deps-test.md | |
fi | |
- name: Create Issue | |
uses: peter-evans/create-issue-from-file@v4 | |
if: failure() && (steps.update-deps.outputs.has_changes == 'true') | |
with: | |
title: Dependency Test Report | |
content-filepath: ./deps-test.md | |
labels: report, automated issue |