Skip to content

Commit

Permalink
Initial Setup (#1)
Browse files Browse the repository at this point in the history
# Initial Setup


## ⚙️ Release Notes 
- Initial Setup of the Spezi Medication Module


## 📝 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
PSchmiedmayer authored Nov 6, 2023
1 parent d020f4a commit f50274b
Show file tree
Hide file tree
Showing 31 changed files with 122 additions and 679 deletions.
55 changes: 11 additions & 44 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -18,65 +18,32 @@ on:
jobs:
packageios:
name: Build and Test Swift Package iOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
artifactname: TemplatePackage.xcresult
packagewatchos:
name: Build and Test Swift Package watchOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
scheme: TemplatePackage
resultBundle: TemplatePackageWatchOS.xcresult
destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)'
artifactname: TemplatePackageWatchOS.xcresult
packagevisionos:
name: Build and Test Swift Package visionOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
xcodeversion: latest
scheme: TemplatePackage
resultBundle: TemplatePackageVisionOS.xcresult
destination: 'platform=visionOS Simulator,name=Apple Vision Pro'
artifactname: TemplatePackageVisionOS.xcresult
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziMedication
artifactname: SpeziMedication.xcresult
ios:
name: Build and Test iOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
artifactname: TestApp.xcresult
ipados:
name: Build and Test iPadOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
runsonlabels: '["macOS", "self-hosted"]'
path: 'Tests/UITests'
scheme: TestApp
resultBundle: TestAppiPadOS.xcresult
destination: 'platform=iOS Simulator,name=iPad mini (6th generation)'
artifactname: TestAppiPadOS.xcresult
watchos:
name: Build and Test watchOS
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
path: 'Tests/UITests'
scheme: TestAppWatchApp
resultBundle: TestAppWatchApp.xcresult
destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm)'
artifactname: TestAppWatchApp.xcresult
codeql:
name: CodeQL
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
codeql: true
xcodeversion: '14.3.1'
scheme: TemplatePackage
permissions:
security-events: write
actions: read
uploadcoveragereport:
name: Upload Coverage Report
needs: [packageios, packagewatchos, packagevisionos, ios, ipados, watchos]
needs: [packageios, ios, ipados]
uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: TemplatePackage.xcresult TemplatePackageWatchOS.xcresult TemplatePackageVisionOS.xcresult TestApp.xcresult TestAppiPadOS.xcresult TestAppWatchApp.xcresult
coveragereports: SpeziMedication.xcresult TestApp.xcresult TestAppiPadOS.xcresult
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
4 changes: 2 additions & 2 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -11,4 +11,4 @@ builder:
configs:
- platform: ios
documentation_targets:
- TemplatePackage
- SpeziMedication
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand Down
10 changes: 3 additions & 7 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -12,9 +12,5 @@ authors:
- family-names: "Schmiedmayer"
given-names: "Paul"
orcid: "https://orcid.org/0000-0002-8607-9148"
- family-names: "Ravi"
given-names: "Vishnu"
orcid: "https://orcid.org/0000-0003-0359-1275"
title: "TemplatePackage"
doi: 10.5281/zenodo.7538165
url: "https://github.com/StanfordBDHG/SwiftPackageTemplate"
title: "SpeziMedication"
url: "https://github.com/StanfordSpezi/SwiftMedication"
5 changes: 2 additions & 3 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
Expand All @@ -10,8 +10,7 @@
-->

TemplatePackage contributors
SpeziMedication contributors
====================

* [Paul Schmiedmayer](https://github.com/PSchmiedmayer)
* [Vishnu Ravi](https://github.com/vishnuravi)
17 changes: 8 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// swift-tools-version:5.8
// swift-tools-version:5.9

//
// This source file is part of the TemplatePackage open source project
// This source file is part of the Stanford Spezi open-source project
//
// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
//
Expand All @@ -12,22 +12,21 @@ import PackageDescription


let package = Package(
name: "TemplatePackage",
name: "SpeziMedication",
platforms: [
.iOS(.v16),
.watchOS(.v9)
.iOS(.v16)
],
products: [
.library(name: "TemplatePackage", targets: ["TemplatePackage"])
.library(name: "SpeziMedication", targets: ["SpeziMedication"])
],
targets: [
.target(
name: "TemplatePackage"
name: "SpeziMedication"
),
.testTarget(
name: "TemplatePackageTests",
name: "SpeziMedicationTests",
dependencies: [
.target(name: "TemplatePackage")
.target(name: "SpeziMedication")
]
)
]
Expand Down
45 changes: 15 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
<!--
This source file is part of the TemplatePackage open source project
This source file is part of the Stanford Spezi open-source project
SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
SPDX-License-Identifier: MIT
-->

# TemplatePackage
# SpeziMedication

[![Build and Test](https://github.com/StanfordBDHG/SwiftPackageTemplate/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/StanfordBDHG/SwiftPackageTemplate/actions/workflows/build-and-test.yml)
[![codecov](https://codecov.io/gh/StanfordBDHG/SwiftPackageTemplate/branch/main/graph/badge.svg?token=X7BQYSUKOH)](https://codecov.io/gh/StanfordBDHG/SwiftPackageTemplate)
[![DOI](https://zenodo.org/badge/573230182.svg)](https://zenodo.org/badge/latestdoi/573230182)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FStanfordBDHG%2FSwiftPackageTemplate%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/StanfordBDHG/SwiftPackageTemplate)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FStanfordBDHG%2FSwiftPackageTemplate%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/StanfordBDHG/SwiftPackageTemplate)
[![Build and Test](https://github.com/StanfordSpezi/SwiftMedication/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/StanfordSpezi/SwiftMedication/actions/workflows/build-and-test.yml)
[![codecov](https://codecov.io/gh/StanfordSpezi/SpeziMedication/graph/badge.svg?token=aBD6XR6PDp)](https://codecov.io/gh/StanfordSpezi/SpeziMedication)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FStanfordSpezi%2FSpeziMedication%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/StanfordSpezi/SwiftMedication)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FStanfordSpezi%2FSpeziMedication%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/StanfordSpezi/SwiftMedication)


## How To Use This Template

The template repository contains a template Swift Package, including a continuous integration setup.

Follow these steps to customize it to your needs:
1. Rename the Swift Package. Be sure that you update the name in the `build-and-test.yml` GitHub Action accordingly. If you have multiple targets in your Swift Package, you need to pass the name of the Swift Package followed by an `-Package` as the scheme to the GitHub Action, e.g., `StanfordProject-Package` if your Swift Package is named `StanfordProject`.
2. If your Swift Package does not provide any user interface or does not require an iOS application environment to function, you can remove the `UITests` application from the `Tests` folder. You need to update the `build-and-test.yml` GitHub Action accordingly by removing the GitHub Action that builds and tests the application, removing the dependency from the code coverage upload step, and removing the UI test `.xresult` input from the code coverage test.
3. If your Swift Package uses UI test, you need to ...
- ... add it to the scheme editor (*Scheme > Edit Scheme*) and your targets to the "Build" configuration and ensure that it is built before the test app target when building for the "Test" configuration. It is not required to enable building for other configurations like "Analyze", "Run", "Profile", or "Archive".
- ... add it as a linked framework in the main target configuration (In your Xcode project settings, select your *test app target > General > Frameworks, Libraries, and Embedded Comments*).
- ... add ensure that the targets are all added in the code coverage settings of your .xctestplan file in the Xcode Project (*Shared Settings > Code Coverage > Code Coverage*).
4. You will either need to add the [CodeCov GitHub App](https://github.com/apps/codecov) or add a codecov.io token to your [GitHub Actions Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-an-environment) following the instructions of the [Codecov GitHub Action](https://github.com/marketplace/actions/codecov#usage). The StanfordBDHG organization already has the [CodeCov GitHub App](https://github.com/apps/codecov) installed. If you do not want to cover test coverage data, you can remove the code coverage job in the `build-and-test.yml` GitHub Action.
5. Adjust this README.md to describe your project and adjust the badges at the top to point to the correct GitHub Action of your repository and Codecov badge.
6. The Swift Package template includes a Swift Package Index configuration file to automatically build the package and [host the documentation on the Swift Package Index website](https://blog.swiftpackageindex.com/posts/auto-generating-auto-hosting-and-auto-updating-docc-documentation/). Adjust the `.spi.yml` file to include all targets that you want to build documentation for. You can follow the [instructions of the Swift Package Index](https://swiftpackageindex.com/add-a-package) to include your Swift Package in the Swift Package Index. You can link to the [API documentation](https://swiftpackageindex.com/StanfordBDHG/SwiftPackageTemplate/documentation) from your README file.
7. Adjust the CITATION.cff file to amend information about the new Swift Package ([learn more about CITATION files on GitHub](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files)) and [register the Swift Package on Zenodo](https://docs.github.com/en/repositories/archiving-a-github-repository/referencing-and-citing-content).
Show, edit, and manage medications including dosages and schedules.


## Installation
Expand All @@ -43,13 +27,14 @@ The project can be added to your Xcode project or Swift Package using the [Swift
**Swift Package:** You can follow the [Swift Package Manager documentation about defining dependencies](https://github.com/apple/swift-package-manager/blob/main/Documentation/Usage.md#defining-dependencies) to add this project as a dependency to your Swift Package.


## License
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordBDHG/TemplatePackage/tree/main/LICENSES) for more information.
## Contributing

Contributions to this project are welcome. Please make sure to read the [contribution guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md) and the [contributor covenant code of conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) first.


## License

## Contributors
This project is developed as part of the Stanford Byers Center for Biodesign at Stanford University.
See [CONTRIBUTORS.md](https://github.com/StanfordBDHG/TemplatePackage/tree/main/CONTRIBUTORS.md) for a full list of all TemplatePackage contributors.
This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordSpezi/Spezi/tree/main/LICENSES) for more information.

![Stanford Byers Center for Biodesign Logo](https://raw.githubusercontent.com/StanfordBDHG/.github/main/assets/biodesign-footer-light.png#gh-light-mode-only)
![Stanford Byers Center for Biodesign Logo](https://raw.githubusercontent.com/StanfordBDHG/.github/main/assets/biodesign-footer-dark.png#gh-dark-mode-only)
![Spezi Footer](https://raw.githubusercontent.com/StanfordSpezi/.github/main/assets/Footer.png#gh-light-mode-only)
![Spezi Footer](https://raw.githubusercontent.com/StanfordSpezi/.github/main/assets/Footer~dark.png#gh-dark-mode-only)
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# ``TemplatePackage``
# ``SpeziMedication``

<!--
#
# This source file is part of the TemplatePackage open source project
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#
-->

The template repository contains a template Swift Package, including a continuous integration setup.
The Spezi Medication repository contains a Spezi Medication Swift Package, including a continuous integration setup.

## Overview

Please follow the steps in the README.md file to customize the code to your needs.

## Types

### Template Package
### Spezi Medication

- ``TemplatePackage``
- ``SpeziMedication``
19 changes: 19 additions & 0 deletions Sources/SpeziMedication/SpeziMedication.swift
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: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//

/// The main type of the Spezi Medication package.
public struct SpeziMedication {
/// The Spezi Medication package package is provided by Stanford University.
public var stanford: String {
"Stanford University"
}


/// The main type of the Spezi Medication package.
public init() {}
}
19 changes: 0 additions & 19 deletions Sources/TemplatePackage/TemplatePackage.swift

This file was deleted.

18 changes: 18 additions & 0 deletions Tests/SpeziMedicationTests/SpeziMedicationTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// This source file is part of the Stanford Spezi open-source project
//
// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//

@testable import SpeziMedication
import XCTest


final class SpeziMedicationTests: XCTestCase {
func testSpeziMedication() throws {
let speziMedication = SpeziMedication()
XCTAssertEqual(speziMedication.stanford, "Stanford University")
}
}
18 changes: 0 additions & 18 deletions Tests/TemplatePackageTests/TemplatePackageTests.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Tests/UITests/TestApp.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"targets" : [
{
"containerPath" : "container:..\/..",
"identifier" : "TemplatePackage",
"name" : "TemplatePackage"
"identifier" : "SpeziMedication",
"name" : "SpeziMedication"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion Tests/UITests/TestApp.xctestplan.license
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This source file is part of the TemplatePackage open-source project
This source file is part of the Stanford Spezi open-source project

SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This source file is part of the TemplatePackage open-source project
This source file is part of the Stanford Spezi open-source project

SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This source file is part of the TemplatePackage open-source project
This source file is part of the Stanford Spezi open-source project

SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)

Expand Down
Loading

0 comments on commit f50274b

Please sign in to comment.