1
1
name : Orchestrion
2
2
on :
3
- workflow_dispatch : # manually
3
+ workflow_call : # From github.com/DataDog/orchestrion
4
+ inputs :
5
+ orchestrion-version :
6
+ description : Orchestrion version to use for integration testing
7
+ type : string
8
+ required : true
9
+ collect-coverage :
10
+ description : Whether to collect orchestrion coverage data or not
11
+ type : boolean
12
+ default : false
13
+ required : false
4
14
pull_request :
5
15
merge_group :
6
16
push :
@@ -14,13 +24,211 @@ permissions: read-all
14
24
15
25
concurrency :
16
26
# Automatically cancel previous runs if a new one is triggered to conserve resources.
17
- group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
27
+ group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}${{ inputs.orchestrion-version && format('-{0}', inputs.orchestrion-version) }}
18
28
cancel-in-progress : true
19
29
20
30
jobs :
21
- test :
22
- name : ' Run Tests'
23
- uses : DataDog/orchestrion/.github/workflows/workflow_call.yml@main # we don't want to pin our own action
24
- with :
25
- dd-trace-go-ref : ${{ github.sha }}
26
- runs-on : ubuntu-latest-16-cores
31
+ generate :
32
+ name : Verify generated files are up-to-date
33
+ # Don't run in workflow_call or workflow_dispatch
34
+ if : github.event_name == 'workflow_dispatch' || inputs.orchestrion-version == ''
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - name : Checkout Code
38
+ uses : actions/checkout@v4
39
+ - name : Setup Go
40
+ uses : actions/setup-go@v5
41
+ with :
42
+ go-version : stable
43
+ cache : true
44
+ cache-dependency-path : ' **/go.mod'
45
+ - name : Run generator
46
+ run : go generate ./internal/orchestrion/...
47
+ - name : Check for changes
48
+ run : git diff --exit-code
49
+
50
+ go-versions-matrix :
51
+ name : Go Versions Matrix
52
+ runs-on : ubuntu-latest
53
+ outputs :
54
+ json : ${{ steps.matrix.outputs.json }}
55
+ steps :
56
+ - name : Checkout Code
57
+ uses : actions/checkout@v4
58
+ with :
59
+ repository : ${{ inputs.orchestrion-version != '' && 'DataDog/dd-trace-go' || github.repository }}
60
+ ref : ${{ inputs.orchestrion-version != '' && 'romain.marcadier/APPSEC-55160/orchestrion' || github.sha }} # TODO: Change to `main` in workflow_call case
61
+ - name : Setup Go
62
+ uses : actions/setup-go@v5
63
+ with :
64
+ go-version : stable
65
+ cache : true
66
+ cache-dependency-path : ' **/go.mod'
67
+ - name : Compute Matrix
68
+ id : matrix
69
+ run : |-
70
+ echo -n "json=" >> "${GITHUB_OUTPUT}"
71
+ go run ./internal/orchestrion/matrix >> "${GITHUB_OUTPUT}"
72
+
73
+ integration-test :
74
+ needs : [go-versions-matrix]
75
+ strategy :
76
+ fail-fast : false
77
+ matrix :
78
+ runs-on :
79
+ - ubuntu
80
+ - macos
81
+ - windows
82
+ go-version : ${{ fromJSON(needs.go-versions-matrix.outputs.json) }}
83
+ mode : [DRIVER]
84
+ include :
85
+ # Alternate build modes (only on ubuntu with oldstable, so we save up CI time)
86
+ - runs-on : ubuntu
87
+ go-version : oldstable
88
+ mode : TOOLEXEC
89
+ - runs-on : ubuntu
90
+ go-version : oldstable
91
+ mode : GOFLAGS
92
+ name : Integration Test (${{ matrix.runs-on }} | ${{ matrix.go-version }} | ${{ matrix.mode }})
93
+ 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) }}
94
+ steps :
95
+ - name : Checkout Code
96
+ uses : actions/checkout@v4
97
+ with :
98
+ path : ${{ github.workspace }}/dd-trace-go
99
+ repository : ${{ inputs.orchestrion-version != '' && 'DataDog/dd-trace-go' || github.repository }}
100
+ ref : ${{ inputs.orchestrion-version != '' && 'romain.marcadier/APPSEC-55160/orchestrion' || github.sha }} # TODO: Change to `main` in workflow_call case
101
+ # If we're in workflow_dispatch/call, maybe we need to up/downgrade orchestrion
102
+ - name : Check out orchestrion
103
+ if : inputs.orchestrion-version != ''
104
+ id : checkout-orchestrion
105
+ uses : actions/checkout@v4
106
+ with :
107
+ path : ${{ github.workspace }}/orchestrion
108
+ repository : DataDog/orchestrion
109
+ ref : ${{ inputs.orchestrion-version }}
110
+
111
+ - name : Setup Go
112
+ id : setup-go
113
+ uses : actions/setup-go@v5
114
+ with :
115
+ go-version : ${{ matrix.go-version }}
116
+ cache : true
117
+ cache-dependency-path : |-
118
+ ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/go.mod
119
+ ${{ github.workspace }}/orchestrion/go.mod
120
+
121
+ # ddapm-test-agent is used to observe side effects from the tracer during integration tests.
122
+ - name : Set up Python
123
+ uses : actions/setup-python@v5
124
+ with :
125
+ python-version : 3.x
126
+ cache : pip
127
+ cache-dependency-path : ' ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt'
128
+ - name : Install ddapm-test-agent
129
+ run : pip install -r ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration/internal/agent/requirements-dev.txt
130
+
131
+ - name : Set up orchestrion
132
+ if : inputs.orchestrion-version != ''
133
+ run : |-
134
+ go mod edit -replace="github.com/DataDog/orchestrion=${{ github.workspace }}/orchestrion"
135
+ go mod tidy -go ${{ steps.setup-go.outputs.go-version }}
136
+ working-directory : ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
137
+ env :
138
+ VERSION : ${{ inputs.orchestrion-version }}
139
+ # We install the binary to the GOBIN, so it's easy to use
140
+ - name : Install orchestrion binary
141
+ if : ' !inputs.collect-coverage'
142
+ run : go install "github.com/DataDog/orchestrion"
143
+ working-directory : ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
144
+ - name : Build orchestrion binary
145
+ if : inputs.collect-coverage
146
+ shell : bash
147
+ run : |-
148
+ bin=$(go env GOPATH)/bin/orchestrion
149
+ if [[ '${{ matrix.runs-on }}' == 'windows' ]]; then
150
+ bin="${bin}.exe"
151
+ fi
152
+ mkdir -p "$(dirname "${bin}")"
153
+ go build -cover -covermode=atomic -coverpkg="github.com/DataDog/orchestrion/..." "-o=${bin}" "github.com/DataDog/orchestrion"
154
+ echo "GOCOVERDIR=$(mktemp -d)" >> "${GITHUB_ENV}"
155
+ working-directory : ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
156
+
157
+ # Run a `go mod tidy` because GitHub will run this on a candidate merge commit, and if there
158
+ # have been dependecy updates on the `main` branch, the `go.mod` and `go.sum` files for the
159
+ # integration test suite may no longer be up-to-date.
160
+ - name : Run 'go mod tidy'
161
+ run : go mod tidy
162
+ working-directory : ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
163
+
164
+ # Finally, we run the test suite!
165
+ - name : Run Tests
166
+ shell : bash
167
+ run : |-
168
+ echo "Working directory: ${PWD}"
169
+ orchestrion version
170
+
171
+ case "${MODE}" in
172
+ "DRIVER")
173
+ echo "Starting test suite in DRIVER mode"
174
+ orchestrion go test -shuffle=on ./...
175
+ ;;
176
+ "TOOLEXEC")
177
+ echo "Starting test suite in TOOLEXEC mode"
178
+ go test -shuffle=on -toolexec='orchestrion toolexec' ./...
179
+ ;;
180
+ "GOFLAGS")
181
+ echo "Starting test suite in GOFLAGS mode"
182
+ export GOFLAGS="${GOFLAGS} '-toolexec=orchestrion toolexec'"
183
+ go test -shuffle=on ./...
184
+ ;;
185
+ *)
186
+ echo "Unknown mode: ${MODE}"
187
+ ;;
188
+ esac
189
+ working-directory : ${{ github.workspace }}/dd-trace-go/internal/orchestrion/_integration
190
+ env :
191
+ MODE : ${{ matrix.mode }}
192
+ # The "buildtag" tag is used in //dd:span integration tests
193
+ GOFLAGS : -timeout=30m ${{ matrix.runs-on == 'ubuntu' && '-p=4' || '' }} -tags=githubci${{ matrix.mode == 'DRIVER' && ',buildtag' || ''}}
194
+ # Prevent auto-respawn, which is problematic with installs from commit SHA
195
+ DD_ORCHESTRION_IS_GOMOD_VERSION : true
196
+ # Ryuk is problematic with concurrent executions, and unnecessary in ephemeral environments like GHA.
197
+ TESTCONTAINERS_RYUK_DISABLED : true
198
+
199
+ # If in workflow_call, we collected coverage data we need to upload
200
+ - name : Consolidate coverage report
201
+ if : inputs.collect-coverage
202
+ shell : bash
203
+ run : |-
204
+ mkdir -p "${{ github.workspace }}/orchestrion/coverage"
205
+ go tool covdata textfmt -i "${GOCOVERDIR}" -o "${WORKSPACE}/orchestrion/coverage/integration.out"
206
+ env :
207
+ WORKSPACE : ${{ github.workspace }}
208
+ - name : Determine go minor version
209
+ if : inputs.collect-coverage
210
+ id : go
211
+ shell : bash
212
+ run : |-
213
+ set -euo pipefail
214
+ echo "version=$(echo '${{ steps.setup-go.outputs.go-version }}' | cut -d'.' -f1,2)" >> "${GITHUB_OUTPUT}"
215
+ - name : Upload coverage report
216
+ if : inputs.collect-coverage
217
+ uses : actions/upload-artifact@v4
218
+ with :
219
+ name : coverage-integration+${{ matrix.mode }}+go${{ steps.go.outputs.version }}+${{ runner.os }}+${{ runner.arch }}
220
+ path : ${{ github.workspace }}/orchestrion/coverage/integration.out
221
+
222
+ # This is a simple join point to make it easy to set up branch protection rules in GitHub.
223
+ integration-test-done :
224
+ name : Orchestrion Integration Tests
225
+ needs : integration-test
226
+ runs-on : ubuntu-latest
227
+ if : success() || failure()
228
+ steps :
229
+ - name : Success
230
+ if : needs.integration-test.result == 'success'
231
+ run : echo "Success!"
232
+ - name : Failure
233
+ if : needs.integration-test.result != 'success'
234
+ run : echo "Failure!" && exit 1
0 commit comments