-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f4347db
Showing
16 changed files
with
1,077 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Compatibility tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
compatibility_tests_macos: | ||
name: Execute compatibility tests for macOS | ||
strategy: | ||
matrix: | ||
os: [macos-15] | ||
xcode-version: ["16.0"] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Run compatibility tests | ||
run: | | ||
./Scripts/patch_sdk.sh macosx SwiftUICore ./SDKPatches/patch.swiftinterface | ||
swift test | ||
./Scripts/unpatch_sdk.sh macosx SwiftUICore ./SDKPatches/patch.swiftinterface | ||
compatibility_tests_ios: | ||
name: Execute compatibility tests for iOS | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-15] | ||
xcode-version: ["16.0"] | ||
ios-version: ["18.0"] | ||
ios-simulator-name: ["iPhone 16 Pro"] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Run compatibility tests | ||
run: | | ||
./Scripts/patch_sdk.sh iphonesimulator SwiftUICore ./SDKPatches/patch.swiftinterface | ||
xcodebuild test \ | ||
-scheme UnsafeHeterogeneousBuffer \ | ||
-configuration Debug \ | ||
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" | ||
./Scripts/unpatch_sdk.sh iphonesimulator SwiftUICore ./SDKPatches/patch.swiftinterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: iOS | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
ios_test: | ||
name: Execute tests on iOS | ||
strategy: | ||
matrix: | ||
os: [macos-15] | ||
xcode-version: [16.0] | ||
ios-version: ["18.0"] | ||
ios-simulator-name: ["iPhone 16 Pro"] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST: 0 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Swift version | ||
run: swift --version | ||
- name: Run test target in debug mode | ||
run: | | ||
xcodebuild test \ | ||
-scheme UnsafeHeterogeneousBuffer \ | ||
-configuration Debug \ | ||
-destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: macOS | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
name: Build XCFramework | ||
runs-on: macos-15 | ||
env: | ||
PRODUCT_NAME: UnsafeHeterogeneousBuffer | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: 16.0 | ||
- name: Build XCFramework | ||
run: ./Scripts/build_xcframework.sh | ||
macos_test: | ||
name: Execute tests on macOS | ||
strategy: | ||
matrix: | ||
os: [macos-15] | ||
xcode-version: [16.0] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST: 0 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Xcode | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: ${{ matrix.xcode-version }} | ||
- name: Build and run tests in debug mode with coverage | ||
run: | | ||
swift test \ | ||
-c debug \ | ||
--enable-code-coverage \ | ||
--build-path .build-test-debug | ||
xcrun llvm-cov show \ | ||
-instr-profile=.build-test-debug/debug/codecov/default.profdata \ | ||
.build-test-debug/debug/UnsafeHeterogeneousBufferPackageTests.xctest/Contents/MacOS/UnsafeHeterogeneousBufferPackageTests \ | ||
> coverage.txt | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
file: ./coverage.txt | ||
flags: unittests | ||
verbose: true | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Ubuntu | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
ubuntu_test: | ||
name: Execute tests on Ubuntu | ||
strategy: | ||
matrix: | ||
swift_version: ["6.0.1"] | ||
runs-on: ubuntu-22.04 | ||
env: | ||
UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST: 0 | ||
container: swift:${{ matrix.swift_version }}-jammy | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Test | ||
run: | | ||
swift test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Kyle-Ye | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// swift-tools-version: 6.0 | ||
|
||
import PackageDescription | ||
|
||
func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool { | ||
guard let value = Context.environment[key] else { | ||
return defaultValue | ||
} | ||
if value == "1" { | ||
return true | ||
} else if value == "0" { | ||
return false | ||
} else { | ||
return defaultValue | ||
} | ||
} | ||
|
||
let testTarget = Target.testTarget(name: "UnsafeHeterogeneousBufferTests") | ||
var platforms: [SupportedPlatform]? | ||
|
||
let compatibilityTestCondition = envEnable("UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST") | ||
if compatibilityTestCondition { | ||
var swiftSettings: [SwiftSetting] = (testTarget.swiftSettings ?? []) | ||
swiftSettings.append(.define("UNSAFEHETEROGENEOUSBUFFER_SWIFTUI_COMPATIBILITY_TEST")) | ||
testTarget.swiftSettings = swiftSettings | ||
platforms = [.iOS(.v18), .macOS(.v15), .tvOS(.v18), .watchOS(.v11), .visionOS(.v2)] | ||
} else { | ||
testTarget.dependencies.append("UnsafeHeterogeneousBuffer") | ||
} | ||
|
||
let libraryType: Product.Library.LibraryType? | ||
switch Context.environment["UNSAFEHETEROGENEOUSBUFFER_LIBRARY_TYPE"] { | ||
case "dynamic": | ||
libraryType = .dynamic | ||
case "static": | ||
libraryType = .static | ||
default: | ||
libraryType = nil | ||
} | ||
|
||
let package = Package( | ||
name: "UnsafeHeterogeneousBuffer", | ||
platforms: platforms, | ||
products: [ | ||
.library(name: "UnsafeHeterogeneousBuffer", type: libraryType, targets: ["UnsafeHeterogeneousBuffer"]), | ||
], | ||
targets: [ | ||
.target( | ||
name: "UnsafeHeterogeneousBuffer", | ||
swiftSettings: [ | ||
.enableUpcomingFeature("InternalImportsByDefault"), | ||
] | ||
), | ||
testTarget, | ||
] | ||
) |
Oops, something went wrong.