-
Notifications
You must be signed in to change notification settings - Fork 23
115 lines (115 loc) · 3.59 KB
/
release-swift-bindings.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Release Swift Bindings
on:
workflow_dispatch:
jobs:
build-macos:
runs-on: warp-macos-13-arm64-6x
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-ios
- x86_64-apple-ios
- aarch64-apple-ios-sim
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update rust toolchains, add target
run: |
rustup update
rustup target add ${{ matrix.target }}
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
bindings_ffi
- name: Install Cross
uses: taiki-e/install-action@cross
- name: Build target
env:
CROSS_NO_WARNINGS: "0"
IPHONEOS_DEPLOYMENT_TARGET: 10
run: |
cross build --release --target ${{ matrix.target }} --manifest-path bindings_ffi/Cargo.toml
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/libxmtpv3.a
retention-days: 1
swift:
runs-on: warp-macos-13-arm64-6x
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update rust toolchains, add target
run: |
rustup update
rustup target add x86_64-apple-darwin
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
bindings_ffi
- name: Install swift
run: brew install swiftformat
- name: Generate bindings
working-directory: bindings_ffi
run: |
make swift
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: swift
path: bindings_ffi/build/swift/
retention-days: 1
package-swift:
needs: [build-macos, swift]
runs-on: warp-macos-13-arm64-6x
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: bindings_ffi/build
- name: Build archive
working-directory: bindings_ffi
run: |
mkdir -p Sources/LibXMTP
mv build/swift/xmtpv3.swift Sources/LibXMTP/
make framework
cp ../LICENSE ./LICENSE
zip -r LibXMTPSwiftFFI.zip Sources LibXMTPSwiftFFI.xcframework LICENSE
- name: Calculate checksum
id: checksum
working-directory: bindings_ffi
run: |
echo "::set-output name=checksum::$(shasum -a 256 LibXMTPSwiftFFI.zip | awk '{ print $1 }')"
- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: swift-bindings-${{ steps.slug.outputs.sha7 }}
release_name: Swift-Bindings-${{ steps.slug.outputs.sha7 }}
body: "Checksum of LibXMTPSwiftFFI.zip: ${{ steps.checksum.outputs.checksum }}"
draft: false
prerelease: true
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bindings_ffi/LibXMTPSwiftFFI.zip
asset_name: LibXMTPSwiftFFI.zip
asset_content_type: application/zip