Skip to content

Commit

Permalink
Update build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RassK committed Feb 16, 2024
1 parent d7a5509 commit b4cb346
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,36 @@ 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
- 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
Expand All @@ -57,16 +68,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: |
Expand All @@ -76,6 +91,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
Expand All @@ -92,21 +108,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: |
Expand Down

0 comments on commit b4cb346

Please sign in to comment.