From c065a041b16de4bcb429892563fe6a5d695a33d8 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Sat, 14 Jan 2023 14:03:07 -0800 Subject: [PATCH] Add Documentation and a Swift Package Index Setup (#6) --- .spi.yml | 14 +++++++++++ README.md | 1 + .../TemplatePackage.docc/TemplatePackage.md | 23 +++++++++++++++++++ Sources/TemplatePackage/TemplatePackage.swift | 6 +++-- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .spi.yml create mode 100644 Sources/TemplatePackage/TemplatePackage.docc/TemplatePackage.md diff --git a/.spi.yml b/.spi.yml new file mode 100644 index 0000000..504bb5a --- /dev/null +++ b/.spi.yml @@ -0,0 +1,14 @@ +# +# This source file is part of the TemplatePackage open source project +# +# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +version: 1 +builder: + configs: + - platform: ios + documentation_targets: + - TemplatePackage diff --git a/README.md b/README.md index 3c0259b..a5aed72 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The template repository contains a template Swift Package, including a continuou 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. 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. 4. Adjust this README to describe your project and adjust the badges at the top to point to the correct GitHub Action of your repository and Codecov badge. +5. 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. ## Installation diff --git a/Sources/TemplatePackage/TemplatePackage.docc/TemplatePackage.md b/Sources/TemplatePackage/TemplatePackage.docc/TemplatePackage.md new file mode 100644 index 0000000..2417f3d --- /dev/null +++ b/Sources/TemplatePackage/TemplatePackage.docc/TemplatePackage.md @@ -0,0 +1,23 @@ +# ``TemplatePackage`` + + + +The template repository contains a template 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 + +- ``TemplatePackage`` diff --git a/Sources/TemplatePackage/TemplatePackage.swift b/Sources/TemplatePackage/TemplatePackage.swift index 4866c12..80038f2 100644 --- a/Sources/TemplatePackage/TemplatePackage.swift +++ b/Sources/TemplatePackage/TemplatePackage.swift @@ -6,8 +6,10 @@ // SPDX-License-Identifier: MIT // -struct TemplatePackage { - var stanford: String { +/// The main type of the Swift Package template. +public struct TemplatePackage { + /// The Swift Package template package is provided by Stanford University. + public var stanford: String { "Stanford University" } }