v0.23.47 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-publish | |
on: | |
release: | |
types: [published] | |
jobs: | |
powershell-script: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/setup-dotnet@v3.2.0 | |
with: | |
dotnet-version: | | |
6.0.414 | |
7.0.401 | |
- name: Test the PowerShell module instructions from README.md | |
shell: powershell | |
run: | | |
mkdir testapp | |
cd testapp | |
dotnet new console | |
dotnet publish -f net7.0 -c Release | |
$module_url = "https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/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" | |
./bin/Release/net7.0/publish/testapp | |
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 | |
./bin/Release/net7.0/publish/testapp | |
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: | |
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/setup-dotnet@v3.2.0 | |
with: | |
dotnet-version: | | |
6.0.414 | |
7.0.401 | |
- 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 }} # the instrumented process has no permissions to create log dir | |
if: ${{ runner.os != 'Windows' }} | |
- name: Test the Shell scripts from README.md | |
shell: bash | |
run: | | |
set -e | |
mkdir testapp | |
cd testapp | |
dotnet new console | |
dotnet publish -f net7.0 -c Release | |
curl -sSfL https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/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 | |
./bin/Release/net7.0/publish/testapp | |
test "$(ls -A '${{ matrix.log-dir }}' )" | |
shell-scripts-container: | |
strategy: | |
fail-fast: false | |
matrix: | |
base-image: [ alpine, centos ] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4.1.0 | |
- 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 | |
docker run --rm mybuildimage /bin/sh -c ' | |
set -e | |
mkdir testapp | |
cd testapp | |
dotnet new console | |
dotnet publish -f net7.0 -c Release | |
curl -sSfL https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/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 | |
./bin/Release/net7.0/publish/testapp | |
test "$(ls -A /var/log/opentelemetry/dotnet )" | |
' |