-
Notifications
You must be signed in to change notification settings - Fork 14
137 lines (131 loc) · 4.7 KB
/
ci.yaml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
automerge-dependencies:
runs-on: macos-14
env:
LOCAL_BUILD: true
DEVELOPER_DIR: /Applications/Xcode_15.4.app
concurrency:
group: automerge-dependencies-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Cache Automerge XCFramework and library
id: cache-automerge
uses: actions/cache@v4
with:
path: |
automergeFFI.xcframework
automergeFFI.xcframework.zip
libuniffi_automerge.a
libuniffi_automerge_threads.a
key: automerge-dependencies-{{ hashFiles(AutomergeUniffi/automerge.swift) }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
default: true
- name: Build Automerge XCFramework and library
if: steps.cache-automerge.outputs.cache-hit != 'true'
run: ./scripts/build-xcframework.sh
- name: Compress Automerge XCFramework
if: steps.cache-automerge.outputs.cache-hit != 'true'
run: ./scripts/compress-framework.sh
- uses: actions/upload-artifact@v4
with:
name: libuniffi_automerge
path: |
libuniffi_automerge.a
libuniffi_automerge_threads.a
test-automerge-swift:
runs-on: macos-14
needs: automerge-dependencies
steps:
- uses: actions/checkout@v4
- name: Restore Automerge XCFramework and library
uses: actions/cache/restore@v4
with:
path: |
automergeFFI.xcframework
automergeFFI.xcframework.zip
libuniffi_automerge.a
libuniffi_automerge_threads.a
key: automerge-dependencies-{{ hashFiles(AutomergeUniffi/automerge.swift) }}
- name: Get swift version
run: swift --version
- name: Swift tests
run: swift test
test-automerge-wasm:
runs-on: ubuntu-latest
needs: automerge-dependencies
strategy:
matrix:
include:
- toolchain: swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a
swift-sdk: swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a
checksum: 229cd9d3b0ed582c7ef7c3064888ad78764e4743b5a770df92554a94513f53fb
steps:
- uses: actions/checkout@v4
- uses: bytecodealliance/actions/wasmtime/setup@v1
- name: Restore Automerge XCFramework and library
uses: actions/cache/restore@v4
with:
path: |
automergeFFI.xcframework
automergeFFI.xcframework.zip
libuniffi_automerge.a
libuniffi_automerge_threads.a
key: automerge-dependencies-{{ hashFiles(AutomergeUniffi/automerge.swift) }}
- name: Cache SDK for WebAssembly
id: cache-wasm-sdk
uses: actions/cache@v4
with:
path: /tmp/swift-sdk.tar.gz
key: wasm-sdk-${{ matrix.checksum }}
- name: Download SDK for WebAssembly
if: steps.cache-wasm-sdk.outputs.cache-hit != 'true'
run: |
SWIFT_TOOLCHAIN_TAG="${{ matrix.toolchain }}"
set -ex
curl -f -o /tmp/swift-sdk.tar.gz "https://download.swift.org/development/ubuntu2204/$SWIFT_TOOLCHAIN_TAG/$SWIFT_TOOLCHAIN_TAG-ubuntu22.04.tar.gz"
- name: Install Swift and Swift SDK for WebAssembly
run: |
PREFIX=/opt/swift
SWIFT_SDK_TAG="${{ matrix.swift-sdk }}"
set -ex
sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift-sdk.tar.gz -C $PREFIX --strip-component 1
$PREFIX/usr/bin/swift sdk install "https://github.com/swiftwasm/swift/releases/download/$SWIFT_SDK_TAG/$SWIFT_SDK_TAG-wasm32-unknown-wasi.artifactbundle.zip" --checksum ${{ matrix.checksum }}
echo "$PREFIX/usr/bin" >> $GITHUB_PATH
- name: Build tests
run: swift build --swift-sdk wasm32-unknown-wasi --build-tests -Xlinker "`pwd`/libuniffi_automerge.a" -Xlinker -z -Xlinker stack-size=$((1024 * 1024))
- name: Run tests
run: wasmtime run --wasm max-wasm-stack=$((1024 * 1024)) --dir . .build/debug/AutomergePackageTests.wasm
rustfmt:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
default: true
components: rustfmt
- name: Clippy
run: ./scripts/ci/rustfmt.sh
clippy:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
default: true
components: clippy
- name: Clippy
run: ./scripts/ci/clippy.sh