Skip to content

Commit

Permalink
Uncomment macos build jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
muzuke committed Jul 20, 2023
1 parent b8a4698 commit c1f34e4
Showing 1 changed file with 187 additions and 187 deletions.
374 changes: 187 additions & 187 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,191 +140,191 @@ jobs:
name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}"
path: "./${{matrix.build-target.crate}}/target/${{ matrix.build-target.target-triple }}/release/${{ matrix.build-target.target-triple }}.tar.gz"

# create-uniffi-bindings:
# needs: [build]
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Clone uniffi-bindgen-cs
# uses: actions/checkout@v3
# with:
# repository: radixdlt/uniffi-bindgen-cs
# path: uniffi-bindgen-cs
# submodules: 'recursive'
# - uses: actions/download-artifact@v3
# with:
# path: artifacts
# - name: Extracting the Library
# run: |
# mkdir extracted
# cd radix-engine-toolkit-uniffi-x86_64-apple-darwin
# tar -xvzf x86_64-apple-darwin.tar.gz --directory="../extracted"
# working-directory: artifacts
# - name: Generate the Bindings
# run: |
# cargo run \
# --manifest-path="../../uniffi-bindgen/Cargo.toml" -- \
# generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
# --language swift \
# --out-dir ./output \
# --lib-file ./libradix_engine_toolkit_uniffi.a

# cargo run \
# --manifest-path="../../uniffi-bindgen/Cargo.toml" -- \
# generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
# --language kotlin \
# --out-dir ./output \
# --lib-file ./libradix_engine_toolkit_uniffi.a

# cargo run \
# --manifest-path="../../uniffi-bindgen/Cargo.toml" -- \
# generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
# --language python \
# --out-dir ./output \
# --lib-file ./libradix_engine_toolkit_uniffi.a
create-uniffi-bindings:
needs: [build]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clone uniffi-bindgen-cs
uses: actions/checkout@v3
with:
repository: radixdlt/uniffi-bindgen-cs
path: uniffi-bindgen-cs
submodules: 'recursive'
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Extracting the Library
run: |
mkdir extracted
cd radix-engine-toolkit-uniffi-x86_64-apple-darwin
tar -xvzf x86_64-apple-darwin.tar.gz --directory="../extracted"
working-directory: artifacts
- name: Generate the Bindings
run: |
cargo run \
--manifest-path="../../uniffi-bindgen/Cargo.toml" -- \
generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--language swift \
--out-dir ./output \
--lib-file ./libradix_engine_toolkit_uniffi.a
cargo run \
--manifest-path="../../uniffi-bindgen/Cargo.toml" -- \
generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--language kotlin \
--out-dir ./output \
--lib-file ./libradix_engine_toolkit_uniffi.a
cargo run \
--manifest-path="../../uniffi-bindgen/Cargo.toml" -- \
generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--language python \
--out-dir ./output \
--lib-file ./libradix_engine_toolkit_uniffi.a
# cargo run \
# --manifest-path="../../uniffi-bindgen-cs/bindgen/Cargo.toml" -- \
# ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
# --out-dir ./output \
# --lib-file ./libradix_engine_toolkit_uniffi.dylib
# working-directory: artifacts/extracted
# - name: Compress Artifacts
# run: |
# tar -czf "./UniFFI-Bindings.tar.gz" ./output
# working-directory: artifacts/extracted
# - name: Upload Bindings
# uses: actions/upload-artifact@v3
# with:
# name: "UniFFI-Bindings"
# path: "./artifacts/extracted/UniFFI-Bindings.tar.gz"

# build-test-kit:
# needs: [build]
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Run Generator
# run: cargo run
# working-directory: generator
# - name: Compress Generated
# run: tar -czf "./test-kit.tar.gz" ./output
# working-directory: generator
# - name: Upload Generated Artifacts
# uses: actions/upload-artifact@v3
# with:
# name: "test-kit.tar.gz"
# path: "./generator/test-kit.tar.gz"

# publish-swift-spm:
# needs: [build, create-uniffi-bindings]
# runs-on: macos-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Checkout Swift Egine toolkit
# uses: actions/checkout@v3
# with:
# repository: radixdlt/swift-engine-toolkit
# token: ${{ secrets.RADIX_BOT_PAT }}
# path: ./swift-engine-toolkit
# - uses: actions/download-artifact@v3
# with:
# path: artifacts
# - name: Build XCFramework
# working-directory: artifacts
# run: |
# # The name of the crate that we will be creating the XCFramework and the bindings for.
# CRATE_NAME="radix-engine-toolkit-uniffi"

# # The name of the directory to write the extracted libraries in.
# EXTRACTED="extracted"
# mkdir $EXTRACTED

# # Extract the UniFFI Bindings
# mkdir $EXTRACTED/UniFFI-Bindings
# tar -xvzf "UniFFI-Bindings/UniFFI-Bindings.tar.gz" --directory="./$EXTRACTED/UniFFI-Bindings"

# # Creating the include directory - this will be used in the XCFramework build steps
# mkdir $EXTRACTED/include
# cp $EXTRACTED/UniFFI-Bindings/output/radix_engine_toolkit_uniffiFFI.modulemap $EXTRACTED/include/module.modulemap
# cp $EXTRACTED/UniFFI-Bindings/output/radix_engine_toolkit_uniffiFFI.h $EXTRACTED/include/radix_engine_toolkit_uniffiFFI.h

# # Extract the builds of the targets that we need. All of them have a common known pattern which
# # we depend on for the extraction: `${CRATE_NAME}-${TARGET_TRIPLE}`.
# for TARGET_TRIPLE in "aarch64-apple-darwin" "x86_64-apple-darwin" "aarch64-apple-ios-sim" "x86_64-apple-ios" "aarch64-apple-ios"
# do
# # Create a new directory for the target
# mkdir $EXTRACTED/$TARGET_TRIPLE;

# BUILD_ARTIFACT="$CRATE_NAME-$TARGET_TRIPLE"
# tar -xvzf "$BUILD_ARTIFACT/$TARGET_TRIPLE.tar.gz" --directory="./$EXTRACTED/$TARGET_TRIPLE"
# done
# rm -rf ./$EXTRACTED/*.tar.gz

# # Using Lipo to combine some of the libraries into fat libraries.
# mkdir ./$EXTRACTED/macos-arm64_x86_64/
# mkdir ./$EXTRACTED/ios-simulator-arm64_x86_64

# lipo -create \
# "./$EXTRACTED/aarch64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \
# "./$EXTRACTED/x86_64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \
# -o "./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib"
# lipo -create \
# "./$EXTRACTED/aarch64-apple-ios-sim/libradix_engine_toolkit_uniffi.dylib" \
# "./$EXTRACTED/x86_64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \
# -o "./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib"

# # Set proper id, so that Xcode can properly locate the dynamic library
# install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/aarch64-apple-ios/libradix_engine_toolkit_uniffi.dylib
# install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib
# install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib

# # Creating the XCFramework
# xcodebuild -create-xcframework \
# -library "./$EXTRACTED/aarch64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \
# -headers "./$EXTRACTED/include" \
# -library "./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" \
# -headers "./$EXTRACTED/include" \
# -library "./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" \
# -headers "./$EXTRACTED/include" \
# -output "./$EXTRACTED/RadixEngineToolkit.xcframework"
# - name: Publish to Swift Engine Toolkit
# run: |
# BRANCH=${{ github.ref_name }}
# BUILD_CRATE_MANIFEST="./radix-engine-toolkit-uniffi/Cargo.toml"
# CRATE_VERSION=$(cargo read-manifest --manifest-path $BUILD_CRATE_MANIFEST | jq -r '.version')
# LAST_COMMIT_SHA=$(git rev-parse --short HEAD)
# SPM_VERSION="$CRATE_VERSION-$LAST_COMMIT_SHA"
# SET_UPSTREAM_FLAG=""

# cd swift-engine-toolkit
# REMOTE_BRANCH=$(git ls-remote --heads origin $BRANCH)

# if [ -z "$REMOTE_BRANCH" ]
# then
# git checkout -b $BRANCH
# # Allows creating branch on remote
# SET_UPSTREAM_FLAG="-u"
# else
# git fetch origin $BRANCH
# git checkout $BRANCH
# git pull origin $BRANCH
# fi

# cp -R ../artifacts/extracted/RadixEngineToolkit.xcframework ./Sources/RadixEngineToolkit
# cp -R ../artifacts/extracted/UniFFI-Bindings/output/radix_engine_toolkit_uniffi.swift ./Sources/EngineToolkit/radix_engine_toolkit_uniffi.swift

# git add .
# git commit -m "Update RET from $BRANCH - $LAST_COMMIT_SHA"
# git tag -a $SPM_VERSION -m "RET update from $BRANCH - $LAST_COMMIT_SHA"
# git push $SET_UPSTREAM_FLAG origin $BRANCH
# git push origin $SPM_VERSION

# - name: Upload Artifacts
# uses: actions/upload-artifact@v3
# with:
# name: "RadixEngineToolkit.xcframework"
# path: "./artifacts/extracted/RadixEngineToolkit.xcframework"
cargo run \
--manifest-path="../../uniffi-bindgen-cs/bindgen/Cargo.toml" -- \
../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--out-dir ./output \
--lib-file ./libradix_engine_toolkit_uniffi.dylib
working-directory: artifacts/extracted
- name: Compress Artifacts
run: |
tar -czf "./UniFFI-Bindings.tar.gz" ./output
working-directory: artifacts/extracted
- name: Upload Bindings
uses: actions/upload-artifact@v3
with:
name: "UniFFI-Bindings"
path: "./artifacts/extracted/UniFFI-Bindings.tar.gz"

build-test-kit:
needs: [build]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Generator
run: cargo run
working-directory: generator
- name: Compress Generated
run: tar -czf "./test-kit.tar.gz" ./output
working-directory: generator
- name: Upload Generated Artifacts
uses: actions/upload-artifact@v3
with:
name: "test-kit.tar.gz"
path: "./generator/test-kit.tar.gz"

publish-swift-spm:
needs: [build, create-uniffi-bindings]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout Swift Egine toolkit
uses: actions/checkout@v3
with:
repository: radixdlt/swift-engine-toolkit
token: ${{ secrets.RADIX_BOT_PAT }}
path: ./swift-engine-toolkit
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Build XCFramework
working-directory: artifacts
run: |
# The name of the crate that we will be creating the XCFramework and the bindings for.
CRATE_NAME="radix-engine-toolkit-uniffi"
# The name of the directory to write the extracted libraries in.
EXTRACTED="extracted"
mkdir $EXTRACTED
# Extract the UniFFI Bindings
mkdir $EXTRACTED/UniFFI-Bindings
tar -xvzf "UniFFI-Bindings/UniFFI-Bindings.tar.gz" --directory="./$EXTRACTED/UniFFI-Bindings"
# Creating the include directory - this will be used in the XCFramework build steps
mkdir $EXTRACTED/include
cp $EXTRACTED/UniFFI-Bindings/output/radix_engine_toolkit_uniffiFFI.modulemap $EXTRACTED/include/module.modulemap
cp $EXTRACTED/UniFFI-Bindings/output/radix_engine_toolkit_uniffiFFI.h $EXTRACTED/include/radix_engine_toolkit_uniffiFFI.h
# Extract the builds of the targets that we need. All of them have a common known pattern which
# we depend on for the extraction: `${CRATE_NAME}-${TARGET_TRIPLE}`.
for TARGET_TRIPLE in "aarch64-apple-darwin" "x86_64-apple-darwin" "aarch64-apple-ios-sim" "x86_64-apple-ios" "aarch64-apple-ios"
do
# Create a new directory for the target
mkdir $EXTRACTED/$TARGET_TRIPLE;
BUILD_ARTIFACT="$CRATE_NAME-$TARGET_TRIPLE"
tar -xvzf "$BUILD_ARTIFACT/$TARGET_TRIPLE.tar.gz" --directory="./$EXTRACTED/$TARGET_TRIPLE"
done
rm -rf ./$EXTRACTED/*.tar.gz
# Using Lipo to combine some of the libraries into fat libraries.
mkdir ./$EXTRACTED/macos-arm64_x86_64/
mkdir ./$EXTRACTED/ios-simulator-arm64_x86_64
lipo -create \
"./$EXTRACTED/aarch64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \
"./$EXTRACTED/x86_64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \
-o "./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib"
lipo -create \
"./$EXTRACTED/aarch64-apple-ios-sim/libradix_engine_toolkit_uniffi.dylib" \
"./$EXTRACTED/x86_64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \
-o "./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib"
# Set proper id, so that Xcode can properly locate the dynamic library
install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/aarch64-apple-ios/libradix_engine_toolkit_uniffi.dylib
install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib
install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib
# Creating the XCFramework
xcodebuild -create-xcframework \
-library "./$EXTRACTED/aarch64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \
-headers "./$EXTRACTED/include" \
-library "./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" \
-headers "./$EXTRACTED/include" \
-library "./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" \
-headers "./$EXTRACTED/include" \
-output "./$EXTRACTED/RadixEngineToolkit.xcframework"
- name: Publish to Swift Engine Toolkit
run: |
BRANCH=${{ github.ref_name }}
BUILD_CRATE_MANIFEST="./radix-engine-toolkit-uniffi/Cargo.toml"
CRATE_VERSION=$(cargo read-manifest --manifest-path $BUILD_CRATE_MANIFEST | jq -r '.version')
LAST_COMMIT_SHA=$(git rev-parse --short HEAD)
SPM_VERSION="$CRATE_VERSION-$LAST_COMMIT_SHA"
SET_UPSTREAM_FLAG=""
cd swift-engine-toolkit
REMOTE_BRANCH=$(git ls-remote --heads origin $BRANCH)
if [ -z "$REMOTE_BRANCH" ]
then
git checkout -b $BRANCH
# Allows creating branch on remote
SET_UPSTREAM_FLAG="-u"
else
git fetch origin $BRANCH
git checkout $BRANCH
git pull origin $BRANCH
fi
cp -R ../artifacts/extracted/RadixEngineToolkit.xcframework ./Sources/RadixEngineToolkit
cp -R ../artifacts/extracted/UniFFI-Bindings/output/radix_engine_toolkit_uniffi.swift ./Sources/EngineToolkit/radix_engine_toolkit_uniffi.swift
git add .
git commit -m "Update RET from $BRANCH - $LAST_COMMIT_SHA"
git tag -a $SPM_VERSION -m "RET update from $BRANCH - $LAST_COMMIT_SHA"
git push $SET_UPSTREAM_FLAG origin $BRANCH
git push origin $SPM_VERSION
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: "RadixEngineToolkit.xcframework"
path: "./artifacts/extracted/RadixEngineToolkit.xcframework"

0 comments on commit c1f34e4

Please sign in to comment.