Viewing is open to everyone. Downloading and starring need a GitHub sign-in. Sign in with GitHub

sdk-dotnet.yml

v0.1.0-build.85 Latest Commit ede38f5

Size
5.8 KB
Lines
147
Language
yaml
SHA-256
c4b443e6bf1b…
View on GitHub

Sign in with GitHub to download. Each download is recorded with your GitHub username.

1name: SDK .NET
2on:
3 push:
4 paths:
5 - "sdk/dotnet/**"
6 - "src/**"
7 - "include/**"
8 - "VERSION"
9 - ".github/workflows/sdk-dotnet.yml"
10 pull_request:
11 paths:
12 - "sdk/dotnet/**"
13 - "src/**"
14 - "include/**"
15 - "VERSION"
16 - ".github/workflows/sdk-dotnet.yml"
17 workflow_dispatch:
18 workflow_call: # the release workflow builds release packages with this file
19permissions:
20 contents: read
21# Maintainers: pin these actions to full commit SHAs (as ci.yml does) before relying on this workflow.
22jobs:
23 native:
24 name: native (${{ matrix.rid }})
25 runs-on: ${{ matrix.os }}
26 strategy:
27 fail-fast: false
28 matrix:
29 include:
30 - rid: linux-x64
31 os: ubuntu-22.04 # oldest supported glibc we build against
32 cmake_args: ""
33 run_probe: true
34 - rid: win-x64
35 os: windows-2022
36 cmake_args: "-A x64"
37 run_probe: true
38 - rid: osx-arm64
39 os: macos-15
40 cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0"
41 run_probe: true
42 - rid: osx-x64
43 os: macos-15 # cross-compiled on Apple silicon
44 cmake_args: "-DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0"
45 run_probe: false
46 defaults:
47 run:
48 shell: bash
49 steps:
50 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
51 - name: Configure
52 run: cmake -S sdk/dotnet/native -B build-dotnet -DCMAKE_BUILD_TYPE=Release -DCKEY_DOTNET_RID=${{ matrix.rid }} ${{ matrix.cmake_args }}
53 - name: Build
54 run: cmake --build build-dotnet --config Release --parallel 4
55 - name: Check struct layouts against the C# mirrors
56 if: matrix.run_probe
57 run: |
58 ./build-dotnet/ckey_layout_probe | tr -d '\r' > layout.txt
59 diff -u --strip-trailing-cr sdk/dotnet/native/tools/layout_expected.txt layout.txt
60 - name: Check exported symbols
61 if: matrix.rid == 'linux-x64'
62 run: |
63 lib=sdk/dotnet/artifacts/native/linux-x64/libckeynative.so
64 nm -D --defined-only "$lib" | awk '{print $3}' | sort > exports.txt
65 if grep -v '^ckey_' exports.txt; then echo "unexpected exports"; exit 1; fi
66 grep -q '^ckey_encode_scalable$' exports.txt
67 grep -q '^ckey_telemetry_set_mode$' exports.txt
68 ! ldd "$lib" | grep -E 'libstdc\+\+|libgcc_s'
69 - name: List output
70 run: ls -la sdk/dotnet/artifacts/native/${{ matrix.rid }}
71 - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
72 with:
73 name: native-${{ matrix.rid }}
74 path: sdk/dotnet/artifacts/native/${{ matrix.rid }}/
75 if-no-files-found: error
76
77 test:
78 name: test (${{ matrix.rid }})
79 needs: native
80 runs-on: ${{ matrix.os }}
81 strategy:
82 fail-fast: false
83 matrix:
84 include:
85 - rid: linux-x64
86 os: ubuntu-24.04
87 - rid: win-x64
88 os: windows-2022
89 - rid: osx-arm64
90 os: macos-15
91 defaults:
92 run:
93 shell: bash
94 steps:
95 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
96 - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
97 with:
98 name: native-${{ matrix.rid }}
99 path: sdk/dotnet/artifacts/native/${{ matrix.rid }}
100 - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
101 with:
102 dotnet-version: "8.0.x"
103 - name: Build CKey (net8.0 and netstandard2.0)
104 run: dotnet build sdk/dotnet/src/CKey/CKey.csproj -c Release -p:CKeyHostRid=${{ matrix.rid }}
105 - name: Build CKey.Wpf
106 if: matrix.rid == 'win-x64'
107 run: dotnet build sdk/dotnet/src/CKey.Wpf/CKey.Wpf.csproj -c Release -p:CKeyHostRid=${{ matrix.rid }}
108 - name: Test
109 run: dotnet test sdk/dotnet/tests/CKey.Tests/CKey.Tests.csproj -c Release -p:CKeyHostRid=${{ matrix.rid }} --logger "console;verbosity=normal"
110
111 pack:
112 needs: [native, test]
113 runs-on: ubuntu-24.04
114 steps:
115 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
116 - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
117 with:
118 pattern: native-*
119 path: sdk/dotnet/artifacts/download
120 - name: Arrange native assets
121 run: |
122 for rid in win-x64 linux-x64 osx-arm64 osx-x64; do
123 mkdir -p sdk/dotnet/artifacts/native/$rid
124 cp sdk/dotnet/artifacts/download/native-$rid/* sdk/dotnet/artifacts/native/$rid/
125 done
126 ls -laR sdk/dotnet/artifacts/native
127 - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
128 with:
129 dotnet-version: "8.0.x"
130 - name: Pack
131 run: |
132 dotnet pack sdk/dotnet/src/CKey/CKey.csproj -c Release -p:CKeyRequireAllNatives=true -o sdk/dotnet/artifacts/packages
133 dotnet pack sdk/dotnet/src/CKey.Wpf/CKey.Wpf.csproj -c Release -o sdk/dotnet/artifacts/packages
134 - name: Verify package layout
135 run: |
136 version=$(tr -d '[:space:]' < VERSION)
137 pkg=sdk/dotnet/artifacts/packages/CKey.$version.nupkg
138 unzip -l "$pkg" | tee contents.txt
139 for f in runtimes/win-x64/native/ckeynative.dll runtimes/linux-x64/native/libckeynative.so \
140 runtimes/osx-arm64/native/libckeynative.dylib runtimes/osx-x64/native/libckeynative.dylib \
141 lib/net8.0/CKey.dll lib/netstandard2.0/CKey.dll README.md buildTransitive/CKey.targets; do
142 grep -q " $f\$" contents.txt || { echo "missing $f"; exit 1; }
143 done
144 - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
145 with:
146 name: nuget-packages
147 path: sdk/dotnet/artifacts/packages/