8
8
9
9
name : .NET
10
10
11
+ env :
12
+ OUTPUT_DIR : bin
13
+ PACKAGES_DIR : packages
14
+
11
15
jobs :
12
16
build :
13
17
runs-on : ${{ matrix.os }}
14
18
15
19
strategy :
16
20
matrix :
17
- os : [windows-latest, macos-latest, ubuntu-latest]
18
21
include :
19
22
- os : windows-latest
20
- target : [x86_64-pc-windows-msvc, i686-pc-windows-msvc]
23
+ target : x86_64-pc-windows-msvc
24
+ - os : windows-latest
25
+ target : i686-pc-windows-msvc
21
26
- os : macos-latest
22
- target : [x86_64-apple-darwin, arch64-apple-darwin]
27
+ target : x86_64-apple-darwin
28
+ - os : macos-latest
29
+ target : aarch64-apple-darwin
23
30
- os : ubuntu-latest
24
- target : [x86_64-alpine-linux-musl, aarch64-alpine-linux-musl, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
31
+ target : x86_64-unknown-linux-gnu
32
+ # - os: ubuntu-latest
33
+ # target: aarch64-unknown-linux-gnu
34
+ # - os: ubuntu-latest
35
+ # target: x86_64-alpine-linux-musl
36
+ # - os: ubuntu-latest
37
+ # target: aarch64-alpine-linux-musl
25
38
26
39
steps :
27
40
- name : Checkout
32
45
run : |
33
46
$ProgressPreference = "SilentlyContinue"
34
47
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
35
- .\rustup-init.exe -y --default-host=${{ matrix.target }} --default-toolchain=none
48
+ .\rustup-init.exe -y --default-host=${{ matrix.target }} --default-toolchain stable --profile minimal
36
49
del rustup-init.exe
37
50
rustup target add ${{ matrix.target }}
38
51
shell : powershell
@@ -43,12 +56,114 @@ jobs:
43
56
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
44
57
source $HOME/.cargo/env
45
58
rustup target add ${{ matrix.target }}
59
+ cargo install cbindgen
46
60
shell : bash
47
61
48
62
- name : Build
49
63
if : matrix.os == 'windows-latest'
50
- run : ./windows/build-artifacts.ps1 bin
64
+ run : ./windows/build-artifacts.ps1 ${{ env.OUTPUT_DIR }} ${{ matrix.target }}
65
+ shell : pwsh
51
66
52
67
- name : Build
53
68
if : matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
54
- run : ./build-profiling-ffi.sh
69
+ run : ./windows/build-artifacts.sh ${{ env.OUTPUT_DIR }} ${{ matrix.target }}
70
+ shell : bash
71
+
72
+ - name : Upload artifacts
73
+ uses : actions/upload-artifact@v4
74
+ with :
75
+ name : ${{ env.OUTPUT_DIR }}-${{ matrix.target }}
76
+ path : |
77
+ bin/*
78
+ !bin/*/*/build
79
+ !bin/*/*/deps
80
+ !bin/*/*/examples
81
+ !bin/*/*/incremental
82
+ !bin/*/*/.fingerprint
83
+ !bin/debug
84
+ !bin/release
85
+
86
+ pack :
87
+ runs-on : windows-latest
88
+ needs : build
89
+ steps :
90
+ - name : Checkout code
91
+ uses : actions/checkout@v4
92
+
93
+ - name : Download x86_64-pc-windows-msvc
94
+ uses : actions/download-artifact@v4
95
+ with :
96
+ name : ${{ env.OUTPUT_DIR }}-x86_64-pc-windows-msvc
97
+ path : bin
98
+
99
+ - name : Download i686-pc-windows-msvc
100
+ uses : actions/download-artifact@v4
101
+ with :
102
+ name : ${{ env.OUTPUT_DIR }}-i686-pc-windows-msvc
103
+ path : bin
104
+
105
+ - name : Download x86_64-apple-darwin
106
+ uses : actions/download-artifact@v4
107
+ with :
108
+ name : ${{ env.OUTPUT_DIR }}-x86_64-apple-darwin
109
+ path : bin/x86_64-apple-darwin
110
+
111
+ - name : Download aarch64-apple-darwin
112
+ uses : actions/download-artifact@v4
113
+ with :
114
+ name : ${{ env.OUTPUT_DIR }}-aarch64-apple-darwin
115
+ path : bin/aarch64-apple-darwin
116
+
117
+ - name : Download x86_64-unknown-linux-gnu
118
+ uses : actions/download-artifact@v4
119
+ with :
120
+ name : ${{ env.OUTPUT_DIR }}-x86_64-unknown-linux-gnu
121
+ path : bin/x86_64-unknown-linux-gnu
122
+
123
+ - name : dotnet pack
124
+ run : |
125
+ $cargo_content=Get-Content Cargo.toml -Raw
126
+ $cargo_content -match '(?m)^version += +"([^"]+)"'
127
+ $current_version=$Matches[1]
128
+ $version_suffix="ci.${{ github.event.number }}.${{ github.run_number }}"
129
+ $version="$current_version-$version_suffix"
130
+ echo "NUGET_VERSION=$version" >> "$GITHUB_OUTPUT"
131
+ dotnet pack windows/libdatadog.csproj -p:LibDatadogBinariesOutputDir=../${{ env.OUTPUT_DIR }} -p:LibDatadogVersion=$version -o ${{ env.PACKAGES_DIR }}
132
+
133
+ - name : Upload package
134
+ uses : actions/upload-artifact@v4
135
+ with :
136
+ name : ${{ env.PACKAGES_DIR }}
137
+ path : ${{ env.PACKAGES_DIR }}
138
+
139
+ test :
140
+ runs-on : ${{ matrix.os }}
141
+ needs : pack
142
+
143
+ strategy :
144
+ matrix :
145
+ include :
146
+ - os : windows-latest
147
+ target : x86_64-pc-windows-msvc
148
+ - os : windows-latest
149
+ target : i686-pc-windows-msvc
150
+
151
+ steps :
152
+ - name : Checkout code
153
+ uses : actions/checkout@v4
154
+
155
+ - name : Download package
156
+ uses : actions/download-artifact@v4
157
+ with :
158
+ name : ${{ env.PACKAGES_DIR }}
159
+
160
+ - name : Install .NET SDK
161
+ uses : actions/setup-dotnet@v1
162
+ with :
163
+ dotnet-version : 7.0
164
+
165
+ - name : Run
166
+ run : |
167
+ cd tests/nuget_package
168
+ dotnet add nuget_package.csproj package libdatadog --source local --version ${{ steps.pack.outputs.NUGET_VERSION }}
169
+ dotnet run
0 commit comments