Skip to content

ci: setup building nuget packages in CI #40

ci: setup building nuget packages in CI

ci: setup building nuget packages in CI #40

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
name: .NET
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]
target: [
x86_64-pc-windows-msvc,
i686-pc-windows-msvc,
x86_64-apple-darwin,
aarch64-apple-darwin
]
exclude:
- os: windows-latest
target: x86_64-apple-darwin
- os: windows-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: i686-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install rustup
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=none
del rustup-init.exe
rustup target add ${{ matrix.target }}
shell: powershell
- name: Install rustup
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 }}
shell: bash
- name: Build on Windows
if: matrix.os == 'windows-latest'
run: .\windows\build\build.ps1 -output_dir .\bin -targets ${{ matrix.target }}
shell: pwsh
- name: Build on macOS
if: matrix.os == 'macos-latest'
run: |
chmod +x ./windows/build/build.sh
./windows/build/build.sh -o ./bin -t ${{ matrix.target }}
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-bin-${{ matrix.target }}
path: |
bin/${{ matrix.target }}/*
pack:
runs-on: windows-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: windows-latest-bin-x86_64-pc-windows-msvc
path: bin
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: windows-latest-bin-i686-pc-windows-msvc
path: bin
- name: Download Mac artifacts
uses: actions/download-artifact@v4
with:
name: macos-latest-bin-x86_64-apple-darwin
path: bin
- name: Download Mac artifacts
uses: actions/download-artifact@v4
with:
name: macos-latest-bin-aarch64-apple-darwin
path: bin
- name: Pack
run: |
dotnet pack .\windows\libdatadog.csproj -p:LibDatadogBinariesOutputDir=..\bin -p:LibDatadogVersion="42.0.0" -o .nuget\packages\
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: .nuget/packages/*
if-no-files-found: error