Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate the StoreKit2 purchase method #10

Merged
merged 27 commits into from
Jan 5, 2024
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7147706
Implement a common store kit product
ns-vasilev Dec 11, 2023
42e3584
Implement fetching products using the `StoreKit2` API
ns-vasilev Dec 18, 2023
7754b06
Write comments for public interfaces
ns-vasilev Dec 18, 2023
d3d4fa8
Update `ci.yml`
ns-vasilev Dec 18, 2023
a8cfef0
Fix action errors
ns-vasilev Dec 18, 2023
a9ce687
Update the `Ruby` version from `2.7` to `3.1.4`
ns-vasilev Dec 18, 2023
efa0928
Implement `StoreTransaction` model
ns-vasilev Dec 21, 2023
bd616d9
Create a `StoreTransaction` object
ns-vasilev Dec 27, 2023
40ce913
Update `purchase(_:)` methods' parameters
ns-vasilev Dec 27, 2023
04839f2
Integrate a host app for unit-tests
ns-vasilev Dec 28, 2023
5242ebf
Refactor unit tests
ns-vasilev Dec 29, 2023
7bb4a64
Refactor the test target for supported platforms
ns-vasilev Dec 29, 2023
bc561e4
Update `ci.yml`
ns-vasilev Dec 29, 2023
8f5dcb4
Remove `ObjectFactory` dependency
ns-vasilev Dec 29, 2023
978641c
Update `project.yml`
ns-vasilev Dec 29, 2023
69923de
Refactor test cases
ns-vasilev Dec 29, 2023
27dbbba
Update `ci.yml`
ns-vasilev Dec 29, 2023
dc5ed78
Update `CHANGELOG.md`
ns-vasilev Dec 30, 2023
8d294ab
Fix `Package.swift` & `Package@swift-5.7.swift`
ns-vasilev Dec 30, 2023
239e38a
Add `Package@swift-5.8.swift`
ns-vasilev Dec 30, 2023
e828dc4
Implement integration tests
ns-vasilev Dec 31, 2023
79ee91d
Update configuration
ns-vasilev Dec 31, 2023
0154406
Fix typos
ns-vasilev Dec 31, 2023
2f3d1bc
Write a script for merging test results from various platforms
ns-vasilev Dec 31, 2023
b03b78c
Implement the `finish(_:)` transaction method
ns-vasilev Jan 3, 2024
b39b3d4
Upload test coverate reports
ns-vasilev Jan 3, 2024
6124451
Rename step
ns-vasilev Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 178 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -13,10 +13,6 @@ on:
- "Source/**"
- "Tests/**"

concurrency:
group: ci
cancel-in-progress: true

jobs:
SwiftLint:
runs-on: ubuntu-latest
@@ -28,56 +24,202 @@ jobs:
args: --strict
env:
DIFF_BASE: ${{ github.base_ref }}
Latest:
name: Test Latest (iOS, macOS, tvOS, watchOS)
runs-on: macOS-12
macOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/Xcode_14.1.app/Contents/Developer"
timeout-minutes: 10
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=16.1,name=iPhone 14 Pro"
name: "iOS"
scheme: "Flare"
sdk: iphonesimulator
- destination: "OS=16.1,name=Apple TV"
name: "tvOS"
scheme: "Flare"
sdk: appletvsimulator
- destination: "OS=9.1,name=Apple Watch Series 8 (45mm)"
name: "watchOS"
scheme: "Flare"
sdk: watchsimulator
- destination: "platform=macOS"
name: "macOS"
scheme: "Flare"
sdk: macosx
- xcode: "Xcode_15.0"
runsOn: macos-13
name: "macOS 13, Xcode 15.0, Swift 5.9.0"
- xcode: "Xcode_14.3.1"
runsOn: macos-13
name: "macOS 13, Xcode 14.3.1, Swift 5.8.0"
- xcode: "Xcode_14.2"
runsOn: macOS-12
name: "macOS 12, Xcode 14.2, Swift 5.7.2"
- xcode: "Xcode_14.1"
runsOn: macOS-12
name: "macOS 12, Xcode 14.1, Swift 5.7.1"
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.sdk }}.xcresult" | xcpretty -r junit
run: xcodebuild test -scheme "Flare" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: "./${{ matrix.sdk }}.xcresult"
Beta:
name: "Test Betas"
runs-on: macos-13
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

iOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0.1,name=iPhone 14 Pro"
name: "iOS 17.0.1"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=iPhone 14 Pro"
name: "iOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

tvOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0,name=Apple TV"
name: "tvOS 17.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=Apple TV"
name: "tvOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

watchOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/Xcode_15.0.app/Contents/Developer"
timeout-minutes: 10
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=1.0,name=Apple Vision Pro"
name: "visionOS"
scheme: "Flare"
- destination: "OS=10.0,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=9.4,name=Apple Watch Series 8 (45mm)"
name: "watchOS 9.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
- destination: "OS=8.5,name=Apple Watch Series 7 (45mm)"
name: "watchOS 8.5"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan UnitTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

spm:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- name: "Xcode 15"
xcode: "Xcode_15.0"
runsOn: macos-13
- name: "Xcode 14"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: swift build -c release --target Flare

merge-test-reports:
needs: [iOS, macOS, watchOS, tvOS]
runs-on: macos-13
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: test_output
- run: xcrun xcresulttool merge test_output/**/*.xcresult --output-path test_output/final/final.xcresult
- name: Upload Merged Artifact
uses: actions/upload-artifact@v4
with:
name: MergedResult
path: test_output/final

# Beta:
# name: ${{ matrix.name }}
# runs-on: firebreak
# env:
# DEVELOPER_DIR: "/Applications/Xcode_15.0.app/Contents/Developer"
# timeout-minutes: 10
# strategy:
# fail-fast: false
# matrix:
# include:
# - destination: "OS=1.0,name=Apple Vision Pro"
# name: "visionOS 1.0"
# scheme: "Flare"
# steps:
# - uses: actions/checkout@v3
# - name: ${{ matrix.name }}
# run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean || exit 1
2 changes: 1 addition & 1 deletion .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.1.4
bundler-cache: true
- name: Checkout code
uses: actions/checkout@v2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -88,3 +88,4 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
*.xcodeproj
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ excluded:
- Tests
- Package.swift
- Package@swift-5.7.swift
- Package@swift-5.8.swift
- .build

# Rules
@@ -10,6 +11,7 @@ disabled_rules:
- trailing_comma
- todo
- opening_brace
- unneeded_synthesized_initializer

opt_in_rules: # some rules are only opt-in
- anyobject_protocol
17 changes: 17 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/Flare.xcscheme
Original file line number Diff line number Diff line change
@@ -34,6 +34,20 @@
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Flare_FlareTests"
BuildableName = "Flare_FlareTests"
BlueprintName = "Flare_FlareTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
@@ -75,6 +89,9 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<StoreKitConfigurationFileReference
identifier = "../../../Tests/FlareTests/Flare.storekit">
</StoreKitConfigurationFileReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
52 changes: 52 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/FlareTests.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "FlareTests"
BuildableName = "FlareTests"
BlueprintName = "FlareTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
## [Unreleased]

## Added
- Integrate the `StoreKit2` purchase method
- Added in Pull Request [#10](https://github.com/space-code/flare/pull/10).

- Add badges for `Swift Version Compatibility` and `Platform Compatibility`
- Added in Pull Request [#7](https://github.com/space-code/flare/pull/8).

8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -16,4 +16,10 @@ lint:
fmt:
mint run swiftformat Sources Tests

.PHONY: all bootstrap hook mint lint fmt
generate:
xcodegen generate

setup_build_tools:
sh scripts/setup_build_tools.sh

.PHONY: all bootstrap hook mint lint fmt generate setup_build_tools
Loading