Skip to content

Commit

Permalink
Minor changes for Strict Concurrency (#4)
Browse files Browse the repository at this point in the history
# Minor changes for Strict Concurrency

## ♻️ Current situation & Problem
This PR slightly changes strict concurrency configuration to also
support Swift 6 environment and enables it for UI tests.


## ⚙️ Release Notes 
--


## 📚 Documentation
--

## ✅ Testing
-


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
Supereg authored Aug 13, 2024
1 parent d839e71 commit 2249ce6
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ jobs:
uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: SpeziLicense.xcresult TestApp.xcresult TestAppiPadOS.xcresult
secrets:
token: ${{ secrets.CODECOV_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/monthly-markdown-link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# This source file is part of the Stanford Spezi open source project
#
# SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

name: Monthly Markdown Link Check

on:
# Runs at midnight on the first of every month
schedule:
- cron: "0 0 1 * *"

jobs:
markdown_link_check:
name: Markdown Link Check
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ jobs:
swiftlint:
name: SwiftLint
uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2
markdown_link_check:
name: Markdown Link Check
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
44 changes: 35 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
// SPDX-License-Identifier: MIT
//

import class Foundation.ProcessInfo
import PackageDescription


#if swift(<6)
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("StrictConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("StrictConcurrency")
#endif


let package = Package(
name: "SpeziLicense",
defaultLocalization: "en",
Expand All @@ -21,20 +29,19 @@ let package = Package(
.library(name: "SpeziLicense", targets: ["SpeziLicense"])
],
dependencies: [
.package(
url: "https://github.com/FelixHerrmann/swift-package-list.git", from: "4.1.0"
),
.package(url: "https://github.com/StanfordSpezi/Spezi", from: "1.2.0")
],
.package(url: "https://github.com/FelixHerrmann/swift-package-list.git", from: "4.1.0"),
.package(url: "https://github.com/StanfordSpezi/Spezi", from: "1.6.0")
] + swiftLintPackage(),
targets: [
.target(
name: "SpeziLicense",
dependencies: [
.product(name: "SwiftPackageList", package: "swift-package-list")
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziLicenseTests",
Expand All @@ -43,8 +50,27 @@ let package = Package(
.product(name: "Spezi", package: "Spezi")
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
)
]
)


func swiftLintPlugin() -> [Target.PluginUsage] {
// Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app`
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
} else {
[]
}
}

func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
} else {
[]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Provides a view that renders a list of all package dependecies used in the proje

| ![Screenshot showing the ContributionsList.](Sources/SpeziLicense/SpeziLicense.docc/Resources/Overview.png#gh-light-mode-only) ![Screenshot showing the ContributionsList.](Sources/SpeziLicense/SpeziLicense.docc/Resources/Overview~dark.png#gh-dark-mode-only) |
|:---:|
| A [`ContributionsList`](https://swiftpackageindex.com/stanfordspezi/spezilicense/documentation/spezilicense/contactslist) rendered in the Spezi Template Application. |
| A [`ContributionsList`](https://swiftpackageindex.com/stanfordspezi/spezilicense/documentation/spezilicense/contributionslist) rendered in the Spezi Template Application. |

## Overview

Expand Down
11 changes: 7 additions & 4 deletions Tests/UITests/TestAppUITests/TestAppUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ class TestAppUITests: XCTestCase {
continueAfterFailure = false
}



@MainActor
func testSpeziLicense() throws {
let app = XCUIApplication()
app.launch()

XCTAssertTrue(app.wait(for: .runningForeground, timeout: 2.0))

XCTAssertTrue(app.staticTexts["This project is licensed under the MIT License."].waitForExistence(timeout: 2))
XCTAssertTrue(app.staticTexts["The following list contains all Swift Package dependencies of the TestApp app."].waitForExistence(timeout: 2))
XCTAssertTrue(app.buttons["Repository Link"].waitForExistence(timeout: 2))
XCTAssertTrue(app.staticTexts["Spezi"].waitForExistence(timeout: 2))
XCTAssertTrue(app.staticTexts["The following list contains all Swift Package dependencies of the TestApp app."].exists)
XCTAssertTrue(app.buttons["Repository Link"].exists)
XCTAssertTrue(app.staticTexts["Spezi"].exists)
}
}
3 changes: 3 additions & 0 deletions Tests/UITests/UITests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
};
name = Debug;
};
Expand Down Expand Up @@ -361,6 +362,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down Expand Up @@ -549,6 +551,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = TEST;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
};
name = Test;
};
Expand Down

0 comments on commit 2249ce6

Please sign in to comment.