Skip to content

Commit

Permalink
ci: split dependencies from job of running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelangel-dev committed Oct 21, 2024
1 parent 8671519 commit ee3ef15
Showing 1 changed file with 41 additions and 49 deletions.
90 changes: 41 additions & 49 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,67 @@ on:
branches: [main]

jobs:
build-test:

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@v3
- 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.78.0
toolchain: 1.81.0
default: true
- name: get xcode information
run: |
xcodebuild -version
swift --version
- name: build xcframework
- name: Build Automerge XCFramework and library
if: steps.cache-automerge.outputs.cache-hit != 'true'
run: ./scripts/build-xcframework.sh
- name: compress framework
- name: Compress Automerge XCFramework
if: steps.cache-automerge.outputs.cache-hit != 'true'
run: ./scripts/compress-framework.sh
- name: Swift tests
run: swift test

wasm:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- toolchain: swift-DEVELOPMENT-SNAPSHOT-2024-10-08-a
swift-sdk: swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-15-a
checksum: e27d5df268cc9ecab2f5bca8ca693c8b684015de60593e1d472a78ce28ed9283
test-automerge-swift:
runs-on: macos-14
needs: automerge-dependencies
env:
LOCAL_BUILD: true
DEVELOPER_DIR: /Applications/Xcode_15.4.app
steps:
- uses: actions/checkout@v4
- uses: bytecodealliance/actions/wasmtime/setup@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.80.0
default: true
- run: rustup target add wasm32-wasip1-threads
- name: Install Swift and Swift SDK for WebAssembly
run: |
PREFIX=/opt/swift
SWIFT_TOOLCHAIN_TAG="${{ matrix.toolchain }}"
SWIFT_SDK_TAG="${{ matrix.swift-sdk }}"
set -ex
curl -f -o /tmp/swift.tar.gz "https://download.swift.org/development/ubuntu2204/$SWIFT_TOOLCHAIN_TAG/$SWIFT_TOOLCHAIN_TAG-ubuntu22.04.tar.gz"
sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift.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-wasip1-threads.artifactbundle.zip" --checksum ${{ matrix.checksum }}
echo "$PREFIX/usr/bin" >> $GITHUB_PATH
#- run: cargo build --manifest-path rust/Cargo.toml --target wasm32-wasip1-threads --release
- run: scripts/ci/wasi-regen-swift.sh
- uses: actions/upload-artifact@v4
- name: Restore Automerge XCFramework and library
uses: actions/cache/restore@v4
with:
name: libuniffi_automerge-wasm32-wasip1-threads.a
path: ./rust/target/wasm32-wasip1-threads/release/libuniffi_automerge.a
- name: Build tests
run: swift build --swift-sdk wasm32-unknown-wasip1-threads --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)) --wasm threads --wasi threads --dir . .build/debug/AutomergePackageTests.wasm
path: |
automergeFFI.xcframework
automergeFFI.xcframework.zip
libuniffi_automerge.a
libuniffi_automerge_threads.a
key: automerge-dependencies-{{ hashFiles(AutomergeUniffi/automerge.swift) }}
- name: Swift tests
run: swift test

rustfmt:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78.0
toolchain: 1.81.0
default: true
components: rustfmt
- name: Clippy
Expand All @@ -83,11 +75,11 @@ jobs:
clippy:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.78.0
toolchain: 1.81.0
default: true
components: clippy
- name: Clippy
Expand Down

0 comments on commit ee3ef15

Please sign in to comment.