Skip to content

Commit

Permalink
[CI] Add codecov support (#4)
Browse files Browse the repository at this point in the history
* Fix import issue

See more info here
swiftlang/swift#65849 (comment)

* FIx compile warning and add codecov support

* [NFC] Fix non-Darwin platform test issue
  • Loading branch information
Kyle-Ye committed Nov 5, 2023
1 parent 3e1b2fc commit dca046c
Show file tree
Hide file tree
Showing 41 changed files with 202 additions and 75 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/macos.yml
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:
macos_test:
name: Execute tests on macOS
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
xcode-version: "15.0" # Swift 5.9.0
runs-on: ${{ matrix.os }}
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: Build and run tests in debug mode with coverage
run: |
swift test \
-c debug \
-Xswiftc -warnings-as-errors \
--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/OpenSwiftUIPackageTests.xctest/Contents/MacOS/OpenSwiftUIPackageTests \
> coverage.txt
- name: Build and run tests in debug mode with TSan
run: |
swift test \
-c debug \
--sanitize thread \
-Xswiftc -warnings-as-errors \
--build-path .build-test-debug-sanitize-thread
- name: Build and run tests in release mode
run: |
swift test \
-c release \
-Xswiftc -warnings-as-errors \
--enable-code-coverage \
--build-path .build-test-release
- uses: codecov/codecov-action@v3
with:
verbose: true
45 changes: 45 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Ubuntu

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
ubuntu_test:
name: Execute tests on Ubuntu
strategy:
fail-fast: false
matrix:
swift_version: ["5.9.1"]
runs-on: ubuntu-22.04
container: swift:${{ matrix.swift_version }}-jammy
steps:
- uses: actions/checkout@v4
- name: Building and running tests in debug mode with coverage
run: |
swift test \
-c debug \
-Xswiftc -warnings-as-errors \
--enable-code-coverage \
--build-path .build-test-debug
llvm-cov show \
-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 \
-c release \
-Xswiftc -warnings-as-errors \
--build-path .build-test-release
- uses: codecov/codecov-action@v3
with:
verbose: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
/.build-test-debug
/.build-test-release
/.build-test-debug-sanitize-thread
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let openSwiftUITarget = Target.target(
"OpenSwiftUIShims",
],
swiftSettings: [
.unsafeFlags(["-enable-library-evolution"]),
.enableExperimentalFeature("AccessLevelOnImport"),
]
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// EnvironmentValues+controlSize.swift
// OpenSwiftUI
//
// Created by Kyle on 2023/11/5.
// Lastest Version: iOS 15.5
// Status: Complete
// ID: 50E368DED9ACE8B6BEC08FF7781AF4B1

private struct ControlSizeKey: EnvironmentKey {
static let defaultValue: ControlSize = .regular
}

extension EnvironmentValues {
@inline(__always)
public var controlSize: ControlSize {
get { self[ControlSizeKey.self] }
set { self[ControlSizeKey.self] = newValue }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// EnabledKey.swift
// EnvironmentValues+isEnabled.swift
// OpenSwiftUI
//
// Created by Kyle on 2023/10/9.
Expand Down
2 changes: 0 additions & 2 deletions Sources/OpenSwiftUI/DataAndStorage/Internal/Boxes/Box.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation

final class Box<A> {
let value: A

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation

struct HashableWeakBox<A: AnyObject>: Hashable {
weak var base: A?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation

struct Indirect<A> {
var box : MutableBox<A>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation

@propertyWrapper
final class MutableBox<A> {
var value: A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation

struct WeakBox<A: AnyObject> {
weak var base: A?
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// Status: WIP
// ID: 387C753F3FFD2899BCB77252214CFCC6

import Foundation

//private struct SystemColorSchemeModifier {}

private struct ColorSchemeKey: EnvironmentKey {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: TODO

import Foundation

class LocationBox<L: Location>: AnyLocation<L.Value> {
var location: L
@UnsafeLockedPointer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// Status: Empty
// ID: 5A9440699EF65619D72

import Foundation

private struct ProjectedLocation {}

struct LocationProjectionCache {}
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/DataAndStorage/Internal/UniqueID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
// Status: Complete

#if OPENSWIFTUI_USE_AG
@_implementationOnly import AttributeGraph
internal import AttributeGraph
#else
@_implementationOnly import OpenGraph
internal import OpenGraph
#endif

struct UniqueID: Hashable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Lastest Version: iOS 15.5
// Status: Blocked by StoredLocationBase

@_implementationOnly import OpenSwiftUIShims
internal import OpenSwiftUIShims

// TODO: caller StoredLocationBase
@propertyWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: WIP

import Foundation

extension View {
/// Sets a value for the given preference.
@inlinable
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUI/GraphShims.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if OPENSWIFTUI_USE_AG
@_implementationOnly import AttributeGraph
internal import AttributeGraph

typealias OGAttribute = AGAttribute
typealias OGUniqueID = AGUniqueID
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUI/Internal/Log/Log.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public let dso = { () -> UnsafeMutableRawPointer in
}()
#endif
#else
@_implementationOnly import Logging
internal import Logging
#endif

enum Log {
Expand Down
2 changes: 0 additions & 2 deletions Sources/OpenSwiftUI/Internal/Other/Time.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation

struct Time: Comparable, Hashable {
var seconds : Double

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Lastest Version: iOS 15.5
// Status: Complete

@_implementationOnly import OpenSwiftUIShims
internal import OpenSwiftUIShims

protocol SemanticFeature: Feature {
static var introduced: Semantics { get }
Expand Down
3 changes: 1 addition & 2 deletions Sources/OpenSwiftUI/Internal/Semantic/Semantics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// Lastest Version: iOS 15.5
// Status: Complete

import Foundation
@_implementationOnly import OpenSwiftUIShims
internal import OpenSwiftUIShims

struct Semantics: CustomStringConvertible, Comparable, Hashable {
var description: String {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUI/Shims/LockedPointer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Lastest Version: iOS 15.5
// Status: Complete

@_implementationOnly import OpenSwiftUIShims
internal import OpenSwiftUIShims

extension LockedPointer {
@_transparent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Status: Complete
// ID: 6C985860B64B768EC9A2691B5DBA71A0

@_implementationOnly import OpenSwiftUIShims
internal import OpenSwiftUIShims

extension View {
func buttonDefaultRenderingMode() -> some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ private struct BorderlessButtonStyleBase: ButtonStyle {
// @Environment(\.keyboardShortcut)
// private var keyboardShortcut: KeyboardShortcut?
//
// @Environment(\.controlSize)
// private var controlSize: ControlSize
//
@Environment(\.controlSize)
private var controlSize: ControlSize

@Environment(\.isEnabled)
private var isEnable: Bool

Expand All @@ -63,7 +63,6 @@ private struct BorderlessButtonStyleBase: ButtonStyle {
}

private var defaultFont: Font {
let controlSize = ControlSize.regular
let style: Font.TextStyle = switch controlSize {
case .mini: .subheadline
case .small: .subheadline
Expand Down
4 changes: 4 additions & 0 deletions Sources/OpenSwiftUI/UIElements/Font/TODO/Font.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#if canImport(Darwin)
import CoreGraphics
#elseif os(Linux)
import Foundation
#endif

@frozen
public struct Font: Hashable {
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/UIElements/Graph/TODO/_GraphInputs.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if OPENSWIFTUI_USE_AG
@_implementationOnly import AttributeGraph
internal import AttributeGraph
#else
@_implementationOnly import OpenGraph
internal import OpenGraph
#endif

public struct _GraphInputs {
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/UIElements/Graph/TODO/_GraphValue.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if OPENSWIFTUI_USE_AG
@_implementationOnly import AttributeGraph
internal import AttributeGraph
#else
@_implementationOnly import OpenGraph
internal import OpenGraph
#endif

public struct _GraphValue<Value> {
Expand Down
2 changes: 0 additions & 2 deletions Sources/OpenSwiftUI/UIElements/Text/TODO/AnyTextStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// Lastest Version: iOS 15.5
// Status: Empty

import Foundation

@usableFromInline
class AnyTextStorage {
/*@objc*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ID: 5A14269649C60F846422EA0FA4C5E535

import Foundation
@_implementationOnly import OpenSwiftUIShims
internal import OpenSwiftUIShims

// MARK: _ViewDebug

Expand Down Expand Up @@ -114,11 +114,11 @@ extension _ViewDebug {
// TODO
// Mirror API
private func serializedAttribute(for value: Any, label: String?, reflectionDepth depth: Int) -> SerializedAttribute? {
let unwrapped = unwrapped(value)
// let unwrapped = unwrapped(value)

return nil

let mirror = Mirror(reflecting: value)
// let mirror = Mirror(reflecting: value)
// mirror.displayStyle = .tuple

}
Expand Down
Loading

0 comments on commit dca046c

Please sign in to comment.