Skip to content

Commit

Permalink
build: update swift package and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalo-frade-iohk committed Oct 10, 2023
1 parent fbd6286 commit 13c746a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,29 @@ jobs:
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
lib: libanoncreds_uniffi.so
libPath: uniffi/target/aarch64-unknown-linux-gnu/release/libanoncreds_uniffi.so
use_cross: true
- architecture: linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
lib: libanoncreds_uniffi.so
libPath: uniffi/target/x86_64-unknown-linux-gnu/release/libanoncreds_uniffi.so
use_cross: true
- architecture: darwin-x86_64
os: macos-latest
target: x86_64-apple-darwin
lib: libanoncreds_uniffi.dylib
libPath: uniffi/target/x86_64-apple-darwin/release/libanoncreds_uniffi.dylib
- architecture: darwin-aarch64
os: macos-latest
target: aarch64-apple-darwin
lib: libanoncreds_uniffi.dylib
libPath: uniffi/target/aarch64-apple-darwin/release/libanoncreds_uniffi.dylib
- architecture: swift-package-universal
os: macos-latest
target: swift-package-universal
lib: libanoncreds.xcframework.zip
libPath: uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip

runs-on: ${{ matrix.os }}

Expand All @@ -48,7 +57,7 @@ jobs:
uses: actions/checkout@v3

- name: Install Rust toolchain
if: "matrix.target != 'darwin-universal'"
if: "matrix.target != 'swift-package-universal'"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
Expand All @@ -75,7 +84,7 @@ jobs:
if: "runner.os == 'macOS'"
run: |
cd uniffi
if [ "${{ matrix.architecture }}" == "darwin-universal" ]; then
if [ "${{ matrix.architecture }}" == "swift-package-universal" ]; then
./build-release-apple-universal.sh
else
cargo build --release --target ${{matrix.target}}
Expand All @@ -84,22 +93,23 @@ jobs:
- name: Upload library artifacts
uses: actions/upload-artifact@v3
with:
name: library-${{ matrix.architecture }}
path: uniffi/target/${{ matrix.target }}/release/${{ matrix.lib }}
name: ${{ matrix.lib }}
path: ${{ matrix.libPath }}

- name: Create library artifacts directory
if: |
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')
run: |
mkdir release-artifacts
cp uniffi/target/${{ matrix.target }}/release/${{ matrix.lib }} release-artifacts/
cp ${{ matrix.libPath }} release-artifacts/
- name: Release artifacts
uses: a7ul/[email protected]
if: |
(${{ matrix.architecture }} != 'swift-package-universal' &&
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true'))
with:
command: c
cwd: release-artifacts
Expand All @@ -108,9 +118,20 @@ jobs:

- name: Add library artifacts to release
if: |
(${{ matrix.architecture }} != 'swift-package-universal' &&
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true')
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true'))
uses: svenstaro/upload-release-action@v2
with:
file: library-${{ matrix.architecture }}.tar.gz
asset_name: "library-${{ matrix.architecture }}-${{ github.sha }}.tar.gz"

- name: Add swift package artifacts to release
if: |
(${{ matrix.architecture }} == 'swift-package-universal' &&
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish-binaries == 'true'))
uses: svenstaro/upload-release-action@v2
with:
file: ${{ matrix.lib }}
asset_name: "${{ matrix.lib }}"
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ let package = Package(
// RELEASE
.binaryTarget(
name: "libanoncreds",
url: "https://github.com/input-output-hk/anoncreds-rs/releases/download/0.1.0/libanoncreds.xcframework.zip",
checksum: "d4f909adbdd2912ed9fc869aa4b8eba679fb68cf7a0d18887af150f72f08115b"
url: "https://github.com/input-output-hk/anoncreds-rs/releases/download/0.3.0/libanoncreds.xcframework.zip",
checksum: "ca6b65895ceb207ee6d1b1b679fdf0e74185b4b5a44f8a2db9100ccc110fb0a3"
)
]
)

0 comments on commit 13c746a

Please sign in to comment.