-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (129 loc) · 5.83 KB
/
build.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
name: Build on Runners
on:
workflow_call:
env:
NUGET_PACKAGES: ${{ github.workspace }}/packages
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
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"
- machine: actuated-arm64-4cpu-8gb
log-dir: "/var/log/opentelemetry/dotnet"
runs-on: ${{ matrix.machine }}
steps:
- name: ARM64 Runner Info
if: ${{ matrix.machine == 'actuated-arm64-4cpu-8gb' }}
run: cat /etc/os-release
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- name: Setup ARM64 Environment Variables
if: ${{ matrix.machine == 'actuated-arm64-4cpu-8gb' }}
run: |
echo "DOTNET_INSTALL_DIR=~/.dotnet" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
6.0.421
7.0.408
8.0.204
- name: Check for NuGet packages cache
uses: actions/[email protected]
id: nuget-cache
with:
key: ${{ hashFiles('**/Directory.packages.props', './build/LibraryVersions.g.cs', '**/packages.config' ) }}
path: ${{ env.NUGET_PACKAGES }}
- name: Restore NuGet packages
if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
continue-on-error: false
run: ./build.cmd Restore
- name: Cache NuGet packages
if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/[email protected]
with:
key: ${{ hashFiles('**/Directory.packages.props', './build/LibraryVersions.g.cs', '**/packages.config' ) }}
path: ${{ env.NUGET_PACKAGES }}
- name: Setup ARM64 Machine
if: ${{ matrix.machine == 'actuated-arm64-4cpu-8gb' }}
run: |
sudo apt-get update && \
sudo apt-get install -y \
cmake \
clang \
make
- name: Run BuildWorkflow
run: ./build.cmd BuildWorkflow --no-restore ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
- name: Download native CentOS Artifacts from build job
if: ${{ matrix.machine == 'ubuntu-20.04' }}
uses: actions/[email protected]
with:
name: bin-centos-native
path: bin/ci-artifacts/bin-centos-native
- name: Replace Ubuntu native code by Centos artifacts
if: ${{ matrix.machine == 'ubuntu-20.04' }}
run: |
rm ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
cp ./bin/ci-artifacts/bin-centos-native/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so ./bin/tracer-home/linux-x64/OpenTelemetry.AutoInstrumentation.Native.so
- name: Install MacOS CoreUtils
if: ${{ runner.os == 'macOS' }}
run: brew install coreutils
- name: Create test directory
if: ${{ runner.os != 'Windows' }}
run: sudo mkdir -p ${{ matrix.log-dir }} && sudo chmod a+rwx ${{ matrix.log-dir }} # the instrumented process has no permissions to create log dir
- name: Test the Shell scripts from README.md
shell: bash
run: |
set -e
dotnet publish -f net8.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke
export OTEL_DOTNET_AUTO_HOME="${PWD}/bin/tracer-home"
. ./instrument.sh
./test/test-applications/integrations/bin/TestApplication.Smoke/Release/net8.0/publish/TestApplication.Smoke
test "$(ls -A '${{ matrix.log-dir }}' )"
- name: Test the Windows PowerShell module instructions from README.md
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
$log_path = "C:\ProgramData\OpenTelemetry .NET AutoInstrumentation\logs\*"
Import-Module "${PWD}/bin/installation-scripts/OpenTelemetry.DotNet.Auto.psm1"
[System.Environment]::SetEnvironmentVariable("OTEL_DOTNET_AUTO_INSTALL_DIR", "${PWD}/bin/tracer-home", [System.EnvironmentVariableTarget]::Machine)
Register-OpenTelemetryForCurrentSession -OTelServiceName "MyServiceDisplayName"
./test/test-applications/integrations/bin/TestApplication.Smoke/Release/net8.0/TestApplication.Smoke.exe
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
./test/test-applications/integrations/bin/TestApplication.Smoke/Release/net8.0/TestApplication.Smoke.exe
if (-not $?) { throw "dotnet help returned exit code: $LASTEXITCODE" }
if (Test-Path $log_path) { throw "Log file exists. Instrumentation unregister failed." }
- name: Upload binaries
if: always()
uses: actions/[email protected]
with:
name: bin-${{ matrix.machine }}
path: bin/tracer-home
- name: Upload installation scripts
if: always()
uses: actions/[email protected]
with:
name: installation-scripts-${{ matrix.machine }}
path: bin/installation-scripts
- name: Regenerate LibraryVersions.g.cs
# Regenerate the library versions file to surface any version changes made to the packages being tested.
run: ./build.cmd GenerateLibraryVersionFiles
- name: Generated files unchanged
shell: bash
run: |
git status
git diff
[[ -z "$(git status --porcelain)" ]]