From fd73a79e80c15813e47c046cba19ba96c4a75e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=CC=81ngel=20Di=CC=81az?= Date: Fri, 7 Aug 2020 13:25:24 +0200 Subject: [PATCH 1/5] enable CI for running in linux --- .github/workflows/swift.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 090109f..9838bb7 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -13,3 +13,32 @@ jobs: run: sudo xcode-select -s /Applications/Xcode_11.4.1.app/Contents/Developer - name: Run tests run: swift test + - name: Generate linux tests + run: swift test --generate-linuxmain + - name: Cached auto-generate linux tests + uses: actions/upload-artifact@v1 + with: + name: generate-linuxmain + path: Tests + + linux: + name: linux + needs: macos + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Clean Tests + run: rm -rf Tests + - name: Get auto-generate linux tests + uses: actions/download-artifact@v1 + with: + name: generate-linuxmain + path: Tests + - name: Remove generated artifact + uses: geekyeggo/delete-artifact@v1 + with: + name: generate-linuxmain + failOnError: false + - name: Run tests + run: swift test From db633ade21fd0a138b216efade58f982757eca82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=CC=81ngel=20Di=CC=81az?= Date: Mon, 10 Aug 2020 14:24:17 +0200 Subject: [PATCH 2/5] update .gitignore to exclude generate linux files --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0b90dbe..248ac9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,11 @@ +# Swift Package Manager .DS_Store -/.build /Packages /*.xcodeproj xcuserdata/ +.build .swiftpm + +# Linux - generated swift files +LinuxMain.swift +**/XCTestManifests.swift From 908dbc518f8d0e640f0adcccb22fc3ae100f447d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=CC=81ngel=20Di=CC=81az?= Date: Mon, 10 Aug 2020 15:16:46 +0200 Subject: [PATCH 3/5] fix tests in linux --- .../Data/State/State+Arbitrary.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift b/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift index 1990a17..5bf4a9b 100644 --- a/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift +++ b/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift @@ -2,10 +2,9 @@ import SwiftCheck import BowLiteLaws import BowLiteCore -extension State: Arbitrary where StateType: Hashable & Arbitrary & CoArbitrary, Value: Arbitrary { - +extension State: Arbitrary where StateType: Hashable & CoArbitrary & Arbitrary, Value: Arbitrary { public static var arbitrary: Gen> { - ArrowOf>.arbitrary.map { arrow in + ArrowOf>.arbitrary.map { arrow in State { state in let pair = arrow.getArrow(state) return (pair.first, pair.second) @@ -13,3 +12,14 @@ extension State: Arbitrary where StateType: Hashable & Arbitrary & CoArbitrary, } } } + +private struct Tuple { + let first: A + let second: B +} + +extension Tuple: Arbitrary where A: Arbitrary, B: Arbitrary { + static var arbitrary: Gen> { + Gen.zip(A.arbitrary, B.arbitrary).map(Tuple.init) + } +} From 06bd13d92cbbe5cb8922648860d33c68b0f80a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=CC=81ngel=20Di=CC=81az?= Date: Mon, 10 Aug 2020 15:19:48 +0200 Subject: [PATCH 4/5] set nef badge to tag 0.1 --- .github/workflows/swift.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9838bb7..bddc66d 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -41,4 +41,4 @@ jobs: name: generate-linuxmain failOnError: false - name: Run tests - run: swift test + run: swift test --parallel --num-workers 4 diff --git a/README.md b/README.md index 566b21b..0c7b638 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Compile and test iPad + iOS + macOS + linux -bow-lite Playground +bow-lite Playground Bow Lite is a cross-platform library for Typed Functional Programming in Swift. It is a lightweight version of [Bow](https://github.com/bow-swift/bow) where some complexity, like Higher Kinded Type emulation, has been removed. From 562bff1194c93b2ee723437da23622d0562a00cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=CC=81ngel=20Di=CC=81az?= Date: Mon, 17 Aug 2020 11:30:55 +0200 Subject: [PATCH 5/5] fix State generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomás Ruiz-López --- .../Data/State/State+Arbitrary.swift | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift b/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift index 5bf4a9b..5901e67 100644 --- a/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift +++ b/Tests/BowLiteCoreTests/Data/State/State+Arbitrary.swift @@ -2,24 +2,13 @@ import SwiftCheck import BowLiteLaws import BowLiteCore -extension State: Arbitrary where StateType: Hashable & CoArbitrary & Arbitrary, Value: Arbitrary { +extension State: Arbitrary where StateType: Hashable & Arbitrary & CoArbitrary, Value: Arbitrary { public static var arbitrary: Gen> { - ArrowOf>.arbitrary.map { arrow in + Gen.zip(ArrowOf.arbitrary, + ArrowOf.arbitrary).map { f, g in State { state in - let pair = arrow.getArrow(state) - return (pair.first, pair.second) + (f.getArrow(state), g.getArrow(state)) } } } } - -private struct Tuple { - let first: A - let second: B -} - -extension Tuple: Arbitrary where A: Arbitrary, B: Arbitrary { - static var arbitrary: Gen> { - Gen.zip(A.arbitrary, B.arbitrary).map(Tuple.init) - } -}