Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APMSP-1542 feat: setup dotnet CI and add support for win-x64, win-x86, linux-x64, linux-arm64 & osx-arm64 #771

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4dc22ed
feat: setup dotnet CI
ganeshnj Nov 28, 2024
3cea755
feat: add support for linux-x64 and osx-arm64 platforms in nuget package
ganeshnj Dec 2, 2024
875a031
refactor
ganeshnj Dec 19, 2024
8abe17c
use arm runner
ganeshnj Dec 19, 2024
cf16b4b
fix libc nodejs issue
ganeshnj Dec 19, 2024
468235c
try at job level
ganeshnj Dec 19, 2024
7c8ecdf
use v4
ganeshnj Dec 19, 2024
58a5f7c
bump all actions
ganeshnj Dec 19, 2024
6c2fd51
try node16 env var
ganeshnj Dec 19, 2024
5bf2f91
pin commit for upload
ganeshnj Dec 19, 2024
0c05e06
missed build setp
ganeshnj Dec 19, 2024
fa33233
try to make nodejs < 20
ganeshnj Dec 19, 2024
6d264f5
use docker run
ganeshnj Dec 19, 2024
989ee38
description updates
ganeshnj Dec 19, 2024
efa4f94
cd
ganeshnj Dec 19, 2024
e5c5584
update current session with gcc 9
ganeshnj Dec 19, 2024
134f684
try same approach for musl
ganeshnj Dec 19, 2024
71fe5dc
fix os
ganeshnj Dec 19, 2024
ec662ad
not yet
ganeshnj Dec 19, 2024
77e593e
test on different platforms
ganeshnj Dec 19, 2024
2f03203
don't build musl
ganeshnj Dec 19, 2024
c779ba7
use lowest possible framework
ganeshnj Dec 19, 2024
217b2b4
update CI with 3.1
ganeshnj Dec 19, 2024
05d5450
copy pasta
ganeshnj Dec 19, 2024
faa037c
clean dotnet installation
ganeshnj Dec 19, 2024
c4019bb
since 6 we have osx arm support
ganeshnj Dec 19, 2024
51522cc
install .NET 6
ganeshnj Dec 19, 2024
0fdcbb9
disable ICU
ganeshnj Dec 19, 2024
8707d97
keep x86 for now
ganeshnj Dec 19, 2024
691d93f
Merge branch 'main' into ganeshnj/feat/linux-osx-nuget
ajgajg1134 Jan 8, 2025
4cdce24
Merge branch 'main' into ganeshnj/feat/linux-osx-nuget
ajgajg1134 Jan 14, 2025
2fcee63
use valid os tag for lint job
ajgajg1134 Jan 14, 2025
07adb6b
add copyright line for script
ajgajg1134 Jan 14, 2025
b144f44
try specifying arch explicitly
ajgajg1134 Jan 14, 2025
bd1d936
undo arch specs
ajgajg1134 Jan 14, 2025
81c29b4
try setting default toolchain
ajgajg1134 Jan 14, 2025
1e22aaf
temporarily comment out broken target
ajgajg1134 Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.github
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
315 changes: 315 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
name: .NET
on:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

No explicit permissions set for at the workflow level (...read more)

Datadog’s GitHub organization defines default permissions for the GITHUB_TOKEN to be restricted (contents:read, metadata:read, and packages:read).

Your repository may require a different setup, so consider defining permissions for each job following the least privilege principle to restrict the impact of a possible compromise.

You can find the list of all possible permissions in Workflow syntax for GitHub Actions - GitHub Docs. They can be defined at the job or the workflow level.

View in Datadog  Leave us feedback  Documentation

push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

env:
OUTPUT_DIR: bin
PACKAGES_DIR: packages
NUGET_NAME: ganeshnj.libdatadog

jobs:
build:
runs-on: ${{ matrix.os }}

# container: ${{ matrix.container }}

env:
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
container: centos:7
- os: arm-4core-linux-ubuntu24.04

Check failure on line 38 in .github/workflows/dotnet.yml

View workflow job for this annotation

GitHub Actions / actionlint

label "arm-4core-linux-ubuntu24.04" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-14.0", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-13.0", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "macos-12.0", "macos-11", "macos-11.0", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
target: aarch64-unknown-linux-gnu
container: centos:7
# - os: ubuntu-latest
# target: x86_64-unknown-linux-musl
# container: alpine:3.19
# - os: arm-4core-linux-ubuntu24.04
# target: aarch64-unknown-linux-musl
# container: alpine:3.19
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved

- name: centos:7
uses: addnab/docker-run-action@v3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation

if: matrix.container == 'centos:7'
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/workspace
run: |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

yum install epel-release -y

yum clean all -y && yum makecache -y && yum update -y

yum install -y centos-release-scl \
&& sed -i s/mirror.centos.org/buildlogs.centos.org/g /etc/yum.repos.d/CentOS-SCLo-*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-SCLo-*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-SCLo-*.repo \
&& yum install -y --setopt=tsflags=nodocs --nogpgcheck \
curl \
devtoolset-9 \
git \
make \
pkg-config \
unzip \
strace \
zlib-devel \
jq \
&& yum clean all --enablerepo='*' \

# switch to GCC9 environment for the duration of the script
source scl_source enable devtoolset-9

gcc --version
ldd --version

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup target add ${{ matrix.target }}
cargo install --force cbindgen

cd /workspace
./windows/build-artifacts.sh ${{ env.OUTPUT_DIR }} ${{ matrix.target }}

- name: alpine:3.19
uses: addnab/docker-run-action@v3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation

if: matrix.container == 'alpine:3.19'
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/workspace
run: |
apk update \
&& apk add --no-cache \
build-base \
cargo \
cmake \
curl \
git \
make \
patchelf \
protoc \
pkgconf \
unzip \
bash \
jq \
clang16-libclang \
&& mkdir /usr/local/src \

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup target add ${{ matrix.target }}
cargo install --force cbindgen

gcc --version
ldd --version

cd /workspace
./windows/build-artifacts.sh ${{ env.OUTPUT_DIR }} ${{ matrix.target }}

- name: Windows
if: matrix.os == 'windows-latest'
run: |
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
.\rustup-init.exe -y --default-host=${{ matrix.target }} --default-toolchain stable --profile minimal
del rustup-init.exe
rustup target add ${{ matrix.target }}
./windows/build-artifacts.ps1 ${{ env.OUTPUT_DIR }} ${{ matrix.target }}
shell: powershell

- name: macOS
if: matrix.os == 'macos-latest'
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup target add ${{ matrix.target }}
cargo install --force cbindgen
./windows/build-artifacts.sh ${{ env.OUTPUT_DIR }} ${{ matrix.target }}
shell: bash

- name: Upload artifacts
uses: actions/upload-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.OUTPUT_DIR }}-${{ matrix.target }}
path: |
bin/*
!bin/*/*/build
!bin/*/*/deps
!bin/*/*/examples
!bin/*/*/incremental
!bin/*/*/.fingerprint
!bin/debug
!bin/release

pack:
runs-on: windows-latest
needs: build
outputs:
NUGET_VERSION: ${{ steps.dotnet-pack.outputs.NUGET_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved

- name: Download x86_64-pc-windows-msvc
uses: actions/download-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.OUTPUT_DIR }}-x86_64-pc-windows-msvc
path: bin

- name: Download i686-pc-windows-msvc
uses: actions/download-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.OUTPUT_DIR }}-i686-pc-windows-msvc
path: bin

- name: Download x86_64-unknown-linux-gnu
uses: actions/download-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.OUTPUT_DIR }}-x86_64-unknown-linux-gnu
path: bin

- name: Download aarch64-unknown-linux-gnu
uses: actions/download-artifact@v4
with:
name: ${{ env.OUTPUT_DIR }}-aarch64-unknown-linux-gnu
path: bin

# - name: Download x86_64-unknown-linux-musl
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.OUTPUT_DIR }}-x86_64-unknown-linux-musl
# path: bin

# - name: Download aarch64-unknown-linux-musl
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.OUTPUT_DIR }}-aarch64-unknown-linux-musl
# path: bin

- name: Download aarch64-apple-darwin
uses: actions/download-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.OUTPUT_DIR }}-aarch64-apple-darwin
path: bin

- name: Download x86_64-apple-darwin
uses: actions/download-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.OUTPUT_DIR }}-x86_64-apple-darwin
path: bin

- name: dotnet pack
id: dotnet-pack
run: |
$cargo_content=Get-Content Cargo.toml -Raw
$cargo_content -match '(?m)^version += +"([^"]+)"'
$current_version=$Matches[1]
$version_suffix="ci.${{ github.event.number }}.${{ github.run_number }}"
$version="$current_version-$version_suffix"
echo "NUGET_VERSION=$version" >> $env:GITHUB_OUTPUT
dotnet pack windows/libdatadog.csproj -p:LibDatadogBinariesOutputDir=../${{ env.OUTPUT_DIR }} -p:LibDatadogVersion=$version -p:PackageID=${{ env.NUGET_NAME }} -o ${{ env.PACKAGES_DIR }}

- name: Upload package
uses: actions/upload-artifact@v4 # v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation

with:
name: ${{ env.PACKAGES_DIR }}
path: ${{ env.PACKAGES_DIR }}

test:
runs-on: ${{ matrix.os }}
needs: pack

strategy:
matrix:
include:
- os: windows-latest
- os: ubuntu-latest
container: centos:7
- os: arm-4core-linux-ubuntu24.04

Check failure on line 253 in .github/workflows/dotnet.yml

View workflow job for this annotation

GitHub Actions / actionlint

label "arm-4core-linux-ubuntu24.04" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-14.0", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-13.0", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "macos-12.0", "macos-11", "macos-11.0", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file
container: centos:7
- os: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved

- name: Download package
uses: actions/download-artifact@v4
ganeshnj marked this conversation as resolved.
Show resolved Hide resolved
with:
name: ${{ env.PACKAGES_DIR }}
path: ${{ env.PACKAGES_DIR }}

- name: ${{ matrix.container }} Test
uses: addnab/docker-run-action@v3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation

if: matrix.container == 'centos:7' || matrix.container == 'alpine:3.19'
with:
image: ${{ matrix.container }}
options: -v ${{ github.workspace }}:/workspace
run: |
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 3.1 --install-dir /usr/share/dotnet
source /usr/share/dotnet/dotnet.complete.sh
cd /workspace/tests/nuget_package
/usr/share/dotnet/dotnet add nuget_package.csproj package ${{ env.NUGET_NAME }} --version ${{ needs.pack.outputs.NUGET_VERSION }}
/usr/share/dotnet/dotnet run

- name: Install .NET SDK
if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest'
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 #v4
with:
dotnet-version: 3.1.X

- name: Test
if: matrix.os == 'windows-latest' || matrix.os == 'macos-latest'
run: |
cd tests/nuget_package
dotnet add nuget_package.csproj package ${{ env.NUGET_NAME }} --version ${{ needs.pack.outputs.NUGET_VERSION }}

dotnet run

nuget-push:
runs-on: windows-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation


- name: Download package
uses: actions/download-artifact@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Vulnerability

Workflow depends on a GitHub actions pinned by tag (...read more)

When using a third party action, one needs to provide its GitHub path (owner/project) and can eventually pin it to a Git ref (a branch name, a Git tag, or a commit hash).

No pinned Git ref means the action uses the latest commit of the default branch each time it runs, eventually running newer versions of the code that were not audited by Datadog. Specifying a Git tag is better, but since they are not immutable, using a full length hash is recommended to make sure the action content is actually frozen to some reviewed state.

Be careful however, as even pinning an action by hash can be circumvented by attackers still. For instance, if an action relies on a Docker image which is itself not pinned to a digest, it becomes possible to alter its behaviour through the Docker image without actually changing its hash. You can learn more about this kind of attacks in Unpinnable Actions: How Malicious Code Can Sneak into Your GitHub Actions Workflows. Pinning actions by hash is still a good first line of defense against supply chain attacks.

Additionally, pinning by hash or tag means the action won’t benefit from newer version updates if any, including eventual security patches. Make sure to regularly check if newer versions for an action you use are available. For actions coming from a very trustworthy source, it can make sense to use a laxer pinning policy to benefit from updates as soon as possible.

View in Datadog  Leave us feedback  Documentation

with:
name: ${{ env.PACKAGES_DIR }}
path: ${{ env.PACKAGES_DIR }}

- name: Install .NET SDK
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 #v4
with:
dotnet-version: 6.0.X

- name: NuGet push
run: |
cd ${{ env.PACKAGES_DIR }}
dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
18 changes: 14 additions & 4 deletions build-profiling-ffi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ set -eu

ARG_FEATURES=""
run_tests=true
target=""

usage() {
echo "Usage: `basename "$0"` [-h] [-f FEATURES] [-T] dest-dir"
echo "Usage: `basename "$0"` [-h] [-f FEATURES] [-T] [-t TARGET] dest-dir"
echo
echo "Options:"
echo " -h This help text"
echo " -f FEATURES Enable specified features (comma separated if more than one)"
echo " -T Skip checks after building"
echo " -t TARGET Specify the target platform"
exit $1
}

while getopts f:hT flag
while getopts f:hTt: flag
do
case "${flag}" in
f)
Expand All @@ -43,6 +45,11 @@ do
run_tests=false
shift
;;
t)
target=${OPTARG}
shift
shift
;;
esac
done

Expand All @@ -59,7 +66,10 @@ fi
mkdir -v -p "$destdir/include/datadog" "$destdir/lib/pkgconfig" "$destdir/cmake"

version=$(awk -F\" '$1 ~ /^version/ { print $2 }' < profiling-ffi/Cargo.toml)
target="$(rustc -vV | awk '/^host:/ { print $2 }')"
if [ -z "${target:-}" ]; then
target="$(rustc -vV | awk '/^host:/ { print $2 }')"
fi
echo "Building for target: $target"
shared_library_suffix=".so"
static_library_suffix=".a"
library_prefix="lib"
Expand All @@ -77,7 +87,7 @@ symbolizer=0
# provided. At least on Alpine, libgcc_s may not even exist in the users'
# images, so -static-libgcc is recommended there.
case "$target" in
"x86_64-alpine-linux-musl"|"aarch64-alpine-linux-musl")
"x86_64-alpine-linux-musl"|"aarch64-alpine-linux-musl"|"x86_64-unknown-linux-musl"|"aarch64-unknown-linux-musl")
expected_native_static_libs=" -lssp_nonshared -lgcc_s -lc"
native_static_libs=" -lssp_nonshared -lc"
# on alpine musl, Rust adds some weird runpath to cdylibs
Expand Down
9 changes: 9 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="local" value="packages" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Loading
Loading