devolutions-crypto 0.9.2

An abstraction layer for the cryptography used by Devolutions
Documentation
name: Native Build macOS
description: This builds the macOS native libraries
runs:
  using: composite
  steps:
    - name: Download Config
      uses: actions/download-artifact@v4
      with:
        name: config.txt
        path: ./wrappers/csharp

    - name: Install Homebrew
      shell: bash
      run: |
        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
        echo "PATH=/opt/homebrew/bin:$PATH" >> $GITHUB_ENV
    
    - name: Verify Homebrew installation
      shell: bash
      run: brew --version
      
    - name: Install mono
      shell: bash
      run: brew install mono

    - name:  Install Rust
      shell: bash
      run: |
        set -e
        curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
        echo "$HOME/.cargo/bin" >> $GITHUB_PATH
        echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
        source $HOME/.cargo/env

        rustup target add x86_64-apple-darwin
        rustup target add aarch64-apple-darwin

    - name: Unit tests
      working-directory: ./
      shell: bash
      run: |
        source $HOME/.cargo/env
        cargo test

    - name: Build macOS Natives
      working-directory: ./wrappers/csharp
      shell: bash
      run: |
        cargo build -p devolutions-crypto-ffi --release --target=x86_64-apple-darwin
        cargo build -p devolutions-crypto-ffi --release --target=aarch64-apple-darwin

    - name: Copy macOS Natives
      shell: bash
      run: |
        mkdir ./wrappers/csharp/macos
        mkdir ./wrappers/csharp/macos/x86_64
        mkdir ./wrappers/csharp/macos/aarch64

        cp ./target/x86_64-apple-darwin/release/libdevolutions_crypto_ffi.dylib ./wrappers/csharp/macos/x86_64/libDevolutionsCrypto.dylib
        cp ./target/aarch64-apple-darwin/release/libdevolutions_crypto_ffi.dylib ./wrappers/csharp/macos/aarch64/libDevolutionsCrypto.dylib

    - name: Prepare folder structure
      working-directory: ./
      shell: bash
      run: |
        mv wrappers/csharp/macos wrappers/csharp/macos-temp
        mkdir -p wrappers/csharp/macos/macos
        mv wrappers/csharp/macos-temp/* wrappers/csharp/macos/macos/
        rmdir wrappers/csharp/macos-temp

    - uses: actions/upload-artifact@v4.3.6
      with:
        name: native-macos
        path: wrappers/csharp/macos/