Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .buildkite/commands/build-xcframework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -eu

echo "--- :rust: Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -v -y

source "/Users/builder/.cargo/env"

CACHE_DATE=$(date +%V-%y)

echo "--- :package: Installing Rust Toolchains"
make setup-rust

BUILD_CACHE_KEY="wprs-xcframework-cache-${CACHE_DATE}"
HAS_CACHE=false

echo "--- :swift: Building xcframework"
echo "Using cache key: $BUILD_CACHE_KEY"
restore_cache "${BUILD_CACHE_KEY}"

# Use Apple Archiver because it's way faster
if [[ -f "wprs-build-cache" ]]; then
HAS_CACHE=true

echo "Extracting from build cache"
aa extract -i wprs-build-cache.aar
fi

make xcframework
zip -r target/libwordpressFFI.xcframework.zip target/libwordpressFFI.xcframework

# Remove huge files that we can rebuild quickly.
# This brings the cache size from 49GB down to 33GB.
find "." -type f -name "libwp_api.*" -exec rm -v {} +
find "." -type f -name "libwordpress.a" -exec rm -v {} +

# if [ "$HAS_CACHE" = false ]; then
echo "Building Cache"
# Use Apple Archiver because it's way faster
aa archive -D target -o wprs-build-cache.aar
stat wprs-build-cache.aar
save_cache ./wprs-build-cache.aar "${BUILD_CACHE_KEY}" --force
rm wprs-build-cache.aar
# fi
14 changes: 2 additions & 12 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,14 @@ steps:
steps:
- label: ":swift: :darwin: Build xcframework"
key: "xcframework"
command: |
echo "--- :rust: Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -v -y

source "/Users/builder/.cargo/env"

echo "--- :package: Installing Rust Toolchains"
make setup-rust

echo "--- :swift: Building xcframework"
make xcframework
zip -r target/libwordpressFFI.xcframework.zip target/libwordpressFFI.xcframework
command: ".buildkite/commands/build-xcframework.sh"
artifact_paths:
- target/libwordpressFFI.xcframework.zip
- native/swift/Sources/wordpress-api-wrapper/wp_api.swift
- native/swift/Sources/wordpress-api-wrapper/wp_localization.swift
- native/swift/Sources/wordpress-api-wrapper/wp_com.swift
- native/swift/Sources/wordpress-api-wrapper/jetpack.swift
plugins: [$CI_TOOLKIT]
agents:
queue: mac
- label: ":swift: Build Docs"
Expand Down
5 changes: 3 additions & 2 deletions .buildkite/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ make setup-rust
echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :rust: Building XCFramework"
make xcframework-package
echo "--- :rust: Preparing XCFramework"
.buildkite/download-xcframework.sh
make xcframework-package-only
make xcframework-package-checksum

release_version="$1"
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ else
xcframework: xcframework-all
endif

xcframework-package: xcframework-all
xcframework-package: xcframework-all xcframework-package-only

xcframework-package-only:
rm -rf libwordpressFFI.xcframework.zip
ditto -c -k --sequesterRsrc --keepParent target/libwordpressFFI.xcframework/ libwordpressFFI.xcframework.zip

Expand Down