diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f1cd2bf1..9e27bb3df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.3.0 + +- Use Kotlin client `1.3.1` +- Updated Ktor to `1.3.0` + # 2.2.2 - Use Kotlin client `1.2.2` diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..7a118b49b --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..5c6ba86c2 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,161 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + atomos (0.1.3) + babosa (1.0.3) + claide (1.0.3) + colored (1.2) + colored2 (3.1.2) + commander-fastlane (4.4.6) + highline (~> 1.7.2) + declarative (0.0.10) + declarative-option (0.1.0) + digest-crc (0.4.1) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.5) + emoji_regex (1.0.1) + excon (0.72.0) + faraday (0.17.3) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.6) + faraday (>= 0.7.4) + http-cookie (~> 1.0.0) + faraday_middleware (0.13.1) + faraday (>= 0.7.4, < 1.0) + fastimage (2.1.7) + fastlane (2.142.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.3, < 3.0.0) + babosa (>= 1.0.2, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander-fastlane (>= 4.4.6, < 5.0.0) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 2.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 0.17) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 0.13.1) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-api-client (>= 0.29.2, < 0.37.0) + google-cloud-storage (>= 1.15.0, < 2.0.0) + highline (>= 1.7.2, < 2.0.0) + json (< 3.0.0) + jwt (~> 2.1.0) + mini_magick (>= 4.9.4, < 5.0.0) + multi_xml (~> 0.5) + multipart-post (~> 2.0.0) + plist (>= 3.1.0, < 4.0.0) + public_suffix (~> 2.0.0) + rubyzip (>= 1.3.0, < 2.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + slack-notifier (>= 2.0.0, < 3.0.0) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-api-client (0.36.4) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.9) + httpclient (>= 2.8.1, < 3.0) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.12) + google-cloud-core (1.5.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.3.0) + faraday (~> 0.11) + google-cloud-errors (1.0.0) + google-cloud-storage (1.25.1) + addressable (~> 2.5) + digest-crc (~> 0.4) + google-api-client (~> 0.33) + google-cloud-core (~> 1.2) + googleauth (~> 0.9) + mini_mime (~> 1.0) + googleauth (0.10.0) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.12) + highline (1.7.10) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + json (2.3.0) + jwt (2.1.0) + memoist (0.16.2) + mini_magick (4.10.1) + mini_mime (1.0.2) + multi_json (1.14.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nanaimo (0.2.6) + naturally (2.2.0) + os (1.0.1) + plist (3.5.0) + public_suffix (2.0.5) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rouge (2.0.7) + rubyzip (1.3.0) + security (0.1.3) + signet (0.12.0) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + slack-notifier (2.3.2) + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + tty-cursor (0.7.1) + tty-screen (0.7.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.6) + unicode-display_width (1.6.1) + word_wrap (1.0.0) + xcodeproj (1.15.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.6) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.0) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 1.17.2 diff --git a/buildSrc/src/main/kotlin/dependency/Library.kt b/buildSrc/src/main/kotlin/dependency/Library.kt index d2c1ca3df..c70637aea 100644 --- a/buildSrc/src/main/kotlin/dependency/Library.kt +++ b/buildSrc/src/main/kotlin/dependency/Library.kt @@ -5,7 +5,7 @@ object Library: Dependency { override val group = "com.algolia" override val artifact = "instantsearch" - override val version = "2.2.2" + override val version = "2.3.0" val packageName = "$group:$artifact-android" diff --git a/buildSrc/src/main/kotlin/dependency/network/AlgoliaClient.kt b/buildSrc/src/main/kotlin/dependency/network/AlgoliaClient.kt index 8d233dd09..59df0b41e 100644 --- a/buildSrc/src/main/kotlin/dependency/network/AlgoliaClient.kt +++ b/buildSrc/src/main/kotlin/dependency/network/AlgoliaClient.kt @@ -7,5 +7,5 @@ object AlgoliaClient : Dependency { override val group = "com.algolia" override val artifact = "algoliasearch-client-kotlin" - override val version = "1.2.2" + override val version = "1.3.1" } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/dependency/network/Ktor.kt b/buildSrc/src/main/kotlin/dependency/network/Ktor.kt index d0b7147ee..a2c03ef7d 100644 --- a/buildSrc/src/main/kotlin/dependency/network/Ktor.kt +++ b/buildSrc/src/main/kotlin/dependency/network/Ktor.kt @@ -6,5 +6,5 @@ object Ktor : Dependency { override val group = "io.ktor" override val artifact = "ktor" - override val version = "1.2.6" + override val version = "1.3.0" } \ No newline at end of file diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 000000000..bc94359f7 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one +package_name("com.algolia.instantsearch") # e.g. com.krausefx.app diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 000000000..7a0def14d --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,28 @@ +fastlane_version "2.62.1" + +default_platform :android + +platform :android do + + desc "Runs all the tests" + lane :test do + gradle(tasks: ["jvmTest"]) + end + + # You can define as many lanes as you want + + after_all do |lane| + # This block is called, only if the executed lane was successful + + # slack( + # message: "Successfully deployed new App Update." + # ) + end + + error do |lane, exception| + # slack( + # message: exception.message, + # success: false + # ) + end +end \ No newline at end of file diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 000000000..5e20d1e83 --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,29 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew cask install fastlane` + +# Available Actions +## Android +### android test +``` +fastlane android test +``` +Runs all the tests + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/report.xml b/fastlane/report.xml new file mode 100644 index 000000000..26456949e --- /dev/null +++ b/fastlane/report.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/helper/src/commonTest/kotlin/Client.kt b/helper/src/commonTest/kotlin/Client.kt index d2bb18811..404de7ba6 100644 --- a/helper/src/commonTest/kotlin/Client.kt +++ b/helper/src/commonTest/kotlin/Client.kt @@ -3,13 +3,15 @@ import com.algolia.search.configuration.ConfigurationSearch import com.algolia.search.model.APIKey import com.algolia.search.model.ApplicationID import com.algolia.search.model.response.ResponseSearch +import com.algolia.search.model.response.ResponseSearchForFacets import io.ktor.client.engine.mock.MockEngine import io.ktor.client.engine.mock.respond +import io.ktor.client.engine.mock.respondBadRequest import io.ktor.client.features.logging.LogLevel import io.ktor.client.request.HttpResponseData import io.ktor.http.ContentType import io.ktor.http.headersOf -import kotlinx.coroutines.io.ByteReadChannel +import io.ktor.utils.io.ByteReadChannel import kotlinx.serialization.KSerializer import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonConfiguration @@ -17,30 +19,63 @@ import kotlinx.serialization.json.JsonConfiguration val JsonNoDefaults = Json(JsonConfiguration.Stable.copy(encodeDefaults = false)) fun mockClient( - response: HttpResponseData = respondSearch() + response: HttpResponseData? = null ): ClientSearch { + val mockEngine = if (response != null) MockEngine { response } else { defaultMockEngine } + return mockClient(mockEngine) +} + +fun mockClient( + mockEngine: MockEngine): ClientSearch { return ClientSearch( ConfigurationSearch( ApplicationID("A"), APIKey("B"), - engine = MockEngine { response }, + engine = mockEngine, logLevel = LogLevel.ALL ) ) } -val responseSearch = ResponseSearch() - fun respondSearch(response: ResponseSearch = responseSearch) = respondJson(response, ResponseSearch.serializer()) -fun respondJson(response: T, serializer: KSerializer): HttpResponseData { +fun respondJson(response: T, serializer: KSerializer): MockEngine { val responseString = JsonNoDefaults.stringify(serializer, response) + return MockEngine { + respond( + headers = headersOf( + "Content-Type", + listOf(ContentType.Application.Json.toString()) + ), + content = ByteReadChannel(responseString) + ) + } +} + +fun respondBadRequest(): ClientSearch { + val mockEngine = MockEngine { + respondBadRequest() + } + return ClientSearch( + ConfigurationSearch( + ApplicationID("A"), + APIKey("B"), + engine = mockEngine, + logLevel = LogLevel.ALL + ) + ) +} + +val defaultMockEngine = MockEngine { + val responseString = JsonNoDefaults.stringify(ResponseSearch.serializer(), responseSearch) - return respond( + respond( headers = headersOf( "Content-Type", listOf(ContentType.Application.Json.toString()) ), content = ByteReadChannel(responseString) ) -} \ No newline at end of file +} + +val responseSearch = ResponseSearch() \ No newline at end of file diff --git a/helper/src/commonTest/kotlin/searcher/TestSearcherForFacets.kt b/helper/src/commonTest/kotlin/searcher/TestSearcherForFacets.kt index d105e0313..7b754baa9 100644 --- a/helper/src/commonTest/kotlin/searcher/TestSearcherForFacets.kt +++ b/helper/src/commonTest/kotlin/searcher/TestSearcherForFacets.kt @@ -4,8 +4,8 @@ import blocking import com.algolia.search.model.Attribute import com.algolia.search.model.IndexName import com.algolia.search.model.response.ResponseSearchForFacets -import io.ktor.client.engine.mock.respondBadRequest import mockClient +import respondBadRequest import respondJson import shouldBeFalse import shouldBeNull @@ -25,7 +25,7 @@ class TestSearcherForFacets { ) private val client = mockClient(respondJson(response, ResponseSearchForFacets.serializer())) private val index = client.initIndex(IndexName("index")) - private val clientError = mockClient(respondBadRequest()) + private val clientError = respondBadRequest() private val indexError = clientError.initIndex(IndexName("index")) @Test diff --git a/helper/src/commonTest/kotlin/searcher/TestSearcherSingleIndex.kt b/helper/src/commonTest/kotlin/searcher/TestSearcherSingleIndex.kt index 3e81a454b..89357d817 100644 --- a/helper/src/commonTest/kotlin/searcher/TestSearcherSingleIndex.kt +++ b/helper/src/commonTest/kotlin/searcher/TestSearcherSingleIndex.kt @@ -2,8 +2,8 @@ package searcher import blocking import com.algolia.search.model.IndexName -import io.ktor.client.engine.mock.respondBadRequest import mockClient +import respondBadRequest import responseSearch import shouldBeFalse import shouldBeNull @@ -17,7 +17,7 @@ class TestSearcherSingleIndex { private val client = mockClient() private val index = client.initIndex(IndexName("index")) - private val clientError = mockClient(respondBadRequest()) + private val clientError = respondBadRequest() private val indexError = clientError.initIndex(IndexName("index")) @Test