Skip to content

Commit

Permalink
Check out orchestrion (go get can't necessarily resolve any SHA githu…
Browse files Browse the repository at this point in the history
…b may produce)
  • Loading branch information
RomainMuller committed Jan 13, 2025
1 parent 03f1102 commit 529d373
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/orchestrion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/dd-trace-go
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 }}
Expand All @@ -89,40 +90,53 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: 'internal/orchestrion/_integration/go.mod'
cache-dependency-path: '${{ github.workspace }}/dd-trace-go/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'
cache-dependency-path: '${{ github.workspace }}/dd-trace-go/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
run: pip install -r ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt

# If we're in workflow_dispatch/call, maybe we need to up/downgrade orchestrion
- name: Check out orchestrion
if: inputs.orchestrion-version != ''
id: checkout-orchestrion
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/orchestrion
repository: DataDog/orchestrion
ref: ${{ inputs.orchestrion-version }}
- name: Set up orchestrion
if: inputs.orchestrion-version != ''
run: |-
go get "github.com/DataDog/orchestrion@${VERSION}"
go mod edit -replace "github.com/DataDog/orchestrion=${{ github.workspace }}/orchestrion"
go mod tidy
working-directory: internal/orchestrion/_integration
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
env:
VERSION: ${{ 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
working-directory: ${{ github.workspace }}/dd-trace-go/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"
bin=$(go env GOPATH)/bin/orchestrion
if [[ '${{ matrix.runs-on }}' == 'windows' ]]; then
bin="${bin}.exe"
fi
mkdir -p "$(dirname "${bin}")"
go build -cover -covermode=atomic -coverpkg="github.com/DataDog/orchestrion/..." "-o=${bin}" "github.com/DataDog/orchestrion"
echo "GOCOVERDIR=$(mktemp -d)" >> "${GITHUB_ENV}"
working-directory: internal/orchestrion/_integration
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration

# Finally, we run the test suite!
- name: Run Tests
Expand All @@ -143,16 +157,19 @@ jobs:
echo "Unknown mode: ${MODE}"
;;
esac
working-directory: internal/orchestrion/_integration
working-directory: ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
env:
GOFLAGS: -tags=githubci${{ matrix.mode == 'DRIVER' && ',buildtag' || ''}} # The "buildtag" tag is used in //dd:span integration tests
GOFLAGS: -timeout=30m -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
shell: bash
run: |-
mkdir -p "${{ github.workspace }}/orchestrion/coverage"
go tool covdata textfmt -i "${GOCOVERDIR}" -o ${{ github.workspace }}/orchestrion/coverage/integration.out
- name: Determine go minor version
if: inputs.collect-coverage
id: go
Expand All @@ -165,4 +182,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: coverage-integration+${{ matrix.mode }}+go${{ steps.go.outputs.version }}+${{ runner.os }}+${{ runner.arch }}
path: ./coverage/integration.out
path: ${{ github.workspace }}/orchestrion/coverage/integration.out

0 comments on commit 529d373

Please sign in to comment.