-
Notifications
You must be signed in to change notification settings - Fork 18
146 lines (127 loc) · 4.46 KB
/
Copy pathintegration.yaml
File metadata and controls
146 lines (127 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Integration
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
schedule:
- cron: "0 * * * *" # run once every hour
permissions:
contents: read
jobs:
smoke-test:
name: Smoke test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set trace-start
id: set-trace-start
run: |
echo "trace-start=$(date +%s)" >> $GITHUB_OUTPUT
- name: Buildevents
uses: ./
with:
apikey: ${{ secrets.BUILDEVENTS_APIKEY }}
dataset: gha-buildevents_integration
- name: Print contents of BUILDEVENT_FILE
run: |
echo Contents of BUILDEVENT_FILE:
cat $BUILDEVENT_FILE
- run: |
JOB_ID=smoke-test
echo "JOB_ID=${JOB_ID}" >> $GITHUB_ENV
echo "JOB_START=$(date +%s)" >> $GITHUB_ENV
- run: |
buildevents cmd $TRACE_ID $JOB_ID sleep -- sleep 5
- run: |
buildevents cmd $TRACE_ID $JOB_ID 'sleep some more' -- sleep 2
- name: Send parent span for job
if: ${{ always() }}
run: |
printf "\njob.status=${{ job.status }}" >> $BUILDEVENT_FILE
buildevents step $TRACE_ID $JOB_ID $JOB_START $JOB_ID
outputs:
trace-start: ${{ steps.set-trace-start.outputs.trace-start }}
smoke-test-windows:
name: Smoke test (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Buildevents
uses: ./
with:
apikey: ${{ secrets.BUILDEVENTS_APIKEY }}
dataset: gha-buildevents_integration
- name: Print contents of BUILDEVENT_FILE
shell: pwsh
run: |
echo "Contents of BUILDEVENT_FILE:"
Get-Content $env:BUILDEVENT_FILE
- shell: pwsh
run: |
$env:JOB_ID = "smoke-test-windows"
echo "JOB_ID=$($env:JOB_ID)" >> $env:GITHUB_ENV
echo "JOB_START=$([DateTimeOffset]::UtcNow.ToUnixTimeSeconds())" >> $env:GITHUB_ENV
- shell: pwsh
run: |
buildevents cmd $env:TRACE_ID $env:JOB_ID sleep --shell powershell.exe -- "Start-Sleep -Seconds 5"
- shell: pwsh
run: |
buildevents cmd $env:TRACE_ID $env:JOB_ID 'sleep some more' --shell powershell.exe -- "Start-Sleep -Seconds 2"
- name: Send parent span for job
if: ${{ always() }}
shell: pwsh
run: |
"`njob.status=${{ job.status }}" | Out-File -Append -NoNewline -Encoding utf8 $env:BUILDEVENT_FILE
buildevents step $env:TRACE_ID $env:JOB_ID $env:JOB_START $env:JOB_ID
matrix:
name: Matrix
runs-on: ubuntu-latest
needs: [smoke-test]
strategy:
fail-fast: false
matrix:
value: [valueA, valueB]
steps:
- uses: actions/checkout@v6
- name: Buildevents
uses: ./
with:
apikey: ${{ secrets.BUILDEVENTS_APIKEY }}
dataset: gha-buildevents_integration
matrix-key: ${{ matrix.value }}
- run: |
JOB_ID=matrix-${{ matrix.value }}
echo "JOB_ID=${JOB_ID}" >> $GITHUB_ENV
echo "JOB_START=$(date +%s)" >> $GITHUB_ENV
- run: |
buildevents cmd $TRACE_ID $JOB_ID ${{ matrix.value }} -- echo The matrix value is ${{ matrix.value }}
- run: |
buildevents cmd $TRACE_ID $JOB_ID sleep -- sleep 2
- name: Send parent span for job
if: ${{ always() }}
run: |
printf "\njob.status=${{ job.status }}" >> $BUILDEVENT_FILE
buildevents step $TRACE_ID $JOB_ID $JOB_START $JOB_ID
end-trace:
name: End Trace
runs-on: ubuntu-latest
permissions:
contents: read
needs: [smoke-test, matrix]
if: ${{ always() }}
steps:
- uses: actions/checkout@v6
- name: Buildevents
uses: ./
with:
# Required: a Honeycomb API key - needed to send traces.
# this must be set in your GitHub repository under Settings > Secrets > Actions
apikey: ${{ secrets.BUILDEVENTS_APIKEY }}
# Required: the Honeycomb dataset to send traces to.
dataset: gha-buildevents_integration
# Required: the job status, this will be used in the post section and sent
# as status of the trace. Must always be ${{ job.status }}.
status: ${{ contains(needs.*.result, 'failure') && 'failure' || contains(needs.*.result, 'cancelled') && 'cancelled' || 'success' }}
trace-start: ${{ needs.smoke-test.outputs.trace-start}}