Skip to content

Commit

Permalink
Add ARM64 Support (#3277)
Browse files Browse the repository at this point in the history
  • Loading branch information
RassK authored Mar 6, 2024
1 parent 5df6267 commit 98c60f4
Show file tree
Hide file tree
Showing 37 changed files with 858 additions and 104 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-centos-native-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/[email protected]

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version

- name: Build native library in Docker container
run: |
set -e
Expand All @@ -25,9 +28,9 @@ jobs:
/bin/sh -c 'git config --global --add safe.directory /project && ./build.sh BuildNativeWorkflow'
- name: Publish native library Linux build
if: (${{ job.status }} != 'cancelled')
uses: actions/[email protected]
with:
name: bin-centos-native
path: bin/tracer-home
if: (${{ job.status }} != 'cancelled')
continue-on-error: true
21 changes: 16 additions & 5 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,30 @@ jobs:
fail-fast: false
matrix:
include:
- base-image: alpine
- machine: ubuntu-20.04
base-image: alpine
os-type: linux-musl
runs-on: ubuntu-20.04
architecture: x64
- machine: actuated-arm64-4cpu-8gb
base-image: alpine
os-type: linux-musl
architecture: arm64
runs-on: ${{ matrix.machine }}
timeout-minutes: 60
steps:
- uses: actions/[email protected]

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version

- name: Build in Docker container
run: |
set -e
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" ./docker
docker run -e OS_TYPE=${{ matrix.os-type }} --rm --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project mybuildimage \
/bin/sh -c 'git config --global --add safe.directory /project && ./build.sh BuildWorkflow'
- name: Test the Shell scripts from README.md in Docker container
run: |
set -e
Expand All @@ -39,10 +49,11 @@ jobs:
./test/test-applications/integrations/bin/TestApplication.Smoke/Release/net8.0/publish/TestApplication.Smoke
test "$(ls -A /var/log/opentelemetry/dotnet )"
'
- name: Publish Linux build
if: (${{ job.status }} != 'cancelled')
uses: actions/[email protected]
with:
name: bin-${{ matrix.base-image }}
name: bin-${{ matrix.base-image }}-${{ matrix.architecture }}
path: bin/tracer-home
if: (${{ job.status }} != 'cancelled')
continue-on-error: true
20 changes: 16 additions & 4 deletions .github/workflows/build-nuget-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,29 @@ jobs:
name: bin-windows-2022
path: bin/ci-artifacts/bin-windows-2022

- name: Download Ubuntu Artifacts from build job
- name: Download Ubuntu x64 Artifacts from build job
uses: actions/[email protected]
with:
name: bin-ubuntu-20.04
path: bin/ci-artifacts/bin-ubuntu-20.04

- name: Download Alpine Artifacts from build job
- name: Download Ubuntu arm64 Artifacts from build job
uses: actions/[email protected]
with:
name: bin-alpine
path: bin/ci-artifacts/bin-alpine
name: bin-actuated-arm64-4cpu-8gb
path: bin/ci-artifacts/bin-actuated-arm64-4cpu-8gb

- name: Download Alpine x64 Artifacts from build job
uses: actions/[email protected]
with:
name: bin-alpine-x64
path: bin/ci-artifacts/bin-alpine-x64

- name: Download Alpine arm64 Artifacts from build job
uses: actions/[email protected]
with:
name: bin-alpine-arm64
path: bin/ci-artifacts/bin-alpine-arm64

- name: Download Mac-OS Artifacts from build job
uses: actions/[email protected]
Expand Down
64 changes: 51 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,52 +19,85 @@ jobs:
log-dir: "/var/log/opentelemetry/dotnet"
- machine: macos-11
log-dir: "/var/log/opentelemetry/dotnet"
- machine: actuated-arm64-4cpu-8gb
log-dir: "/var/log/opentelemetry/dotnet"
runs-on: ${{ matrix.machine }}
steps:
- uses: actions/[email protected]

- name: ARM64 Runner Info
if: ${{ matrix.machine == 'actuated-arm64-4cpu-8gb' }}
run: cat /etc/os-release

- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # fetching all, needed to correctly calculate version
- uses: actions/[email protected]

- name: Setup ARM64 Environment Variables
if: ${{ matrix.machine == 'actuated-arm64-4cpu-8gb' }}
run: |
echo "DOTNET_INSTALL_DIR=~/.dotnet" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
6.0.419
7.0.406
8.0.201
- name: Check for NuGet packages cache
uses: actions/[email protected]
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

- name: Restore NuGet packages
if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
continue-on-error: false
run: ./build.cmd Restore
- if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
name: Cache NuGet packages

- name: Cache NuGet packages
if: ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/[email protected]
with:
key: ${{ hashFiles('**/Directory.packages.props', './build/LibraryVersions.g.cs', '**/packages.config' ) }}
path: ${{ env.NUGET_PACKAGES }}

- run: ./build.cmd BuildWorkflow --no-restore ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}
- name: Setup ARM64 Machine
if: ${{ matrix.machine == 'actuated-arm64-4cpu-8gb' }}
run: |
sudo apt-get update && \
sudo apt-get install -y \
cmake \
clang \
make
- name: Run BuildWorkflow
run: ./build.cmd BuildWorkflow --no-restore ${{ steps.nuget-cache.outputs.cache-hit != 'true' }}

- name: Download native CentOS Artifacts from build job
if: ${{ matrix.machine == 'ubuntu-20.04' }}
uses: actions/[email protected]
with:
name: bin-centos-native
path: bin/ci-artifacts/bin-centos-native

- name: Replace Ubuntu native code by Centos artifacts
if: ${{ matrix.machine == 'ubuntu-20.04' }}
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
- name: Install MacOS CoreUtils
if: ${{ runner.os == 'macOS' }}
run: brew install coreutils

- 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' }}
run: sudo mkdir -p ${{ matrix.log-dir }} && sudo chmod a+rwx ${{ matrix.log-dir }} # the instrumented process has no permissions to create log dir

- name: Test the Shell scripts from README.md
shell: bash
run: |
Expand All @@ -74,7 +107,8 @@ 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
- name: Test the Windows PowerShell module instructions from README.md
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
Expand All @@ -90,21 +124,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/[email protected]
if: always()
uses: actions/[email protected]
with:
name: bin-${{ matrix.machine }}
path: bin/tracer-home

- name: Upload installation scripts
uses: actions/[email protected]
if: always()
uses: actions/[email protected]
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
Loading

0 comments on commit 98c60f4

Please sign in to comment.