AvdLee / appstoreconnect-swift-sdk

The Swift SDK to work with the App Store Connect API from Apple.
Other
1.48k stars 198 forks source link

Add support for Linux #221

Closed Shakarang closed 1 year ago

Shakarang commented 1 year ago

Hello!

We've added support for Linux in the package to allow anyone to use it on CI. There were two issues to fix:

URLSession

URLSession is part of FoundationNetworking framework on Linux. We've added the import when the framework exists.

CommonCrypto

As CommonCrypto is not available on Linux, we had to use another way to sign the JWT token. We're using Apple made swift-crypto. It removes a lot of manual operations as the signature is available in their framework.

This framework requires macOS 11, so adding it would drop support for macOS 10.15. However, as the latest Xcode only supports macOS 12, this can be acceptable.

API Changes

We've updated the APIConfiguration initialiser to make it throwable when the given key is not valid. This allows to build the private key only once, and throw an error as soon as possible when we know the key is not correct.

SwiftLeeBot commented 1 year ago
Warnings
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AgeRatingDeclaration' is deprecated: Deprecated
:warning: 'InAppPurchases' is deprecated: Deprecated
:warning: 'PricePoints' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppPricePoint' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
:warning: 'AppStoreVersionSubmission' is deprecated: Deprecated
Messages
:book: AppStoreConnect-Swift-SDK-Tests: Executed 11 tests (0 failed, 0 retried, 0 skipped) in 0.056 seconds
:book: View more details on Bitrise

Code Coverage Report

Name Coverage

SwiftLint found issues

Severity File Reason
Warning Package.swift:32 Line should be 140 characters or less: currently 154 characters (line_length)
Warning APIConfigurationTests.swift:9 Imports should be sorted. (sorted_imports)
Warning APIConfigurationTests.swift:29 Parentheses are not needed when declaring closure arguments. (unneeded_parentheses_in_closure_argument)
Warning APIConfigurationTests.swift:38 Parentheses are not needed when declaring closure arguments. (unneeded_parentheses_in_closure_argument)
Warning APIConfigurationTests.swift:18 Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)
Warning DefaultRequestExecutor.swift:35 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning DefaultRequestExecutor.swift:46 Chained function calls should be either on the same line, or one per line. (multiline_function_chains)
Warning DefaultRequestExecutor.swift:60 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning DefaultRequestExecutor.swift:79 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning JWTRequestsAuthenticator.swift:24 Line should be 140 characters or less: currently 145 characters (line_length)
Warning JWTRequestsAuthenticator.swift:29 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning JWT.swift:77 Let and var should be separated from other statements by a blank line. (let_var_whitespace)
Warning JWT.swift:42 Line should be 140 characters or less: currently 141 characters (line_length)
Warning JWT.swift:87 Line should be 140 characters or less: currently 143 characters (line_length)
Warning JWT.swift:105 Line should be 140 characters or less: currently 154 characters (line_length)
Warning JWT.swift:9 Imports should be sorted. (sorted_imports)
Warning Endpoint.swift:58 Line should be 140 characters or less: currently 149 characters (line_length)
Warning Endpoint.swift:66 Line should be 140 characters or less: currently 148 characters (line_length)
Warning Endpoint.swift:74 Line should be 140 characters or less: currently 150 characters (line_length)
Warning Endpoint.swift:82 Line should be 140 characters or less: currently 151 characters (line_length)
Warning Endpoint.swift:113 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning Endpoint.swift:128 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning APIProvider.swift:72 Use shorthand syntax for optional binding (shorthand_optional_binding)
Warning APIProvider.swift:9 Imports should be sorted. (sorted_imports)
Warning APIProvider.swift:293 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:303 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:319 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:332 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:343 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:353 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:361 Lines should not have trailing whitespace. (trailing_whitespace)
Warning APIProvider.swift:102 Parentheses are not needed when declaring closure arguments. (unneeded_parentheses_in_closure_argument)
Warning JWTRequestsAuthenticatorTests.swift:18 Method 'setUp()' should call to super function (overridden_super_call)
Warning JWTRequestsAuthenticatorTests.swift:10 Imports should be sorted. (sorted_imports)
Warning JWTRequestsAuthenticatorTests.swift:11 Imports should be sorted. (sorted_imports)
Warning APIProviderTests.swift:43 Method 'setUp()' should call to super function (overridden_super_call)
Warning APIProviderTests.swift:9 Imports should be sorted. (sorted_imports)

Generated by :no_entry_sign: Danger Swift against 470c61839cc6fd11b812cd4285a21655f424bcf3

Shakarang commented 1 year ago

Thanks a lot for the quick review 🚀

AvdLee commented 1 year ago

@Shakarang could you have a look at the tests? 🙏

Shakarang commented 1 year ago

All good now, thanks @AvdLee 🥳