From 040c18636b8c0eccf7de58531411b2dd1494e741 Mon Sep 17 00:00:00 2001 From: RassK Date: Fri, 16 Feb 2024 13:34:44 +0200 Subject: [PATCH] Update build workflow --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b9e3c13f3..b33887d5ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,25 +23,38 @@ jobs: log-dir: "/var/log/opentelemetry/dotnet" runs-on: ${{ matrix.machine }} steps: - - uses: actions/checkout@v4.1.1 + - name: Checkout + uses: actions/checkout@v4.1.1 with: fetch-depth: 0 # fetching all, needed to correctly calculate version - - uses: actions/setup-dotnet@v4.0.0 + + - name: Setup Conditional ENVs + if: ${{ matrix.machine == 'actuated-arm64' }} + run: | + echo "DOTNET_INSTALL_DIR=~/.dotnet" >> $GITHUB_ENV + + - name: Setup .NET + uses: actions/setup-dotnet@v4.0.0 with: dotnet-version: | 6.0.419 7.0.406 8.0.200 + env: + DOTNET_INSTALL_DIR: "~/.dotnet" + - name: Check for NuGet packages cache uses: actions/cache@v4.0.0 id: nuget-cache with: key: ${{ hashFiles('**/Directory.packages.props', './build/LibraryVersions.g.cs', '**/packages.config' ) }} path: ${{ env.NUGET_PACKAGES }} + - if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }} name: Restore NuGet packages continue-on-error: false run: ./build.cmd Restore + - if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }} name: Cache NuGet packages uses: actions/cache/save@v4.0.0 @@ -57,16 +70,20 @@ jobs: with: name: bin-centos-native path: bin/ci-artifacts/bin-centos-native + - name: Replace Ubuntu native code by Centos artifacts 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 if: ${{ matrix.machine == 'ubuntu-20.04' }} + - 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: | @@ -76,6 +93,7 @@ jobs: . ./instrument.sh ./test/test-applications/integrations/bin/TestApplication.Smoke/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 @@ -92,21 +110,25 @@ jobs: ./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 uses: actions/upload-artifact@v4.3.1 if: always() with: name: bin-${{ matrix.machine }} path: bin/tracer-home + - name: Upload installation scripts uses: actions/upload-artifact@v4.3.1 if: always() 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: |