vapor/redis 435
Vapor provider for RediStack
SwiftPackageIndex/SwiftPackageIndex-Server 211
The Swift Package Index is the place to find Swift packages!
Type-safety and algorithms for working with money in Swift.
Non-blocking, event-driven Swift client for Redis.
Helpful extensions and abstractions for using RediStack
An arcade tank shooting game built with Unity 3D.
L4Digital/analytics-ios-integration-localytics 0
The Localytics analytics-ios integration.
Flurry iOS SDK CocoaPods
The master list of repositories for the Swift Package Index.
Redis documentation source code for markdown and metadata files, conversion scripts, and so forth
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application {+ private struct RedisStorageKey: StorageKey {+ typealias Value = RedisStorage+ }+ var redisStorage: RedisStorage {+ if self.storage[RedisStorageKey.self] == nil {+ let redisStorage = RedisStorage()+ self.storage[RedisStorageKey.self] = redisStorage+ self.lifecycle.use(RedisStorage.Lifecycle(redisStorage: redisStorage))+ }+ return self.storage[RedisStorageKey.self]!+ }+}++class RedisStorage {+ private var lock: Lock+ private var configurations: [RedisID: RedisConfiguration]+ fileprivate var pools: [PoolKey: RedisConnectionPool] {+ willSet {+ guard pools.isEmpty else {+ fatalError("editing pools after application has booted is not supported")+ }+ }+ }++ init() {+ self.configurations = [:]+ self.pools = [:]+ self.lock = .init()+ }++ func use(_ redisConfiguration: RedisConfiguration, as id: RedisID = .default) {+ self.configurations[id] = redisConfiguration+ }++ func configuration(for id: RedisID = .default) -> RedisConfiguration? {+ self.configurations[id]+ }++ func ids() -> Set<RedisID> {+ Set(self.configurations.keys)+ }++ func pool(for eventLoop: EventLoop, id redisID: RedisID) -> RedisConnectionPool {+ let key = PoolKey(eventLoopKey: eventLoop.key, redisID: redisID)+ guard let pool = pools[key] else {+ fatalError("No redis found for id \(redisID), or the app may not have finished booting. Also, the eventLoop must be from Application's EventLoopGroup.")+ }+ return pool+ }+++}++extension RedisStorage {+ /// Lifecyle Handler for Redis Storage. On boot, it creates a RedisConnectionPool for each+ /// configurated `RedisID` on each `EventLoop`.+ class Lifecycle: LifecycleHandler {
final class Lifecycle: LifecycleHandler {
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application {+ private struct RedisStorageKey: StorageKey {+ typealias Value = RedisStorage+ }+ var redisStorage: RedisStorage {+ if self.storage[RedisStorageKey.self] == nil {+ let redisStorage = RedisStorage()+ self.storage[RedisStorageKey.self] = redisStorage+ self.lifecycle.use(RedisStorage.Lifecycle(redisStorage: redisStorage))+ }+ return self.storage[RedisStorageKey.self]!+ }+}++class RedisStorage {
final class RedisStorage {
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Foundation+import Redis+import Vapor+import Logging+import XCTVapor++fileprivate extension RedisID {+ static let one: RedisID = "one"+ static let two: RedisID = "two"+}++class MultipleRedisTests: XCTestCase {++ var redisConfig: RedisConfiguration!+ var redisConfig2: RedisConfiguration!++ override func setUpWithError() throws {+ try super.setUpWithError()++ redisConfig = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME") ?? "localhost",+ port: Environment.get("REDIS_PORT")?.int ?? 6379)+ redisConfig2 = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME_2") ?? "localhost",+ port: Environment.get("REDIS_PORT_2")?.int ?? 6380)
please follow Vapor style, see also my comment in RedisTests.swift
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Foundation+import Redis+import Vapor+import Logging+import XCTVapor++fileprivate extension RedisID {+ static let one: RedisID = "one"+ static let two: RedisID = "two"+}++class MultipleRedisTests: XCTestCase {++ var redisConfig: RedisConfiguration!+ var redisConfig2: RedisConfiguration!++ override func setUpWithError() throws {+ try super.setUpWithError()++ redisConfig = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME") ?? "localhost",+ port: Environment.get("REDIS_PORT")?.int ?? 6379)+ redisConfig2 = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME_2") ?? "localhost",+ port: Environment.get("REDIS_PORT_2")?.int ?? 6380)+ }++ func testApplicationRedis() throws {+ let app = Application()+ defer { app.shutdown() }++ app.redis(.one).configuration = redisConfig+ app.redis(.two).configuration = redisConfig2++ try app.boot()++ let info1 = try app.redis(.one).send(command: "INFO").wait()+ XCTAssertContains(info1.string, "redis_version")++ let info2 = try app.redis(.two).send(command: "INFO").wait()+ XCTAssertContains(info2.string, "redis_version")+ }++ +
newlines
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Foundation+import Redis+import Vapor+import Logging+import XCTVapor++fileprivate extension RedisID {+ static let one: RedisID = "one"+ static let two: RedisID = "two"+}++class MultipleRedisTests: XCTestCase {++ var redisConfig: RedisConfiguration!+ var redisConfig2: RedisConfiguration!++ override func setUpWithError() throws {+ try super.setUpWithError()++ redisConfig = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME") ?? "localhost",+ port: Environment.get("REDIS_PORT")?.int ?? 6379)+ redisConfig2 = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME_2") ?? "localhost",+ port: Environment.get("REDIS_PORT_2")?.int ?? 6380)+ }++ func testApplicationRedis() throws {+ let app = Application()+ defer { app.shutdown() }++ app.redis(.one).configuration = redisConfig+ app.redis(.two).configuration = redisConfig2++ try app.boot()++ let info1 = try app.redis(.one).send(command: "INFO").wait()+ XCTAssertContains(info1.string, "redis_version")++ let info2 = try app.redis(.two).send(command: "INFO").wait()+ XCTAssertContains(info2.string, "redis_version")+ }++ ++ func testSetAndGet() throws {+ let app = Application()+ defer { app.shutdown() }++ app.redis(.one).configuration = redisConfig+ app.redis(.two).configuration = redisConfig2++ app.get("test1") { req in+ req.redis(.one).get("name").map {+ $0.description+ }+ }+ app.get("test2") { req in+ req.redis(.two).get("name").map {+ $0.description+ }+ }++ try app.boot()++ try app.redis(.one).set("name", to: "redis1").wait()+ try app.redis(.two).set("name", to: "redis2").wait()++ try app.test(.GET, "test1") { res in+ XCTAssertContains(res.body.string, "redis1")+ }++ try app.test(.GET, "test2") { res in+ XCTAssertContains(res.body.string, "redis2")+ }++
newline
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application {+ private struct RedisStorageKey: StorageKey {+ typealias Value = RedisStorage+ }+ var redisStorage: RedisStorage {+ if self.storage[RedisStorageKey.self] == nil {+ let redisStorage = RedisStorage()+ self.storage[RedisStorageKey.self] = redisStorage+ self.lifecycle.use(RedisStorage.Lifecycle(redisStorage: redisStorage))+ }+ return self.storage[RedisStorageKey.self]!+ }+}++class RedisStorage {+ private var lock: Lock+ private var configurations: [RedisID: RedisConfiguration]+ fileprivate var pools: [PoolKey: RedisConnectionPool] {+ willSet {+ guard pools.isEmpty else {+ fatalError("editing pools after application has booted is not supported")+ }+ }+ }++ init() {+ self.configurations = [:]+ self.pools = [:]+ self.lock = .init()+ }++ func use(_ redisConfiguration: RedisConfiguration, as id: RedisID = .default) {+ self.configurations[id] = redisConfiguration+ }++ func configuration(for id: RedisID = .default) -> RedisConfiguration? {+ self.configurations[id]+ }++ func ids() -> Set<RedisID> {+ Set(self.configurations.keys)+ }++ func pool(for eventLoop: EventLoop, id redisID: RedisID) -> RedisConnectionPool {+ let key = PoolKey(eventLoopKey: eventLoop.key, redisID: redisID)+ guard let pool = pools[key] else {+ fatalError("No redis found for id \(redisID), or the app may not have finished booting. Also, the eventLoop must be from Application's EventLoopGroup.")+ }+ return pool+ }++
redundant newlines
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
import Vapor import Logging import XCTVapor +extension String {+ var int: Int? { Int(self) }+}+ class RedisTests: XCTestCase {+ var redisConfig: RedisConfiguration!++ override func setUpWithError() throws {+ try super.setUpWithError()+ redisConfig = try RedisConfiguration(hostname: Environment.get("REDIS_HOSTNAME") ?? "localhost",+ port: Environment.get("REDIS_PORT")?.int ?? 6379)
redisConfig = try RedisConfiguration(
hostname: Environment.get("REDIS_HOSTNAME") ?? "localhost",
port: Environment.get("REDIS_PORT")?.int ?? 6379
)
comment created time in 11 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application.Redis {+ /// The Redis configuration to use to communicate with a Redis instance.+ ///+ /// See `Application.Redis.id`+ public var configuration: RedisConfiguration? {+ get {+ self.application.redisStorage.configuration(for: self.id)+ }+ nonmutating set {+ guard let newConfig = newValue else {+ fatalError("editing pools after application has booted is not supported")
is this message correct? It seems to be copied from RedisStorage.swift
comment created time in 12 hours
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application {+ private struct RedisStorageKey: StorageKey {+ typealias Value = RedisStorage+ }+ var redisStorage: RedisStorage {+ if self.storage[RedisStorageKey.self] == nil {+ let redisStorage = RedisStorage()+ self.storage[RedisStorageKey.self] = redisStorage+ self.lifecycle.use(RedisStorage.Lifecycle(redisStorage: redisStorage))+ }+ return self.storage[RedisStorageKey.self]!
Please avoid !
by rewriting using guard
.
comment created time in 12 hours
issue commentpeek-travel/swift-currency
Note that the current approach probably can't work for ETH. There are 1e18 Wei in an ETH, and if you try to implement that in an obvious way:
public struct ETH: CurrencyProtocol, CurrencyMetadata {
public static var name: String { return "Eth" }
public static var alphabeticCode: String { return "ETH" }
public static var numericCode: UInt16 { return 999 }
public static var minorUnits: UInt8 { return 18 }
public var minorUnits: Int64 { return self._minorUnits }
public init<T: BinaryInteger>(minorUnits: T) { self._minorUnits = .init(minorUnits) }
private let _minorUnits: Int64
}
then you'll wind up with 5.01 ETH == 5.009999999999998976 ETH. The rounding hack to support ExpressibleByFloatLiteral is convenient, but it fails silently when minorUnits is large. ETH is a pathological case and fails easily. But BTC fails in edge cases that are still legal. For example, BTC 20_000_000.10000001 is rounded to 20000000.1 BTC.
Using String rather than double literals would fix this. Decimal(string: "20000000.10000001")
does not fail this way. This is clearly less convenient. The question is whether that convenience is worth introducing rounding errors in money, or limiting the range of minorUnits
to fairly small values.
comment created time in 8 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
jobs: fail-fast: false matrix: env: ${{ fromJSON(needs.getcidata.outputs.environments) }}- include:- - services: {}- redis_host: localhost- - env: { os: ubuntu-latest }- services: { redis: { image: redis, ports: [ '6379:6379' ] } }- redis_host: redis runs-on: ${{ matrix.env.os }} container: ${{ matrix.env.image }}- services: ${{ matrix.services }} steps: - name: Select toolchain uses: maxim-lobanov/setup-xcode@v1.2.1 with: xcode-version: ${{ matrix.env.toolchain }} if: ${{ matrix.env.toolchain != '' }}- - name: Set up Redis server via Homebrew- if: ${{ matrix.env.toolchain != '' }}- run: brew install redis && brew services start redis- - name: Check out Redis+ - name: Check out source code uses: actions/checkout@v2++ - name: Install Redis via Homebrew (Mac)+ if: ${{ matrix.env.toolchain != '' }}+ run: brew install redis ++ - name: Install Redis via apt-get (Ubuntu)+ if: ${{ matrix.env.toolchain == '' }}+ run: apt-get update && apt-get install -y redis++ - name: Start Redis 1+ run: mkdir -p /tmp/redis1 && redis-server .github/redis1.conf+ - name: Start Redis 2+ run: mkdir -p /tmp/redis2 && redis-server .github/redis2.conf
@Mordil @gwynne I put some effort into simplifying the redis conf files. Nobody wants massive config files 😂 . It's down to 4 lines: 1. run in background, 2. pidfile, 3. port, 4. turn off logging.
Hopefully, this effort helps us keep both Mac and Linux as fully tested platforms for this package.
(Of course I would prefer to use Docker for both platforms, but unfortunately, Docker is not supported for Mac on GitHub Actions)
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
jobs: fail-fast: false matrix: env: ${{ fromJSON(needs.getcidata.outputs.environments) }}- include:- - services: {}- redis_host: localhost- - env: { os: ubuntu-latest }- services: { redis: { image: redis, ports: [ '6379:6379' ] } }- redis_host: redis runs-on: ${{ matrix.env.os }} container: ${{ matrix.env.image }}- services: ${{ matrix.services }} steps: - name: Select toolchain uses: maxim-lobanov/setup-xcode@v1.2.1 with: xcode-version: ${{ matrix.env.toolchain }} if: ${{ matrix.env.toolchain != '' }}- - name: Set up Redis server via Homebrew- if: ${{ matrix.env.toolchain != '' }}- run: brew install redis && brew services start redis- - name: Check out Redis+ - name: Check out source code uses: actions/checkout@v2++ - name: Install Redis via Homebrew (Mac)+ if: ${{ matrix.env.toolchain != '' }}+ run: brew install redis ++ - name: Install Redis via apt-get (Ubuntu)+ if: ${{ matrix.env.toolchain == '' }}+ run: apt-get update && apt-get install -y redis++ - name: Start Redis 1+ run: mkdir -p /tmp/redis1 && redis-server .github/redis1.conf+ - name: Start Redis 2+ run: mkdir -p /tmp/redis2 && redis-server .github/redis2.conf
Since Mac is a supported platform, I think it is good for the tests to run on Mac as well.
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application.Redis {+ /// Configure Redis connection information.+ /// In `configure.swift`, write `app.redis.configuration = RedisConfiguration(...)`+ /// Or for alternate Redis IDs, `app.redis(.myRedisId).configuration = RedisConfiguration(...)`+ /// when `extension RedisID { static let myRedisID = RedisID(...) }` has been defined.+ public var configuration: RedisConfiguration? {+ get {+ self.application.redisStorage.configuration(for: self.redisID)+ }+ nonmutating set {+ guard let newConfig = newValue else {+ return
oh whoops! I meant to fatalError
there, will fix.
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
import Foundation import Vapor -public struct RedisID: Hashable, Codable {+/// A type-safe representation of a String representing individual identifiers of separate Redis connections and configurations.+///+/// It is recommended to define static extensions for your definitions to make it easier at call sites to reference them.+///+/// For example:+/// ```swift+/// extension RedisID { static let oceanic = RedisID("oceanic") }+/// app.redis(.oceanic) // Application.Redis instance+/// ```+public struct RedisID: Hashable,+ Codable,+ RawRepresentable,+ ExpressibleByStringLiteral,+ ExpressibleByStringInterpolation,+ CustomStringConvertible,+ Comparable { - public let string: String- public init(string: String) {- self.string = string+ public let rawValue: String++ public init(stringLiteral: String) {+ self.rawValue = stringLiteral+ }++ public init(rawValue: String) {+ self.rawValue = rawValue } - public static let `default` = RedisID(string: "default")+ public init(_ string: String){+ self.rawValue = string+ }++ public typealias RawValue = String+ public typealias StringLiteralType = String
haha yeah I prefer the compiler inferring it. Didn't know which you would prefer.
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
+import Vapor++extension Application.Redis {+ /// Configure Redis connection information.+ /// In `configure.swift`, write `app.redis.configuration = RedisConfiguration(...)`+ /// Or for alternate Redis IDs, `app.redis(.myRedisId).configuration = RedisConfiguration(...)`+ /// when `extension RedisID { static let myRedisID = RedisID(...) }` has been defined.+ public var configuration: RedisConfiguration? {+ get {+ self.application.redisStorage.configuration(for: self.redisID)+ }+ nonmutating set {+ guard let newConfig = newValue else {+ return
I was trying to match what I saw from reading the code on master
, which only initializes once.
On master and on my branch: Once the connection pools are initialized for the event loops, then changing the configuration afterwards isn't support.
Typically, redis or other databases are setup in configure.swift
, and then left alone.
I'm not against someone implementing support for changing configuration after launch, but it felt out of scope for this PR.
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
+FROM vapor/swift++ADD Package.swift Package.swift+ADD Sources Sources+ADD Tests Tests++CMD swift test --enable-test-discovery
I used them during development. Yes, will delete.
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
jobs: fail-fast: false matrix: env: ${{ fromJSON(needs.getcidata.outputs.environments) }}- include:- - services: {}- redis_host: localhost- - env: { os: ubuntu-latest }- services: { redis: { image: redis, ports: [ '6379:6379' ] } }- redis_host: redis runs-on: ${{ matrix.env.os }} container: ${{ matrix.env.image }}- services: ${{ matrix.services }} steps: - name: Select toolchain uses: maxim-lobanov/setup-xcode@v1.2.1 with: xcode-version: ${{ matrix.env.toolchain }} if: ${{ matrix.env.toolchain != '' }}- - name: Set up Redis server via Homebrew- if: ${{ matrix.env.toolchain != '' }}- run: brew install redis && brew services start redis- - name: Check out Redis+ - name: Check out source code uses: actions/checkout@v2++ - name: Install Redis via Homebrew (Mac)+ if: ${{ matrix.env.toolchain != '' }}+ run: brew install redis ++ - name: Install Redis via apt-get (Ubuntu)+ if: ${{ matrix.env.toolchain == '' }}+ run: apt-get update && apt-get install -y redis++ - name: Start Redis 1+ run: mkdir -p /tmp/redis1 && redis-server .github/redis1.conf+ - name: Start Redis 2+ run: mkdir -p /tmp/redis2 && redis-server .github/redis2.conf++ - name: Test Redis 1 connection+ run: redis-cli -u redis://localhost:6379/0 INFO+ - name: Test Redis 2 connection+ run: redis-cli -u redis://localhost:6380/0 INFO+ - name: Run tests with Thread Sanitizer timeout-minutes: 20 run: swift test --enable-test-discovery --sanitize=thread env:- REDIS_HOSTNAME: ${{ matrix.redis_host }}+ REDIS_HOSTNAME: localhost+ REDIS_PORT: 6379+ REDIS_HOSTNAME_2: localhost+ REDIS_PORT_2: 6380
Would you want a separate test target then? Right now swift test
runs all the tests.
comment created time in 9 days
Pull request review commentvapor/redis
Support for Multiple Redis instances
jobs: fail-fast: false matrix: env: ${{ fromJSON(needs.getcidata.outputs.environments) }}- include:- - services: {}- redis_host: localhost- - env: { os: ubuntu-latest }- services: { redis: { image: redis, ports: [ '6379:6379' ] } }- redis_host: redis runs-on: ${{ matrix.env.os }} container: ${{ matrix.env.image }}- services: ${{ matrix.services }} steps: - name: Select toolchain uses: maxim-lobanov/setup-xcode@v1.2.1 with: xcode-version: ${{ matrix.env.toolchain }} if: ${{ matrix.env.toolchain != '' }}- - name: Set up Redis server via Homebrew- if: ${{ matrix.env.toolchain != '' }}- run: brew install redis && brew services start redis- - name: Check out Redis+ - name: Check out source code uses: actions/checkout@v2++ - name: Install Redis via Homebrew (Mac)+ if: ${{ matrix.env.toolchain != '' }}+ run: brew install redis ++ - name: Install Redis via apt-get (Ubuntu)+ if: ${{ matrix.env.toolchain == '' }}+ run: apt-get update && apt-get install -y redis++ - name: Start Redis 1+ run: mkdir -p /tmp/redis1 && redis-server .github/redis1.conf+ - name: Start Redis 2+ run: mkdir -p /tmp/redis2 && redis-server .github/redis2.conf
there's a few problems, unfortunately.
- Docker isn't supported in GitHub Actions for Mac.
- Brew doesn't support running multiple redis instances
So since we're already making separate redis.conf files for Mac, it made sense to use them on Ubuntu, as well. So the build scripts are consistent.
comment created time in 9 days
startedMordil/RediStack
started time in 18 days
PR opened vapor/redis
<!-- 🚀 Thank you for contributing! -->
<!-- Describe your changes clearly and use examples if possible. -->
<!-- When this PR is merged, the title and body will be --> <!-- used to generate a release automatically. -->
Hello, excited for my second PR to this repo: https://github.com/vapor/redis/pull/120
I discovered there wasn't support for multiple Redis instances, while upgrading my app from Vapor 3 to Vapor 4. This PR addresses this.
Usage
Assuming a redis1
ID has been defined,
extension RedisID {
static var redis1: RedisID {
RedisID(string: "redis1")
}
}
The Redis configuration in configure.swift
can look like this:
app.redises.use(try RedisConfiguration(url: Environment.get("REDIS_1_URL")!), as: .redis1)
app.redises.use(try RedisConfiguration(url: Environment.get("REDIS_2_URL")!), as: .redis2)
and the routes in routes.swift
can look like this:
app.get("redis1") { req in
req.redis(.redis1).get("name").map { respValue in
return respValue.string ?? "name not found in Redis 1"
}
}
Backwards support
The app.redis.configuration = RedisConfiguation(...)
syntax is still supported. It defaults to the default
Redis configuration
Sample App
A sample app is available at https://github.com/danramteke/study-redis-multiple
Arch
I added a RedisStorage
class that works similarly to the Databases
class in Fluent
. It holds on to the Redis configurations and connection pools. Just like what's on master, there is a connection pool per EventLoop
. But now, a RedisID
is also used.
pr created time in 19 days
startedMordil/RediStack
started time in 21 days
startedMordil/RediStack
started time in a month
pull request commentvapor/redis
Change Sessions driver to be generic
These changes are now available in 4.0.0-rc.2.1
comment created time in a month
push eventvapor/redis
commit sha 57b1d6298b5c2367fac012993bc0efb5ffb4707e
Apply the new CI from Vapor to Redis, including new techniques for leveraging service containers in this infrastructure without breaking the ability to run macOS and Linux jobs out of the same set of steps..
push time in a month
Pull request review commentvapor/redis
Change Sessions driver to be generic
name: test-on:-- pull_request+on: { pull_request: {} }+ jobs:- test-redis:+ getcidata: runs-on: ubuntu-latest+ outputs:+ environments: ${{ steps.output.outputs.environments }}+ steps:+ - id: output+ run: |+ envblob="$(curl -fsSL https://raw.githubusercontent.com/vapor/ci/main/pr-environments.json | jq -cMj '.')"+ echo "::set-output name=environments::${envblob}"+++ test-redis:+ needs: getcidata strategy:+ fail-fast: false matrix:- linux-dist: ['xenial', 'bionic', 'focal', 'amazonlinux2', 'centos7', 'centos8']- container:- image: swift:5.2-${{ matrix.linux-dist }}- services:- redis:- image: redis- ports:- - 6379:6379- steps:- - name: Checkout Redis- uses: actions/checkout@v1- - name: CentOS 7 workaround- if: ${{ matrix.linux-dist == 'centos7' }}- run: |- yum install -y make libcurl-devel- git clone https://github.com/git/git -bv2.28.0 --depth 1- cd git- make prefix=/usr -j all install NO_OPENSSL=1 NO_EXPAT=1 NO_TCLTK=1 NO_GETTEXT=1 NO_PERL=1- - name: Run tests with thread sanitizer- run: swift test --enable-test-discovery --sanitize=thread- env:- REDIS_HOSTNAME: redis+ env: ${{ fromJSON(needs.getcidata.outputs.environments) }}+ include:+ - services: {}+ - env: { os: ubuntu-latest }+ services: { redis: { image: redis, ports: [ '6379:6379' ] } }+ runs-on: ${{ matrix.env.os }}+ container: ${{ matrix.env.image }}+ services: ${{ matrix.services }}+ steps: + - name: Select toolchain+ uses: maxim-lobanov/setup-xcode@v1.2.1+ with:+ xcode-version: ${{ matrix.env.toolchain }}+ if: ${{ matrix.env.toolchain != '' }}+ - name: Set up Redis server via Homebrew+ if: ${{ matrix.env.toolchain != '' }}
Correct - toolchain
is always null
(empty string) for Ubuntu/Windows runners, image
is always null
for macOS/Windows runners, and what the heck will happen when Window is in the mix, I don't yet know.
comment created time in a month
push eventvapor/redis
commit sha ec029cfd7d5f504df72b58b56dfd218601989159
Apply rhe new CI from Vapor to Redis, including new techniques for leveraging service containers in this infrastructure without breaking the ability to run macOS and Linux jobs out of the same set of steps..
push time in a month
push eventvapor/redis
commit sha 94f9172347533d618a54b67a465169fc258a7e89
Oops, the redis hostname is different between runners
push time in a month
push eventvapor/redis
commit sha 7001c5138d7dfb4da9131cd72e10c30dfd3aef3c
Possibly fix syntax
push time in a month