Skip to content

Commit

Permalink
[Chore] Add test scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
blyscuit committed Dec 17, 2022
1 parent 51a58ee commit 865fa96
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 2 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/ios_sanity_full_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: iOS Sanity Full Tests

on:
schedule:
- cron: '0 0/3 * * *'
workflow_dispatch:

defaults:
run:
working-directory: iosApp

jobs:
test:
name: Test
runs-on: macOS-latest
timeout-minutes: 60
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.10.0
with:
access_token: ${{ github.token }}

- name: Set up JAVA 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Checkout source code
uses: actions/checkout@v2.3.2
with:
ref: develop
submodules: recursive

- name: Setup Konfig Properties
env:
KMM_KONFIG_PROPERTIES: ${{ secrets.KMM_KONFIG_PROPERTIES }}
run: |
cd ../buildSrc/src/main/kotlin/appPackage
touch BuildKonfig.kt
echo $KMM_KONFIG_PROPERTIES | base64 --decode > BuildKonfig.kt
- name: Cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install Bundle and check environment versions
run: |
echo 'Install Bundle'
bundle config path vendor/bundle
bundle install
echo 'Check environment setup versions'
ruby --version
gem --version
bundler --version
- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Generate KMM frameworks for Cocoapods
run: |
cd ..
./gradlew generateDummyFramework
- name: Cache Pods
uses: actions/cache@v2
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods Dependencies
run: bundle exec pod install

- name: Build and Test
run: bundle exec fastlane build_and_full_test
2 changes: 1 addition & 1 deletion iosApp/CICDTests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"id" : "907BC089-7FF9-4CC2-B76C-526FB9AF9732",
"name" : "Configuration 1",
"options" : {

"uiTestingScreenshotsLifetime" : "keepNever"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion iosApp/Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ xcode_summary.ignored_files = 'iosApp/Pods/**'
xcode_summary.inline_mode = true
xcode_summary.report xcresultPath

# # Xcov
# Xcov
xcov.report(
scheme: Constants.TESTS_SCHEME,
workspace: "iosApp/#{Constants.WORKSPACE_PATH}",
Expand Down
10 changes: 10 additions & 0 deletions iosApp/fastlane/Constants/Constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def self.TESTS_SCHEME
'Survey Staging'
end

# a scheme name for testing
def self.FULL_TESTS_SCHEME
'Survey Staging Extended Tests'
end

# a target name for tests
def self.TESTS_TARGET
'SurveyTests'
Expand All @@ -63,6 +68,11 @@ def self.UI_TESTS_TARGET
'SurveyUITests'
end

# a target name for Test Plan
def self.TEST_PLAN
'CICDTests'
end

# xcov output directory path
def self.XCOV_OUTPUT_DIRECTORY_PATH
'./fastlane/xcov_output'
Expand Down
8 changes: 8 additions & 0 deletions iosApp/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ platform :ios do
lane :build_and_test do
test_manager.build_and_test(
scheme: Constants.TESTS_SCHEME,
testplan: Constants.TEST_PLAN
)
end

desc 'Build and Full Test'
lane :build_and_full_test do
test_manager.build_and_test(
scheme: Constants.FULL_TESTS_SCHEME,
targets: [Constants.TESTS_TARGET, Constants.UI_TESTS_TARGET]
)
end
Expand Down
14 changes: 14 additions & 0 deletions iosApp/fastlane/Managers/TestManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,18 @@ def build_and_test(scheme:, targets:)
fail_build: false
)
end

def build_and_test(scheme:, testplan:)
@fastlane.scan(
scheme: scheme,
device: @device,
output_directory: @output_directory,
code_coverage: true,
result_bundle: true,
testplan: testplan,
number_of_retries: 2,
output_remove_retry_attempts: true,
fail_build: false
)
end
end

0 comments on commit 865fa96

Please sign in to comment.