diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml new file mode 100644 index 0000000..a4804b9 --- /dev/null +++ b/.github/workflows/api.yml @@ -0,0 +1,23 @@ +name: API Check + +on: + pull_request: + branches: + - main + +jobs: + API-Check: + name: Diagnose API Breaking Changes + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout Source + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Mark Workspace As Safe + # https://github.com/actions/checkout/issues/766 + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + - name: Diagnose API Breaking Changes + run: | + swift package diagnose-api-breaking-changes origin/main --products WebPush diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ef03e0f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Test WebPush + +on: + pull_request: + branches: + - main + +jobs: + Test-Release: + name: "Test Release" + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout Source + uses: actions/checkout@v3 + - name: Build + run: | + swift build --build-tests --configuration release -Xswiftc -enable-testing -Xswiftc -warnings-as-errors -Xcc -Werror + - name: Run Tests + run: | + swift test --skip-build --configuration release + + Test-Debug: + name: "Test Debug" + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout Source + uses: actions/checkout@v3 + - name: Build + run: | + swift build --build-tests --configuration debug -Xswiftc -enable-testing -Xswiftc -warnings-as-errors -Xcc -Werror + - name: Run Tests + run: | + swift test --skip-build --configuration debug diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47bd4c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +xcuserdata/ +DerivedData/ +.swiftpm/configuration/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc +Package.resolved diff --git a/.spi.yml b/.spi.yml new file mode 100644 index 0000000..a00ad8a --- /dev/null +++ b/.spi.yml @@ -0,0 +1,4 @@ +version: 1 +builder: + configs: + - documentation_targets: [WebPush] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..967d101 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Mochi Development, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..d913c7a --- /dev/null +++ b/Package.swift @@ -0,0 +1,27 @@ +// swift-tools-version: 6.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "swift-webpush", + platforms: [ + .macOS(.v13), + .iOS(.v15), + .tvOS(.v15), + .watchOS(.v8), + ], + products: [ + .library(name: "WebPush", targets: ["WebPush"]), + ], + dependencies: [ + ], + targets: [ + .target( + name: "WebPush", + dependencies: [ + ] + ), + .testTarget(name: "WebPushTests", dependencies: ["WebPush"]), + ] +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..78c9c61 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# WebPush + +

+ + + + + + + + Test Status + +

+ +A server-side Swift implementation of the WebPush standard. + +## Quick Links + +- [Documentation](https://swiftpackageindex.com/mochidev/WebPush/documentation) +- [Updates on Mastodon](https://mastodon.social/tags/SwiftWebPush) + +## Installation + +Add `WebPush` as a dependency in your `Package.swift` file to start using it. Then, add `import WebPush` to any file you wish to use the library in. + +Please check the [releases](https://github.com/mochidev/WebPush/releases) for recommended versions. + +```swift +dependencies: [ + .package( + url: "https://github.com/mochidev/WebPush.git", + .upToNextMinor(from: "0.0.1") + ), +], +... +targets: [ + .target( + name: "MyPackage", + dependencies: [ + "WebPush", + ] + ) +] +``` + +## Usage + +TBD + +## Contributing + +Contribution is welcome! Please take a look at the issues already available, or start a new discussion to propose a new feature. Although guarantees can't be made regarding feature requests, PRs that fit within the goals of the project and that have been discussed beforehand are more than welcome! + +Please make sure that all submissions have clean commit histories, are well documented, and thoroughly tested. **Please rebase your PR** before submission rather than merge in `main`. Linear histories are required, so merge commits in PRs will not be accepted. + +## Support + +To support this project, consider following [@dimitribouniol](https://mastodon.social/@dimitribouniol) on Mastodon, listening to Spencer and Dimitri on [Code Completion](https://mastodon.social/@codecompletion), or downloading Linh and Dimitri's apps: +- [Not Phở](https://notpho.app/) +- [Jiiiii](https://jiiiii.moe/) diff --git a/Sources/WebPush/WebPushManager.swift b/Sources/WebPush/WebPushManager.swift new file mode 100644 index 0000000..45e5b0c --- /dev/null +++ b/Sources/WebPush/WebPushManager.swift @@ -0,0 +1,8 @@ +// +// WebPushManager.swift +// swift-webpush +// +// Created by Dimitri Bouniol on 2024-12-03. +// Copyright © 2024 Mochi Development, Inc. All rights reserved. +// + diff --git a/Tests/WebPushTests/WebPushTests.swift b/Tests/WebPushTests/WebPushTests.swift new file mode 100644 index 0000000..0079697 --- /dev/null +++ b/Tests/WebPushTests/WebPushTests.swift @@ -0,0 +1,15 @@ +// +// WebPushTests.swift +// swift-webpush +// +// Created by Dimitri Bouniol on 2024-12-03. +// Copyright © 2024 Mochi Development, Inc. All rights reserved. +// + + +import Testing +@testable import WebPush + +@Test func example() async throws { + // Write your test here and use APIs like `#expect(...)` to check expected conditions. +}