Skip to content

Bump NSubstitute from 5.0.0 to 5.1.0 (#322) #1081

Bump NSubstitute from 5.0.0 to 5.1.0 (#322)

Bump NSubstitute from 5.0.0 to 5.1.0 (#322) #1081

Workflow file for this run

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-11
log-dir: "/var/log/opentelemetry/dotnet"
runs-on: ${{ matrix.machine }}
steps:
- uses: actions/checkout@v4.0.0
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: |
6.0.413
7.0.400
- 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 net7.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/net7.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}/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/x64/Release/net7.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/x64/Release/net7.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/upload-artifact@v3.1.3
with:
name: bin-${{ matrix.machine }}
path: bin/splunk-*.zip
container-build:
strategy:
fail-fast: false
matrix:
base-image: [ alpine ]
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4.0.0
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=linux-musl --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 --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c '
set -e
dotnet publish -f net7.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/net7.0/publish/TestApplication.Smoke
test "$(ls -A /var/log/opentelemetry/dotnet )"
'
- uses: actions/upload-artifact@v3.1.3
with:
name: bin-${{ matrix.base-image }}
path: bin/splunk-*.zip
build-nuget-package:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4.0.0
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: |
6.0.413
7.0.400
- run: ./build.cmd NuGetWorkflow
- uses: actions/upload-artifact@v3.1.3
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-11
runs-on: ${{ matrix.machine }}
steps:
- uses: actions/checkout@v4.0.0
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: |
6.0.413
7.0.400
- name: Download NuGet Artifacts from build-nuget-package job
uses: actions/download-artifact@v3.0.2
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/checkout@v4.0.0
- uses: actions/download-artifact@v3.0.2
with:
path: .
- run: cp bin-alpine/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-musl.zip
- run: cp bin-ubuntu-20.04/splunk-*.zip ./splunk-opentelemetry-dotnet-linux-glibc.zip
- run: cp bin-windows-2022/splunk-*.zip ./splunk-opentelemetry-dotnet-windows.zip
- run: cp bin-macos-11/splunk-*.zip ./splunk-opentelemetry-dotnet-macos.zip
- 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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}