dependabot[bot] 9b6623daa0 Bump swiftlang/github-workflows/.github/workflows/soundness.yml from 0.0.17 to 0.0.18 (#266)
Bumps
[swiftlang/github-workflows/.github/workflows/soundness.yml](https://github.com/swiftlang/github-workflows)
from 0.0.17 to 0.0.18.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/swiftlang/github-workflows/releases">swiftlang/github-workflows/.github/workflows/soundness.yml's
releases</a>.</em></p>
<blockquote>
<h2>0.0.18</h2>
<h2>What's Changed</h2>
<ul>
<li>Only read the PE header when verifying downloaded Windows installers
by <a
href="https://github.com/plemarquand"><code>@​plemarquand</code></a> in
<a
href="https://redirect.github.com/swiftlang/github-workflows/pull/330">swiftlang/github-workflows#330</a></li>
<li>Fix self repository references in cmake_build.yml by <a
href="https://github.com/kkebo"><code>@​kkebo</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/332">swiftlang/github-workflows#332</a></li>
<li>Soundness: add pre-build command input for API breakage check by <a
href="https://github.com/bkhouri"><code>@​bkhouri</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/333">swiftlang/github-workflows#333</a></li>
<li>Run every test runner in the Android emulator tests by <a
href="https://github.com/niktishakov"><code>@​niktishakov</code></a> in
<a
href="https://redirect.github.com/swiftlang/github-workflows/pull/327">swiftlang/github-workflows#327</a></li>
<li>Swift GitHub Actions Workflows Unification. by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/316">swiftlang/github-workflows#316</a></li>
<li>Keep the Linux overrides to the Linux tests by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/335">swiftlang/github-workflows#335</a></li>
<li>Run the Cxx interop check on every Linux version by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/336">swiftlang/github-workflows#336</a></li>
<li>Update soundness Swift versions to 6.4 by <a
href="https://github.com/FranzBusch"><code>@​FranzBusch</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/339">swiftlang/github-workflows#339</a></li>
<li>Skip swift version license check by <a
href="https://github.com/cmcgee1024"><code>@​cmcgee1024</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/127">swiftlang/github-workflows#127</a></li>
<li>Add a macOS pool label only when one is given by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/341">swiftlang/github-workflows#341</a></li>
<li>Enable the FreeBSD check by default by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/342">swiftlang/github-workflows#342</a></li>
<li>Run the macOS runner exit-code test on the self-hosted pool by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/344">swiftlang/github-workflows#344</a></li>
<li>Add a workflows-scripts action that returns the scripts of the
running workflow commit by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/345">swiftlang/github-workflows#345</a></li>
<li>Run the Android emulator tests in their own jobs by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/347">swiftlang/github-workflows#347</a></li>
<li>The <code>ubuntu-latest</code> runners are getting updated to 26.04,
so pin the three runners for WASM and Android to 24.04 by <a
href="https://github.com/finagolfin"><code>@​finagolfin</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/346">swiftlang/github-workflows#346</a></li>
<li>Keep some SDK builds at Ubuntu 26.04, so we know if something goes
wrong by <a
href="https://github.com/finagolfin"><code>@​finagolfin</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/348">swiftlang/github-workflows#348</a></li>
<li>Print requested Swift version as a separate step by <a
href="https://github.com/czechboy0"><code>@​czechboy0</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/349">swiftlang/github-workflows#349</a></li>
<li>Don't set the minimum Swift version floor at the patch level by <a
href="https://github.com/rnro"><code>@​rnro</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/350">swiftlang/github-workflows#350</a></li>
<li>Set FreeBSD VM memory and CPU by <a
href="https://github.com/etcwilde"><code>@​etcwilde</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/354">swiftlang/github-workflows#354</a></li>
<li>Windows CMake Testing: Use Ninja by <a
href="https://github.com/etcwilde"><code>@​etcwilde</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/355">swiftlang/github-workflows#355</a></li>
<li>Update macOS runners to goldengate and drop Swift 6.1 testing by <a
href="https://github.com/shahmishal"><code>@​shahmishal</code></a> in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/351">swiftlang/github-workflows#351</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/niktishakov"><code>@​niktishakov</code></a>
made their first contribution in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/327">swiftlang/github-workflows#327</a></li>
<li><a href="https://github.com/czechboy0"><code>@​czechboy0</code></a>
made their first contribution in <a
href="https://redirect.github.com/swiftlang/github-workflows/pull/349">swiftlang/github-workflows#349</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/swiftlang/github-workflows/compare/0.0.17...0.0.18">https://github.com/swiftlang/github-workflows/compare/0.0.17...0.0.18</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/5cb0468ff22502aa61498410474aea13092d2580"><code>5cb0468</code></a>
Update macOS runners to goldengate and drop Swift 6.1 testing (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/351">#351</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/93131a86962f30d4e4d9e6c0b9d49f195f59d204"><code>93131a8</code></a>
Windows CMake Testing: Use Ninja (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/355">#355</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/89e454dd55486d69e5532f684ae4e5606ce1805b"><code>89e454d</code></a>
Set FreeBSD VM memory and CPU (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/354">#354</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/de9be1265c5295ff156804d313f100d1ca591628"><code>de9be12</code></a>
Don't set the minimum Swift version floor at the patch level (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/350">#350</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/0ea2521314fba963b7d838bdf31c7bfdf46d9bcd"><code>0ea2521</code></a>
Print requested Swift version as a separate step (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/349">#349</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/223d14e8c77309a1a540c9f603d5bbb35216568a"><code>223d14e</code></a>
Keep some SDK builds at Ubuntu 26.04, so we know if something goes wrong
(<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/348">#348</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/bac21920e1fa05c48b7b6eb98fe370e4b2d78f8b"><code>bac2192</code></a>
The <code>ubuntu-latest</code> runners are getting updated to 26.04, so
pin the three ru...</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/a4992734a14f3579909c78deb40d884b8dcbe87b"><code>a499273</code></a>
Run the Android emulator tests in their own jobs (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/347">#347</a>)</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/06cbfd087b9b8adb0ffbdae7f951f8b4f79d8473"><code>06cbfd0</code></a>
Add a workflows-scripts action that returns the scripts of the running
workfl...</li>
<li><a
href="https://github.com/swiftlang/github-workflows/commit/c8168b61724acf8534260c5b2b0b8dc6db1ab5a0"><code>c8168b6</code></a>
Run the macOS runner exit-code test on the self-hosted pool (<a
href="https://redirect.github.com/swiftlang/github-workflows/issues/344">#344</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/swiftlang/github-workflows/compare/0.0.17...0.0.18">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=swiftlang/github-workflows/.github/workflows/soundness.yml&package-manager=github_actions&previous-version=0.0.17&new-version=0.0.18)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-18 09:04:57 +01:00
2024-10-31 12:17:45 +01:00
2024-10-31 12:17:45 +01:00
2020-03-18 11:56:30 -07:00
2024-10-31 12:17:45 +01:00
2020-03-18 11:56:30 -07:00

Swift Service Lifecycle

Swift Service Lifecycle provides a basic mechanism to cleanly start up and shut down an application, freeing resources in-order before exiting. It also provides a Signal-based shutdown hook, to shut down on signals like TERM or INT.

Swift Service Lifecycle was designed with the idea that every application has some startup and shutdown workflow-like-logic which is often sensitive to failure and hard to get right. The library encodes this common need in a safe and reusable way that is non-framework specific, and designed to be integrated with any server framework or directly in an application. Furthermore, it integrates natively with Structured Concurrency.

This is the beginning of a community-driven open-source project actively seeking contributions, be it code, documentation, or ideas. What Swift Service Lifecycle provides today is covered in the API docs, but it will continue to evolve with community input.

Getting started

Swift Service Lifecycle should be used if you have a server-side Swift application or a cross-platform (e.g. Linux, macOS) application, and you would like to manage its startup and shutdown lifecycle. Below you will find all you need to know to get started.

Adding the dependency

To add a dependency on the package, declare it in your Package.swift:

.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"),

and add ServiceLifecycle to the dependencies of your application target:

.product(name: "ServiceLifecycle", package: "swift-service-lifecycle")

Example Package.swift file with ServiceLifecycle as a dependency:

// swift-tools-version:6.2
import PackageDescription

let package = Package(
    name: "my-application",
    dependencies: [
        .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.3.0"),
    ],
    targets: [
        .target(name: "MyApplication", dependencies: [
            .product(name: "ServiceLifecycle", package: "swift-service-lifecycle")
        ]),
        .testTarget(name: "MyApplicationTests", dependencies: [
            .target(name: "MyApplication"),
        ]),
    ]
)

Using ServiceLifecycle

You can find a short usage example below. You can find more detailed documentation on how to use ServiceLifecycle here.

ServiceLifecycle consists of two main building blocks. The Service protocol and the ServiceGroup actor. As a library or application developer you should model your long-running work as services that implement the Service protocol. The protocol only requires the implementation of a single func run() async throws method. Once implemented, your application you can use the ServiceGroup to orchestrate multiple services. The group will spawn a child task for each service and call the respective run method in the child task. Furthermore, the group will setup signal listeners for the configured signals and trigger a graceful shutdown on each service.

import ServiceLifecycle
import Logging

// A service can be implemented by a struct, class or actor. For this example we are using a struct.
struct FooService: Service {
    func run() async throws {
        print("FooService starting")
        try await Task.sleep(for: .seconds(10))
        print("FooService done")
    }
}

@main
struct Application {
    static let logger = Logger(label: "Application")
    
    static func main() async throws {
        let service1 = FooService()
        let service2 = FooService()
        
        let serviceGroup = ServiceGroup(
            services: [service1, service2],
            gracefulShutdownSignals: [.sigterm],
            logger: logger
        )
        
        try await serviceGroup.run()
    }
}

Security

For the security process, see https://github.com/apple/swift-log?tab=security-ov-file.

S
Description
Mirror of github.com/swift-server/swift-service-lifecycle
Readme Apache-2.0
1.1 MiB
0 Stars 1 Watchers 0 Forks
Languages
Swift 100%