10 Commits
Author SHA1 Message Date
Rick Newton-RogersandYim Lee 4d11d9817d Bump minimum Swift version to 5.7 (#160)
* Bump minimum Swift version to 5.7

Motivation:

Now that Swift 5.9 is GM we should update the supported versions and
remove 5.6

Modifications:

* Update `Package.swift`
* Delete the <5.7 docker compose files and make a 5.10 one
* Update the 5.9 docker file to stop using nightlies

Result:

Remove support for Swift 5.6, add 5.10

* Remove '--enable-test-discovery'

To see if it's causing CI build getting stuck

---------

Co-authored-by: Yim Lee <yim_lee@apple.com>
2023-10-05 10:44:21 +01:00
Franz Busch fafab8f7ad Overhaul service lifecycle for Structured Concurrency (#130)
* Overhaul service lifecycle for Structured Concurrency

# Motivation
Since the release of Swift Concurrency the server ecosystem has adopted `async`/`await` in a lot of APIs making the user experience amazing. Another thing that Swift Concurrency introduced is Structured Concurrency which allows to create a task tree that with parent to child relations. Structured Concurrency has many benefits such as automatic cancellation and task local propagation.
The current state of this library predates the introduction of Swift Concurrency and is not inline anymore with how applications are structured that want to leverage Concurrency.

# Modification
This PR overhauls the implementation of service lifecycle completely. The reason for this is that the current implementation is very focused on how NIO based applications work before the introduction of Concurrency. Furthermore, Structured Concurrency is actually replacing part of the current functionality by providing new scoping mechanisms.
The overhauled implementation provides two primitive types. Anew `Service` protocol and a `ServiceRunner`. The former is providing a clear API which services have to conform to so that they can be run by the `ServiceRunner`.

An example usage of the types looks like this

```swift
actor FooService: Service {
    func run() async throws {}

    func shutdownGracefully() async throws {}
}
actor BarService: Service {
    func run() async throws {}

    func shutdownGracefully() async throws {}
}

let fooService = FooService()
let barService = BarService()

let runner = ServiceRunner(
    services: [fooService, barService],
   configuration: .init(),
   logger: logger
)

try await runner.run()
```

# Result
We now have a service lifecycle library that integrates nicely with Structured Concurrency. Its value add is that it solves to complex setup of the task group with the signal handling. Furthermore, it provides a currency type `Service` that can be passed to inject services.

* Remove `shutdownGracefully` method and switch to a handler based approach.

* Code review from George

* Add extensions to `TaskGroup` and `ThrowingTaskGroup`

* Remove long running property

* Documentation

* Fix tests

* Ensure ordering of shutdown

* Test

# Motivation

# Modification

# Result

* Introduce ServiceLifecycleTestKit

* Add AsyncCancelOngracefulShutdownSequence

* Tests and docs for graceful shutdown

# Motivation

# Modification

# Result

* Remove unsafe flags

* Add article for application authors

* Add correct licence and notice information for the things we copied from swift-nio

* Code review

* Remove @_unsafeInheritExectuor

* Code review

* Change log levels, rename to withGracefulShutdownHandler and support nested service runner graceful shutdown

* Add public `shutdownGracefully` method to the service runner

* Code review and expose new cancelOnGracefulShutdown method

* Extend graceful shutdown APIs and tolerate running outside of a `ServiceRunner`

* Rename to `ServiceGroup`

* Enable Swift 5.6 support

* Update soundess dockerfile

* Update Readme

* Make 5.6 build work
2023-04-27 11:56:08 +01:00
tomer doron f6c02f7b46 only install jazzy on latest ubuntu versions (#108)
motivation: jazzy no longer works on older version of ubuntu as ruby is too old

changes: update docker to only install jazzy on latest ubuntu versions
2021-09-01 22:45:00 -07:00
tomer doron b00bee04fd add 5.5 ci (#105)
motivation: test with 5.5

changes: add 5.5. docker-compose and pin jazzy version
2021-08-19 14:45:13 -07:00
tomer doron 1e2fa84316 add 5.4 and nightly ci jobs (#82)
motivation: prepare for 5.4 and test against nightlies

changes:
* add docker compose setup for 5.4 and nightly testing
2021-03-11 10:34:53 +09:00
tomer doron a7932002e9 remove symbolicate-linux-fatal from Docker (#76)
motivation: we are not actually using symbolicate-linux-fatal in any meaningful way in CI and it's pinned to the master branch which has been removed

changes: remove symbolicate-linux-fatal fetching from Docker
2020-10-08 09:14:17 +09:00
tomer doron c8e99520d7 setup shutdown hooks on ServiceLifecycle::startAndWait (#69)
motivation: fix startAndWait to work as advertised

changes:
* extract shutdown setup to a func and call it from both start and startAndWait
* add test
* fix api doc
* fixi jazzy xenial issue (fixes ci)
2020-08-08 20:27:20 -07:00
tomer doron 35ea48e628 update ci setup (#24)
motivation: 5.2 adoption, prepare for 5.3

changes:
* use 5.2 release in docker-compose setup
* add 5.3 docker-compose setup (placeholder)
* format
2020-04-03 19:51:07 -07:00
tomer doron ed61383431 formatting (#5)
motivation: align format versioning

changes:
* set explicit target language version to the lowest supported swift version
* update swiftformat version
2020-03-20 12:45:06 -07:00
Tom Doron 1abe527c92 initial commit 2020-03-18 11:56:30 -07:00