Skip to content

Commit

Permalink
Fix CI issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Dec 29, 2023
1 parent de027a8 commit 26b25bc
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 36 deletions.
41 changes: 23 additions & 18 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
include:
- os: macos-13
xcode-version: "15.0" # Swift 5.9.0
xcode-version: "15.1" # Swift 5.9.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -28,20 +28,25 @@ jobs:
run: |
xcodebuild build \
-scheme OpenSwiftUI \
-configuration Release \
-sdk iphonesimulator \
-destination "platform=iOS Simulator" \
-derivedDataPath .build-release-iOS
# OTHER_SWIFT_FLAGS="-warnings-as-errors" \ OpenCombine will emit warning in xcodebuild

# Test is currently not supported due to the link issue to PrivateFramework
# - name: Build and run tests in release mode
# run: |
# xcodebuild build \
# -scheme OpenSwiftUI \
# -configuration Release \
# -sdk iphonesimulator \
# -destination "platform=iOS Simulator" \
# -enableCodeCoverage YES \
# OTHER_SWIFT_FLAGS="-warnings-as-errors" \
# -derivedDataPath .build-test-debug
-configuration Debug \
-destination "platform=iOS-Simulator" \
-derivedDataPath .build-test-debug
# OpenSwiftUI-Package is not listed currently
# OTHER_SWIFT_FLAGS="-warnings-as-errors" \ AccessLevelOnImport will cause build warning via xcodebuild
env:
OPENSWIFTUI_ATTRIBUTEGRAPH: 0
# Test is currently not supported due to the link issue to PrivateFramework
# - name: Build and run tests in debug mode with coverage
# run: |
# xcodebuild test \
# -scheme OpenSwiftUI-Package \
# -configuration Debug \
# -destination "platform=iOS-Simulator" \
# -enableCodeCoverage=YES \
# -derivedDataPath .build-test-debug
# # OTHER_SWIFT_FLAGS="-warnings-as-errors"
# profdata_file_path=$(find . -path "*.build-test-debug/Build/ProfileData*Coverage.profdata" -type f)
# xcrun llvm-cov show \
# -instr-profile=$profdata_file_path \
# .build-test-debug/Build/Products/Debug/OpenSwiftUITests.xctest/Contents/MacOS/OpenSwiftUITests \
# > coverage.txt
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
include:
- os: macos-13
xcode-version: "15.0" # Swift 5.9.0
xcode-version: "15.1" # Swift 5.9.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["5.9.1"]
swift_version: ["5.9.2"]
runs-on: ubuntu-22.04
container: swift:${{ matrix.swift_version }}-jammy
steps:
Expand All @@ -28,12 +28,6 @@ jobs:
-instr-profile=.build-test-debug/debug/codecov/default.profdata \
.build-test-debug/debug/OpenSwiftUIPackageTests.xctest \
> coverage.txt
- name: Building and running tests in debug mode with TSan
run: |
swift test \
-c debug \
--sanitize thread \
--build-path .build-test-debug-sanitize-thread
- name: Building and running tests in release mode
run: |
swift test \
Expand All @@ -42,4 +36,5 @@ jobs:
--build-path .build-test-release
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
/.build-test-debug
/.build-test-release
/.build-test-debug-sanitize-thread
/.build-*
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"revision" : "4adbc0e5d44f1a5861a97b942d903635e25c9e00",
"version" : "0.0.1"
"branch" : "main",
"revision" : "6835ce0972f40ef76f1214dc0efc75ec19082631"
}
}
],
Expand Down
12 changes: 7 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ let isXcodeEnv = ProcessInfo.processInfo.environment["__CFBundleIdentifier"] ==
// Xcode use clang as linker which supports "-iframework" while SwiftPM use swiftc as linker which supports "-Fsystem"
let systemFrameworkSearchFlag = isXcodeEnv ? "-iframework" : "-Fsystem"

// https://github.com/llvm/llvm-project/issues/48757
let clangEnumFixSetting = CSetting.unsafeFlags(["-Wno-elaborated-enum-base"], .when(platforms: [.linux]))

let openSwiftUITarget = Target.target(
name: "OpenSwiftUI",
dependencies: [
Expand Down Expand Up @@ -60,7 +57,8 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/OpenSwiftUIProject/OpenFoundation", from: "0.0.1"),
.package(url: "https://github.com/OpenSwiftUIProject/OpenGraph", from: "0.0.1"),
// FIXME: on Linux platform: OG contains unsafe build flags which prevents us using version dependency
.package(url: "https://github.com/OpenSwiftUIProject/OpenGraph", branch: "main"),
],
targets: [
// TODO: Add SwiftGTK as an backend alternative for UIKit/AppKit on Linux and macOS
Expand Down Expand Up @@ -107,9 +105,13 @@ if attributeGraphCondition {
openSwiftUITarget.dependencies.append(
.product(name: "AttributeGraph", package: "OpenGraph")
)
var swiftSettings: [SwiftSetting] = (openSwiftUITarget.swiftSettings ?? [])
var swiftSettings = openSwiftUITarget.swiftSettings ?? []
swiftSettings.append(.define("OPENSWIFTUI_ATTRIBUTEGRAPH"))
openSwiftUITarget.swiftSettings = swiftSettings
var linkerSettings = openSwiftUITarget.linkerSettings ?? []
linkerSettings.append(.unsafeFlags([systemFrameworkSearchFlag, "/System/Library/PrivateFrameworks/"], .when(platforms: [.macOS])))
linkerSettings.append(.linkedFramework("AttributeGraph", .when(platforms: [.macOS])))
openSwiftUITarget.linkerSettings = linkerSettings
} else {
openSwiftUITarget.dependencies.append(
.product(name: "OpenGraph", package: "OpenGraph")
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

OpenSwiftUI is an open source implementation of Apple's [SwiftUI](https://developer.apple.com/documentation/swiftui)

| **CI Status** |
|---|
|[![Compatibility tests](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/compatibility_tests.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/compatibility_tests.yml)|
|[![macOS](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/macos.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/macos.yml)|
|[![iOS](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/ios.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/ios.yml)|
|[![Ubuntu](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/OpenSwiftUIProject/OpenSwiftUI/actions/workflows/ubuntu.yml)|

The project is for the following purposes:
- Build GUI app on non-Apple platform (eg. Linux & Windows)
- Diagnose and debug SwfitUI issues on Apple platform
Expand Down

0 comments on commit 26b25bc

Please sign in to comment.