Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-and-test:
name: Build and test
runs-on: macos-26
timeout-minutes: 45
env:
DEVELOPER_DIR: /Applications/Xcode_26.5.app/Contents/Developer

steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Show build environment
run: |
sw_vers
xcodebuild -version

- name: Resolve package dependencies
run: |
xcodebuild \
-project VirtualBuddy.xcodeproj \
-resolvePackageDependencies

- name: Build products
run: |
for scheme in VirtualBuddy VirtualBuddyGuest vctool; do
xcodebuild \
-project VirtualBuddy.xcodeproj \
-scheme "$scheme" \
-configuration Debug \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath "$RUNNER_TEMP/VirtualBuddyDerivedData" \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
build
done

- name: Run tests
run: |
xcodebuild \
-project VirtualBuddy.xcodeproj \
-scheme VirtualWormhole \
-configuration Debug \
-destination "platform=macOS,arch=arm64" \
-derivedDataPath "$RUNNER_TEMP/VirtualBuddyDerivedData" \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
test
8 changes: 6 additions & 2 deletions VirtualWormholeTests/WormholePacketTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ final class WormholePacketTests: XCTestCase {
let packet = try WormholePacket(payload)
let data = try packet.encoded()

XCTAssertEqual(data.hexDump, "CAFEF00D546573745061796C6F6164003A000000000000007B226D657373616765223A2248656C6C6F2C20576F726C6421222C226E756D626572223A34322C2264617461223A227172764D3365375C2F227D")
XCTAssertEqual(data.prefix(24).hexDump, "CAFEF00D546573745061796C6F6164003A00000000000000")

let decodedPacket = try WormholePacket.decode(from: data)
let decodedPayload = try JSONDecoder().decode(TestPayload.self, from: decodedPacket.payload)
XCTAssertEqual(decodedPayload, payload)
}

func testPacketDecodingWithTestPayload() throws {
Expand Down Expand Up @@ -81,7 +85,7 @@ final class WormholePacketTests: XCTestCase {

}

struct TestPayload: Codable {
struct TestPayload: Codable, Equatable {
var message = "Hello, World!"
var number = 42
var data = Data([0xAA,0xBB,0xCC,0xDD,0xEE,0xFF])
Expand Down