-
Notifications
You must be signed in to change notification settings - Fork 44
103 lines (103 loc) · 3.27 KB
/
release-swift-bindings-nix.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
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: Install Nix
uses: cachix/install-nix-action@v30
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Build target
run: |
nix develop --command \
cargo 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
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: |
.
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Generate bindings
working-directory: bindings_ffi
run: |
nix develop ./../ --command 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 "checksum=$(shasum -a 256 "LibXMTPSwiftFFI.zip" | awk '{ print $1 }')" >> "$GITHUB_OUTPUT"
- name: Get short SHA
id: slug
run: echo "sha7=$(echo "$GITHUB_SHA" | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: Create release and upload asset
uses: softprops/action-gh-release@v2
with:
files: ./bindings_ffi/LibXMTPSwiftFFI.zip
tag_name: swift-bindings-${{ steps.slug.outputs.sha7 }}
name: Swift-Bindings-${{ steps.slug.outputs.sha7 }}
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}