Skip to content

Commit b1e006e

Browse files
authored
testing mac os build (#195)
* testing mac os build * updating readmes, claude, and publish * change cas-core-lib commit
1 parent 5ffe3d3 commit b1e006e

7 files changed

Lines changed: 8 additions & 106 deletions

File tree

.github/workflows/main-push-nuget-publish.yml

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,9 @@ jobs:
8080
name: native-osx-arm64
8181
path: cas-dotnet-sdk/artifacts/native/osx-arm64
8282

83-
native-macos-x64:
84-
runs-on: macos-13
85-
steps:
86-
- uses: actions/checkout@v4
87-
with:
88-
submodules: recursive
89-
90-
- uses: dtolnay/rust-toolchain@stable
91-
92-
- name: Build Rust (macOS x64)
93-
working-directory: cas-core-lib
94-
run: cargo build --release
95-
96-
- name: Stage native
97-
run: |
98-
mkdir -p cas-dotnet-sdk/artifacts/native/osx-x64
99-
cp cas-core-lib/target/release/libcas_core_lib.dylib cas-dotnet-sdk/artifacts/native/osx-x64/
100-
101-
- uses: actions/upload-artifact@v4
102-
with:
103-
name: native-osx-x64
104-
path: cas-dotnet-sdk/artifacts/native/osx-x64
105-
10683
pack-and-publish:
10784
runs-on: ubuntu-latest
108-
needs: [native-windows, native-linux, native-macos-arm64, native-macos-x64]
85+
needs: [native-windows, native-linux, native-macos-arm64]
10986

11087
steps:
11188
- uses: actions/checkout@v4
@@ -125,18 +102,12 @@ jobs:
125102
name: native-osx-arm64
126103
path: cas-dotnet-sdk/artifacts/native/osx-arm64
127104

128-
- uses: actions/download-artifact@v4
129-
with:
130-
name: native-osx-x64
131-
path: cas-dotnet-sdk/artifacts/native/osx-x64
132-
133105
- name: Verify staged natives
134106
run: |
135107
ls -R cas-dotnet-sdk/artifacts/native
136108
test -f cas-dotnet-sdk/artifacts/native/linux-x64/libcas_core_lib.so
137109
test -f cas-dotnet-sdk/artifacts/native/win-x64/cas_core_lib.dll
138110
test -f cas-dotnet-sdk/artifacts/native/osx-arm64/libcas_core_lib.dylib
139-
test -f cas-dotnet-sdk/artifacts/native/osx-x64/libcas_core_lib.dylib
140111
141112
- uses: actions/setup-dotnet@v4
142113
with:

.github/workflows/pr-tests-macos-x64.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dotnet test ./cas-dotnet-sdk-tests/cas-dotnet-sdk-tests.csproj -f net8.0 --filte
3535
dotnet test ./cas-dotnet-sdk-tests/cas-dotnet-sdk-tests.csproj -f net8.0 --filter "DisplayName~Hash512"
3636
```
3737

38-
The same commands work for local development on macOS: a Rust toolchain on PATH builds `libcas_core_lib.dylib`, and the `StageRustArtifacts` MSBuild target detects the host (Apple Silicon vs Intel) and stages it into `artifacts/native/osx-arm64/` or `artifacts/native/osx-x64/` automatically — no extra flags needed.
38+
The same commands work for local development on macOS (Apple Silicon): a Rust toolchain on PATH builds `libcas_core_lib.dylib`, and the `StageRustArtifacts` MSBuild target stages it into `artifacts/native/osx-arm64/` automatically — no extra flags needed.
3939

4040
Note: CI (`.github/workflows/pr-tests-*.yml`) builds `cargo build --release` separately, then copies the native lib into the test `bin/Release/<tfm>` directory before running `dotnet test`. If you build the Rust lib by hand and the MSBuild target is skipped, the native artifact must end up next to the test assembly the same way.
4141

@@ -69,6 +69,6 @@ Categories with interchangeable algorithms expose a `*Factory` (e.g. `HasherFact
6969

7070
## Cross-platform constraint
7171

72-
Supported targets: **Windows x64**, **Linux x64**, and **macOS** (both `osx-arm64` Apple Silicon and `osx-x64` Intel). Since the csbindgen migration (#191), P/Invoke goes through the generated `generated/NativeMethods.g.cs` using the bare library name `cas_core_lib`; the .NET runtime resolves it per-OS to `cas_core_lib.dll` / `libcas_core_lib.so` / `libcas_core_lib.dylib`, so there are no per-platform `[DllImport]` files to keep in sync. The native lib is built (`cargo build --release`), staged into `artifacts/native/<rid>/`, and packed into `runtimes/<rid>/native` for each RID. Tests run against .NET 6–10 on all three OSes in CI on every PR: `pr-tests-windows` and `pr-tests-linux` fan out one job per TFM, while macOS is split by architecture into two separate workflows — `pr-tests-macos-arm64` (`macos-latest`, Apple Silicon) and `pr-tests-macos-x64` (`macos-13`, Intel) — each running all five target frameworks in a single `dotnet test` invocation (no `-f`). The `OperatingSystemDeterminator` resolves Windows, Linux, and OSX and throws on anything else.
72+
Supported targets: **Windows x64**, **Linux x64**, and **macOS Apple Silicon** (`osx-arm64`). Intel macs (`osx-x64`) are intentionally not supported — the Intel runners were too slow for this project's CI. Since the csbindgen migration (#191), P/Invoke goes through the generated `generated/NativeMethods.g.cs` using the bare library name `cas_core_lib`; the .NET runtime resolves it per-OS to `cas_core_lib.dll` / `libcas_core_lib.so` / `libcas_core_lib.dylib`, so there are no per-platform `[DllImport]` files to keep in sync. The native lib is built (`cargo build --release`), staged into `artifacts/native/<rid>/`, and packed into `runtimes/<rid>/native` for each RID. Tests run against .NET 6–10 on all three OSes in CI on every PR: `pr-tests-windows` and `pr-tests-linux` fan out one job per TFM, while `pr-tests-macos-arm64` (`macos-latest`, Apple Silicon) runs all five target frameworks in a single `dotnet test` invocation (no `-f`). The `OperatingSystemDeterminator` resolves Windows, Linux, and OSX and throws on anything else.
7373

7474
Note: this is desktop **macOS / Darwin**, not iOS. Real iOS (`aarch64-apple-ios`) would need a cross-compiled native lib and a simulator/device to run tests, neither of which the current CI provides.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CAS .NET SDK is a comprehensive cryptographic toolkit for .NET, designed to prov
1313
- Seamless integration with [cas-lib](https://github.com/Cryptographic-API-Services/cas-lib) Rust FFI layer for optimal performance
1414
- Unified interface: no need to manage multiple cryptography packages or surf disparate documentation
1515
- Built on trusted, open-source cryptography libraries
16-
- Cross-platform support: Windows x64, Linux x64, macOS (Apple Silicon arm64 & Intel x64)
16+
- Cross-platform support: Windows x64, Linux x64, macOS (Apple Silicon arm64)
1717
- Multi-framework support: .NET 6, 7, 8, 9, 10
1818

1919
## Documentation & References
@@ -35,7 +35,6 @@ We aim to provide cross-compatibility wherever possible. Test cases are run on .
3535
- [X] Windows x64
3636
- [X] Linux x64
3737
- [X] macOS arm64 (Apple Silicon)
38-
- [X] macOS x64 (Intel)
3938

4039
## Disclaimer
4140
This SDK leverages several cryptographic crates via our core FFI [layer](https://github.com/Cryptographic-API-Services/cas-core-lib). Please note that many of these crates have not undergone formal security audits. Use this library at your own risk and always review the underlying cryptographic implementations for your security requirements.

cas-core-lib

cas-dotnet-sdk/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CAS .NET SDK is a comprehensive cryptographic toolkit for .NET, designed to prov
1313
- Seamless integration with [cas-lib](https://github.com/Cryptographic-API-Services/cas-lib) Rust FFI layer for optimal performance
1414
- Unified interface: no need to manage multiple cryptography packages or surf disparate documentation
1515
- Built on trusted, open-source cryptography libraries
16-
- Cross-platform support: Windows x64, Linux x64, macOS (Apple Silicon arm64 & Intel x64)
16+
- Cross-platform support: Windows x64, Linux x64, macOS (Apple Silicon arm64)
1717
- Multi-framework support: .NET 6, 7, 8, 9, 10
1818

1919
## Documentation & References
@@ -35,7 +35,6 @@ We aim to provide cross-compatibility wherever possible. Test cases are run on .
3535
- [X] Windows x64
3636
- [X] Linux x64
3737
- [X] macOS arm64 (Apple Silicon)
38-
- [X] macOS x64 (Intel)
3938

4039
## Disclaimer
4140
This SDK leverages several cryptographic crates via our core FFI [layer](https://github.com/Cryptographic-API-Services/cas-core-lib). Please note that many of these crates have not undergone formal security audits. Use this library at your own risk and always review the underlying cryptographic implementations for your security requirements.

cas-dotnet-sdk/cas-dotnet-sdk.csproj

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,17 @@
4343
<PropertyGroup>
4444
<!-- $(OS) is 'Unix' on both Linux and macOS, so distinguish macOS explicitly. -->
4545
<_IsOSX>$([MSBuild]::IsOSPlatform('OSX'))</_IsOSX>
46-
<!-- Host arch -> RID suffix (Arm64 -> arm64, X64 -> x64) so a dev build on
47-
Apple Silicon stages osx-arm64 and an Intel Mac stages osx-x64. -->
48-
<_HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</_HostArch>
4946
</PropertyGroup>
5047

5148
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
5249
<_RustOut Include="$(RustProjectDir)\target\release\cas_core_lib.dll" />
5350
<_DestDir Include="$(NativeArtifactsDir)/win-x64/" />
5451
</ItemGroup>
5552

53+
<!-- macOS support is Apple Silicon (osx-arm64) only. -->
5654
<ItemGroup Condition="'$(_IsOSX)' == 'true'">
5755
<_RustOut Include="$(RustProjectDir)/target/release/libcas_core_lib.dylib" />
58-
<_DestDir Include="$(NativeArtifactsDir)/osx-$(_HostArch)/" />
56+
<_DestDir Include="$(NativeArtifactsDir)/osx-arm64/" />
5957
</ItemGroup>
6058

6159
<ItemGroup Condition="'$(OS)' != 'Windows_NT' AND '$(_IsOSX)' != 'true'">
@@ -92,14 +90,6 @@
9290
<Link>libcas_core_lib.dylib</Link>
9391
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
9492
</None>
95-
96-
<None Include="$(NativeArtifactsDir)\osx-x64\libcas_core_lib.dylib"
97-
Condition="Exists('$(NativeArtifactsDir)\osx-x64\libcas_core_lib.dylib')">
98-
<Pack>true</Pack>
99-
<PackagePath>runtimes\osx-x64\native</PackagePath>
100-
<Link>libcas_core_lib.dylib</Link>
101-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
102-
</None>
10393
</ItemGroup>
10494

10595
<!--

0 commit comments

Comments
 (0)