Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitribouniol committed Dec 6, 2024
0 parents commit 63db911
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Package.resolved
4 changes: 4 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [WebPush]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
27 changes: 27 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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"]),
]
)
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# WebPush

<p align="center">
<a href="https://swiftpackageindex.com/mochidev/WebPush">
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmochidev%2FWebPush%2Fbadge%3Ftype%3Dswift-versions" />
</a>
<a href="https://swiftpackageindex.com/mochidev/WebPush">
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fmochidev%2FWebPush%2Fbadge%3Ftype%3Dplatforms" />
</a>
<a href="https://github.com/mochidev/WebPush/actions?query=workflow%3A%22Test+WebPush%22">
<img src="https://github.com/mochidev/WebPush/workflows/Test%20WebPush/badge.svg" alt="Test Status" />
</a>
</p>

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/)
8 changes: 8 additions & 0 deletions Sources/WebPush/WebPushManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// WebPushManager.swift
// swift-webpush
//
// Created by Dimitri Bouniol on 2024-12-03.
// Copyright © 2024 Mochi Development, Inc. All rights reserved.
//

15 changes: 15 additions & 0 deletions Tests/WebPushTests/WebPushTests.swift
Original file line number Diff line number Diff line change
@@ -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.
}

0 comments on commit 63db911

Please sign in to comment.