Skip to content

Commit f59491a

Browse files
committed
chore: Update workflow
1 parent eb2004c commit f59491a

File tree

13 files changed

+147
-4395
lines changed

13 files changed

+147
-4395
lines changed

.github/workflows/build.yml

Lines changed: 144 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,165 @@
1-
on: [workflow_dispatch]
1+
name: Build and Release ProseSDK
22

3-
name: Build
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
core_client_ref:
7+
description: 'prose-core-client branch/tag to build from'
8+
required: false
9+
default: 'master'
10+
type: string
11+
12+
env:
13+
CORE_CLIENT_REPO: prose-im/prose-core-client
14+
WRAPPER_REPO: prose-im/prose-wrapper-swift
415

516
jobs:
6-
release-number:
7-
name: Check if release already exists
8-
runs-on: ubuntu-latest
9-
outputs:
10-
ok: ${{ steps.release-number.outputs.ok }}
17+
build-and-release:
18+
runs-on: macos-latest
19+
1120
steps:
12-
- name: Checkout code
21+
- name: Checkout wrapper repository
1322
uses: actions/checkout@v4
1423
with:
15-
submodules: false
16-
17-
- name: Get prose-core-client submodule SHA and set ok flag if release does not exist.
18-
id: release-number
19-
run: scripts/check-release.sh
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
path: wrapper
2226

23-
build:
24-
name: Build Swift Package
25-
needs:
26-
- release-number
27-
if: ${{ needs.release-number.outputs.ok == 'true' }}
28-
runs-on: macos-12
29-
30-
steps:
31-
- name: Checkout code
27+
- name: Checkout core client repository
3228
uses: actions/checkout@v4
3329
with:
34-
submodules: true
30+
repository: ${{ env.CORE_CLIENT_REPO }}
31+
ref: ${{ github.event.inputs.core_client_ref || 'master' }}
32+
path: core-client
3533

36-
- name: Fetch dependencies
37-
run: scripts/fetch-dependencies.sh
34+
- name: Install system dependencies
35+
run: |
36+
# Required by libsignal
37+
brew install protobuf
3838
39-
- name: Install Automake
40-
run: brew install automake
39+
- name: Setup Rust
40+
run: |
41+
# Navigate to core-client directory where rust-toolchain.toml exists
42+
cd core-client
4143
42-
- name: Install Rust toolchain
43-
uses: actions-rs/toolchain@v1
44-
with:
45-
toolchain: stable
44+
# This will automatically install the toolchain specified in rust-toolchain.toml
45+
# and then add targets to that toolchain
46+
rustup target add x86_64-apple-darwin aarch64-apple-darwin x86_64-apple-ios aarch64-apple-ios-sim aarch64-apple-ios
4647
47-
- name: Install Rust targets
48-
run: rustup target add x86_64-apple-darwin aarch64-apple-darwin x86_64-apple-ios aarch64-apple-ios-sim aarch64-apple-ios
48+
# Install bindgen-cli which is required by aws-lc-sys
49+
cargo install --force --locked bindgen-cli
4950
50-
- name: Get libstrophe submodule SHA
51-
id: lstrophesha
52-
run: echo "lstrophesha=$(git rev-parse @:./dependencies/libstrophe)" >> $GITHUB_OUTPUT
51+
echo "Active toolchain:"
52+
rustup show active-toolchain
53+
echo "Installed Apple targets:"
54+
rustup target list --installed | grep apple
5355
54-
- name: Cache libstrophe
55-
id: cache-libstrophe
56-
uses: actions/cache@v4
57-
with:
58-
path: Build/libstrophe
59-
key: libstrophe-${{ steps.lstrophesha.outputs.lstrophesha }}
56+
- name: Extract version from Cargo.toml
57+
id: version
58+
run: |
59+
VERSION=$(grep -m1 '^version = ' core-client/bindings/prose-sdk-ffi/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
60+
echo "version=$VERSION" >> $GITHUB_OUTPUT
61+
echo "Extracted version: $VERSION"
62+
63+
- name: Check if release already exists
64+
id: check_release
65+
run: |
66+
cd wrapper
67+
if gh release view "v${{ steps.version.outputs.version }}" > /dev/null 2>&1; then
68+
echo "exists=true" >> $GITHUB_OUTPUT
69+
echo "Release v${{ steps.version.outputs.version }} already exists"
70+
else
71+
echo "exists=false" >> $GITHUB_OUTPUT
72+
echo "Release v${{ steps.version.outputs.version }} does not exist"
73+
fi
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
77+
- name: Exit if release exists
78+
if: steps.check_release.outputs.exists == 'true'
79+
run: |
80+
echo "Release v${{ steps.version.outputs.version }} already exists. Exiting."
81+
exit 0
82+
83+
- name: Build XCFramework
84+
run: |
85+
cd core-client
86+
cargo xtask swift build
87+
88+
- name: Copy built framework to wrapper repo
89+
run: |
90+
cp -r core-client/bindings/prose-sdk-ffi/ProseSDK/* wrapper/
6091
61-
- name: Build libstrophe
62-
run: scripts/build-libstrophe.sh
92+
- name: Create release archive
93+
run: |
94+
cd wrapper
95+
zip -r -y "ProseSDK-${{ steps.version.outputs.version }}.zip" ProseCore.xcframework
6396
64-
- name: Build core client
65-
run: scripts/build-core-client.sh
97+
- name: Calculate checksum
98+
id: checksum
99+
run: |
100+
cd wrapper
101+
CHECKSUM=$(swift package compute-checksum "ProseSDK-${{ steps.version.outputs.version }}.zip")
102+
echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT
103+
echo "Checksum: $CHECKSUM"
104+
105+
- name: Update Package.swift
106+
run: |
107+
cd wrapper
108+
cat > Package.swift << 'EOF'
109+
// swift-tools-version:5.5
110+
// The swift-tools-version declares the minimum version of Swift required to build this package.
111+
// Swift Package: ProseSDK
112+
import PackageDescription
113+
114+
let package = Package(
115+
name: "ProseSDK",
116+
platforms: [
117+
.iOS(.v13),
118+
.macOS(.v10_15)
119+
],
120+
products: [
121+
.library(
122+
name: "ProseSDK",
123+
targets: ["ProseSDK"]
124+
)
125+
],
126+
dependencies: [ ],
127+
targets: [
128+
.binaryTarget(
129+
name: "ProseCore",
130+
url: "https://github.com/${{ env.WRAPPER_REPO }}/releases/download/v${{ steps.version.outputs.version }}/ProseSDK-${{ steps.version.outputs.version }}.zip",
131+
checksum: "${{ steps.checksum.outputs.checksum }}"
132+
),
133+
.target(
134+
name: "ProseSDK",
135+
dependencies: [
136+
.target(name: "ProseCore")
137+
]
138+
),
139+
]
140+
)
141+
EOF
142+
143+
- name: Commit updated Package.swift and Sources
144+
run: |
145+
cd wrapper
146+
git add Package.swift Sources/
147+
if git diff --staged --quiet; then
148+
echo "No changes to commit"
149+
else
150+
git commit -m "Update Package.swift and Sources for v${{ steps.version.outputs.version }}"
151+
git push
152+
fi
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66155

67156
- name: Create release
68-
run: scripts/create-github-release.sh
157+
id: create_release
158+
run: |
159+
cd wrapper
160+
gh release create "v${{ steps.version.outputs.version }}" \
161+
"ProseSDK-${{ steps.version.outputs.version }}.zip" \
162+
--title "ProseSDK v${{ steps.version.outputs.version }}" \
163+
--notes "ProseSDK release v${{ steps.version.outputs.version }}"
69164
env:
70165
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

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

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44

55
**Prose wrappers for Swift.**
66

7-
Copyright 2022, Prose Foundation - Released under the [Mozilla Public License 2.0](./LICENSE.md).
7+
Copyright 2025, Prose Foundation - Released under the [Mozilla Public License 2.0](./LICENSE.md).
88

99
## Purpose
1010

1111
Builds and hosts [prose-core-client](https://github.com/prose-im/prose-core-client) as a Swift Package Manager package.
1212

1313
## How To Build?
1414

15-
To build locally install the following dependencies:
16-
17-
- Xcode
18-
- Rust toolchain with targets `x86_64-apple-darwin`, `aarch64-apple-darwin`, `x86_64-apple-ios`, `aarch64-apple-ios-sim`, `aarch64-apple-ios`
19-
20-
Then build by running `make swift-package`.
15+
- Update [version number](https://github.com/prose-im/prose-core-client/blob/master/bindings/prose-sdk-ffi/Cargo.toml)
16+
- Run [build action](https://github.com/prose-im/prose-wrapper-swift/actions/workflows/build.yml)

Sources/ProseCoreFFI/Emoji.swift

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

Sources/ProseCoreFFI/Errors+Description.swift

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

Sources/ProseCoreFFI/MessageId.swift

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

0 commit comments

Comments
 (0)