Skip to content

[contrib] add orchestrion integration configuration #1468

[contrib] add orchestrion integration configuration

[contrib] add orchestrion integration configuration #1468

Workflow file for this run

name: Orchestrion
on:
workflow_dispatch: # manually
inputs:
orchestrion-version:
description: Orchestrion version to use for integration testing
type: string
required: false
workflow_call: # From github.com/DataDog/orchestrion
inputs:
orchestrion-version:
description: Orchestrion version to use for integration testing
type: string
required: true
collect-coverage:
description: Whether to collect orchestrion coverage data or not
type: boolean
default: false
required: false
pull_request:
merge_group:
push:
branches:
- release-v*
tags-ignore:
- 'contrib/**'
- 'instrumentation/**'
permissions: read-all
concurrency:
# Automatically cancel previous runs if a new one is triggered to conserve resources.
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}${{ inputs.orchestrion-version && format('-{0}', inputs.orchestrion-version) }}
cancel-in-progress: true
jobs:
generate:
name: Verify generated files are up-to-date
# Don't run in workflow_call or workflow_dispatch
if: github.event_name == 'workflow_dispatch' || inputs.orchestrion-version == ''
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: true
cache-dependency-path: '**/go.mod'
- name: Run generator
run: go generate ./internal/orchestrion/...
- name: Check for changes
run: git diff --exit-code
integration-test:
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu
- macos
- windows
go-version: [oldstable, stable]
mode: [DRIVER]
include:
# Alternate build modes (only on ubuntu with oldstable, so we save up CI time)
- runs-on: ubuntu
go-version: oldstable
mode: TOOLEXEC
- runs-on: ubuntu
go-version: oldstable
mode: GOFLAGS
name: Integration Test (${{ matrix.runs-on }} / ${{ matrix.go-version }} / ${{ matrix.mode }})
runs-on: ${{ matrix.runs-on == 'ubuntu' && fromJson('{"labels":"ubuntu-16-core-latest","group":"Large Runner Shared Public"}') || (matrix.runs-on == 'windows' && fromJson('{"labels":"windows-shared-8core","group":"LARGE WINDOWS SHARED"}')) || format('{0}-latest', matrix.runs-on) }}
env:
# Ryuk is problematic with concurrent executions, and unnecessary in ephemeral environments like GHA.
TESTCONTAINERS_RYUK_DISABLED: true
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: ${{ github.event != 'workflow_dispatch' && inputs.orchestrion-version != '' && 'DataDog/dd-trace-go' || github.repository }}
# TODO: workflow_call ref should be set to `main` before merging...
ref: ${{ github.event != 'workflow_dispatch' && inputs.orchestrion-version != '' && 'romain.marcadier/APPSEC-55160/orchestrion' || github.sha }}
- name: Setup Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: 'internal/orchestrion/_integration/go.mod'
# ddapm-test-agent is used to observe side effects from the tracer during integration tests.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
cache-dependency-path: 'internal/orchestrion/_integration/internal/agent/requirements-dev.txt'
- name: Install ddapm-test-agent
run: pip install -r internal/orchestrion/_integration/internal/agent/requirements-dev.txt
# If we're in workflow_dispatch/call, maybe we need to up/downgrade orchestrion
- name: Set up orchestrion
if: inputs.orchestrion-version != ''
run: |-
go get "github.com/DataDog/orchestrion@${VERSION}"
go mod tidy
working-directory: internal/orchestrion/_integration
env:
VERSION: ${{ github.event.inputs.orchestrion-version }}
# We install the binary to the GOBIN, so it's easy to use
- name: Install orchestrion binary
if: '!inputs.collect-coverage'
run: |-
go install "github.com/DataDog/orchestrion"
working-directory: internal/orchestrion/_integration
- name: Build orchestrion binary
if: inputs.collect-coverage
shell: bash
run: |-
go build -cover -covermode=atomic -coverpkg="github.com/DataDog/orchestrion/..." -o=/usr/local/bin/orchestrion "github.com/DataDog/orchestrion"
echo "GOCOVERDIR=$(mktemp -d)" >> "${GITHUB_ENV}"
working-directory: internal/orchestrion/_integration
# Finally, we run the test suite!
- name: Run Tests
shell: bash
run: |-
case "${MODE}" in
"DRIVER")
orchestrion go test -shuffle=on ./...
;;
"TOOLEXEC")
go test -shuffle=on -toolexec='orchestrion toolexec' ./...
;;
"GOFLAGS")
export GOFLAGS="${GOFLAGS} '-toolexec=orchestrion toolexec'"
go test -shuffle=on ./...
;;
*)
echo "Unknown mode: ${MODE}"
;;
esac
working-directory: internal/orchestrion/_integration
env:
GOFLAGS: -tags=githubci${{ matrix.mode == 'DRIVER' && ',buildtag' || ''}} # The "buildtag" tag is used in //dd:span integration tests
MODE: ${{ matrix.mode }}
DD_ORCHESTRION_IS_GOMOD_VERSION: true # Prevent auto-respawn, which is problematic with installs from commit SHA
# If in workflow_call, we collected coverage data we need to upload
- name: Consolidate coverage report
if: inputs.collect-coverage
run: go tool covdata textfmt -i "${GOCOVERDIR}" -o ./coverage/integration.out
- name: Determine go minor version
if: inputs.collect-coverage
id: go
shell: bash
run: |-
set -euo pipefail
echo "version=$(echo '${{ steps.setup-go.outputs.go-version }}' | cut -d'.' -f1,2)" >> "${GITHUB_OUTPUT}"
- name: Upload coverage report
if: inputs.collect-coverage
uses: actions/upload-artifact@v4
with:
name: coverage-integration+${{ matrix.mode }}+go${{ steps.go.outputs.version }}+${{ runner.os }}+${{ runner.arch }}
path: ./coverage/integration.out