Fix NU1604 (#545) #1706
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: ci | |
on: | |
push: | |
branches: [ main ] | |
tags: [ v* ] | |
pull_request: | |
workflow_dispatch: | |
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-12 | |
log-dir: "/var/log/opentelemetry/dotnet" | |
runs-on: ${{ matrix.machine }} | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # fetching all, needed to correctly calculate version | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.423 | |
7.0.410 | |
8.0.302 | |
- run: ./build.cmd Workflow | |
- 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 | |
dotnet publish -f net8.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke | |
export OTEL_DOTNET_AUTO_HOME="${PWD}/OpenTelemetryDistribution" | |
. ./instrument.sh | |
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net8.0/publish/TestApplication.Smoke | |
test "$(ls -A '${{ matrix.log-dir }}' )" | |
- name: Test the 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/InstallationScripts/Splunk.OTel.DotNet.psm1" | |
[System.Environment]::SetEnvironmentVariable("SPLUNK_OTEL_DOTNET_AUTO_INSTALL_DIR", "${PWD}\OpenTelemetryDistribution", [System.EnvironmentVariableTarget]::Machine) | |
Register-OpenTelemetryForCurrentSession -OTelServiceName "MyServiceDisplayName" | |
./test/test-applications/integrations/TestApplication.Smoke/bin/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/TestApplication.Smoke/bin/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." } | |
- uses: actions/[email protected] | |
with: | |
name: bin-${{ matrix.machine }} | |
path: | | |
bin/splunk-*.zip | |
bin/InstallationScripts/splunk-otel-dotnet-install.sh | |
bin/InstallationScripts/Splunk.OTel.DotNet.psm1 | |
bin/Matrix/splunk-otel-dotnet-metadata.yaml | |
container-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- machine: ubuntu-20.04 | |
base-image: alpine-x64 | |
os-type: linux-musl | |
# architecture: "x64" | |
- machine: [self-hosted, Linux, ARM64] | |
base-image: alpine-arm64 | |
os-type: linux-musl | |
# architecture: "arm64" | |
- machine: [self-hosted, Linux, ARM64] | |
base-image: debian-arm64 | |
os-type: linux-glibc | |
# architecture: "arm64" | |
runs-on: ${{ matrix.machine }} | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # fetching all, needed to correctly calculate version | |
- name: Build Docker image | |
run: | | |
docker build \ | |
--tag splunk-otel-dotnet/${{ matrix.base-image }} \ | |
--file "./docker/${{ matrix.base-image }}.dockerfile" \ | |
./build | |
- name: Build in Docker container | |
run: | | |
docker run --rm \ | |
-e OS_TYPE=${{ matrix.os-type }} --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project \ | |
splunk-otel-dotnet/${{ matrix.base-image }} \ | |
/bin/sh -c 'git config --global --add safe.directory /project && ./build.sh Workflow' | |
- 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 -e OTEL_DOTNET_AUTO_LOG_DIRECTORY=/home/user/opentelemetry/log/dotnet --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c ' | |
set -e | |
dotnet publish -f net8.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke | |
export OTEL_DOTNET_AUTO_HOME="${PWD}/OpenTelemetryDistribution" | |
. ./instrument.sh | |
./test/test-applications/integrations/TestApplication.Smoke/bin/Release/net8.0/publish/TestApplication.Smoke | |
test "$(ls -A /home/user/opentelemetry/log )" | |
' | |
- uses: actions/[email protected] | |
if: (${{ job.status }} != 'cancelled') | |
with: | |
name: bin-${{ matrix.base-image }} | |
path: bin/splunk-*.zip | |
build-nuget-package: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # fetching all, needed to correctly calculate version | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.423 | |
7.0.410 | |
8.0.302 | |
- run: ./build.cmd NuGetWorkflow | |
- uses: actions/[email protected] | |
with: | |
name: nuget-package | |
path: NuGetPackage/ | |
test-nuget-package: | |
needs: build-nuget-package | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- machine: ubuntu-20.04 | |
- machine: macos-12 | |
runs-on: ${{ matrix.machine }} | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # fetching all, needed to correctly calculate version | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.423 | |
7.0.410 | |
8.0.302 | |
- name: Download NuGet Artifacts from build-nuget-package job | |
uses: actions/[email protected] | |
with: | |
name: nuget-package | |
path: NuGetPackage/ | |
- name: Test NuGet Package | |
run: ./build.cmd TestNuGetPackage | |
create-release: | |
if: github.ref_type == 'tag' | |
name: Create GitHub release | |
runs-on: ubuntu-20.04 | |
needs: [ build, container-build, build-nuget-package, test-nuget-package ] | |
permissions: | |
contents: write | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
path: . | |
- run: cp bin-alpine-x64/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-musl-x64.zip | |
- run: cp bin-alpine-arm64/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-musl-arm64.zip | |
- run: cp bin-ubuntu-20.04/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-glibc-x64.zip | |
- run: cp bin-debian-arm64/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-glibc-arm64.zip | |
- run: cp bin-windows-2022/splunk-*.zip ./splunk-opentelemetry-dotnet-windows.zip | |
- run: cp bin-macos-12/splunk-*.zip ./splunk-opentelemetry-dotnet-macos.zip | |
- run: cp bin-windows-2022/InstallationScripts/splunk-otel-dotnet-install.sh ./splunk-otel-dotnet-install.sh | |
- run: cp bin-windows-2022/InstallationScripts/Splunk.OTel.DotNet.psm1 ./Splunk.OTel.DotNet.psm1 | |
- run: cp bin-windows-2022/Matrix/splunk-otel-dotnet-metadata.yaml ./splunk-otel-dotnet-metadata.yaml | |
- name: Calculate checksum | |
run: sha256sum ./*.zip ./nuget-package/*.nupkg ./splunk-otel-dotnet-install.sh ./Splunk.OTel.DotNet.psm1 >> checksum.txt | |
- name: Create Release | |
run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --verify-tag --draft ./*.zip ./nuget-package/*.nupkg ./splunk-otel-dotnet-install.sh ./Splunk.OTel.DotNet.psm1 checksum.txt ./splunk-otel-dotnet-metadata.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |