-
Notifications
You must be signed in to change notification settings - Fork 93
192 lines (179 loc) · 6.71 KB
/
ci.yml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: ci
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- machine: windows-2022
containers: windows
- machine: ubuntu-20.04
containers: linux
- machine: macos-11
containers: none
runs-on: ${{ matrix.machine }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
dotnet-version: |
6.0.x
7.0.x
- name: Install SQL Server (localdb)
uses: potatoqualitee/[email protected]
if: ${{ runner.os == 'Windows' }}
with:
install: localdb
- run: ./build.cmd Workflow --containers ${{ matrix.containers }}
- name: Upload logs
uses: actions/[email protected]
if: always()
with:
name: logs-${{ matrix.machine }}
path: build_data/
- name: Upload binaries
uses: actions/[email protected]
if: always()
with:
name: bin-${{ matrix.machine }}
path: bin/tracer-home
build-container:
strategy:
fail-fast: false
matrix:
base-image: [ alpine ]
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/[email protected]
- name: Build in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" .
docker run --rm --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project mybuildimage \
./build.sh Workflow --containers none
- name: Publish Linux build
uses: actions/[email protected]
with:
name: bin-${{ matrix.base-image }}
path: bin/tracer-home
if: (${{ job.status }} != 'cancelled')
continue-on-error: true
powershell-script:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release PR') }}
runs-on: windows-2022
steps:
- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- name: Test the PowerShell module instructions from README.md
shell: powershell
run: |
$module_url = "https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/OpenTelemetry.DotNet.Auto.psm1"
$dl_path = Join-Path $env:temp "OpenTelemetry.DotNet.Auto.psm1"
$log_path = "C:\ProgramData\OpenTelemetry .NET AutoInstrumentation\logs\*"
Invoke-WebRequest -Uri $module_url -OutFile $dl_path
Import-Module $dl_path
Install-OpenTelemetryCore
$install_dir = Get-OpenTelemetryInstallDirectory
Register-OpenTelemetryForCurrentSession -OTelServiceName "MyServiceDisplayName"
dotnet help
if (-not $?) { throw "dotnet help returned exit code: $LASTEXITCODE" }
if (-not (Test-Path $log_path)) { throw "Log file does not exist. Instrumentation test failed." }
Remove-Item $log_path
Unregister-OpenTelemetryForCurrentSession
dotnet help
if (-not $?) { throw "dotnet help returned exit code: $LASTEXITCODE" }
if (Test-Path $log_path) { throw "Log file exists. Instrumentation unregister failed." }
Uninstall-OpenTelemetryCore
if (Test-Path $install_dir) { throw "Core files exist. Core uninstall failed." }
shell-scripts:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release PR') }}
strategy:
fail-fast: false
matrix:
include:
- machine: windows-2022
log-dir: "/c/ProgramData/OpenTelemetry .NET AutoInstrumentation/logs"
- machine: ubuntu-20.04
log-dir: "/var/log/opentelemetry/dotnet"
- machine: macos-11
log-dir: "/var/log/opentelemetry/dotnet"
runs-on: ${{ matrix.machine }}
steps:
- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- run: brew install coreutils
if: ${{ runner.os == 'macOS' }}
- name: Create test directory
run: sudo mkdir -p ${{ matrix.log-dir }} && sudo chmod a+rwx ${{ matrix.log-dir }} # workaround before next release
if: ${{ runner.os != 'Windows' }}
- name: Test the Shell scripts from README.md
shell: bash
run: |
set -e
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/otel-dotnet-auto-install.sh -O
sh ./otel-dotnet-auto-install.sh
test "$(ls -A "$HOME/.otel-dotnet-auto")"
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/instrument.sh -O
. ./instrument.sh
dotnet help
test "$(ls -A '${{ matrix.log-dir }}' )"
shell-scripts-container:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release PR') }}
strategy:
fail-fast: false
matrix:
base-image: [ alpine ]
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Test the Shell scripts from README.md in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" .
docker run --rm mybuildimage /bin/sh -c '
set -e
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/otel-dotnet-auto-install.sh -O
sh ./otel-dotnet-auto-install.sh
test "$(ls -A "$HOME/.otel-dotnet-auto")"
curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/instrument.sh -O
. ./instrument.sh
dotnet help
test "$(ls -A /var/log/opentelemetry/dotnet )"
'
pack:
needs: build
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- uses: nuget/[email protected]
- name: Download Windows Artifacts from build job
uses: actions/[email protected]
with:
name: bin-windows-2022
path: nuget/bin-windows
- name: Download Ubuntu Artifacts from build job
uses: actions/[email protected]
with:
name: bin-ubuntu-20.04
path: nuget/bin-linux-glibc
- name: Download Mac-OS Artifacts from build job
uses: actions/[email protected]
with:
name: bin-macos-11
path: nuget/bin-macos
- name: Build NuGet package
run: nuget pack OpenTelemetry.AutoInstrumentation.nuspec -Properties NoWarn=NU5100,NU5123,NU5128
working-directory: nuget
- name: Upload Nuget
uses: actions/[email protected]
with:
name: OpenTelemetry.AutoInstrumentation.Nuget
path: nuget/*.nupkg