From 159fa53aa89a670ad6cae187d466eb9e5ae7422f Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Mon, 14 Oct 2024 16:19:31 +0200 Subject: [PATCH] Add ios ui tests to the workflow --- .github/workflows/ios_tests.yml | 56 +++++++--------------------- .github/workflows/ios_ui_tests.yml | 13 +++++-- .github/workflows/ios_unit_tests.yml | 53 ++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/ios_unit_tests.yml diff --git a/.github/workflows/ios_tests.yml b/.github/workflows/ios_tests.yml index fc2dd691..0e064941 100644 --- a/.github/workflows/ios_tests.yml +++ b/.github/workflows/ios_tests.yml @@ -1,4 +1,4 @@ -name: Swift unit tests +name: iOS tests on: workflow_call: @@ -6,48 +6,18 @@ on: flutter-version: description: 'Flutter version' required: true - default: '3.16.2' + default: '3.24.0' type: string jobs: - ios_tests: - runs-on: macos-13 - defaults: - run: - working-directory: example/ios - timeout-minutes: 30 - - steps: - - uses: actions/checkout@v4 - - - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ inputs.flutter-version }} - channel: 'stable' - cache: true - - - run: flutter doctor -v - - run: flutter clean - - run: flutter pub get - - - name: Pod install - run: pod install - - - name: Lint check - working-directory: ios - run: swiftlint --config .swiftlint.yml --output "swiftLintReport.json" - - - name: Cache iOS reports - uses: actions/cache/save@v4 - id: save-iOS-reports - with: - path: ios/ - key: ios-reports - - - name: Run ios unit tests - run: | - xcodebuild test \ - -workspace Runner.xcworkspace \ - -scheme Runner \ - -destination "platform=iOS Simulator,name=iPhone 14" \ - -enableCodeCoverage YES | xcpretty --utf --color && exit ${PIPESTATUS[0]} \ No newline at end of file + ios_unit_tests: + name: iOS unit tests + uses: ./.github/workflows/ios_unit_tests.yml + with: + flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }} + android_ui_tests: + name: iOS ui tests + uses: ./.github/workflows/ios_ui_tests.yml + with: + flutter-version: ${{ needs.preparation.outputs.FLUTTER_VERSION }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/ios_ui_tests.yml b/.github/workflows/ios_ui_tests.yml index cf61d524..afc3aa8c 100644 --- a/.github/workflows/ios_ui_tests.yml +++ b/.github/workflows/ios_ui_tests.yml @@ -3,6 +3,12 @@ name: iOS ui tests on: workflow_dispatch: workflow_call: + inputs: + flutter-version: + description: 'Flutter version' + required: true + default: '3.24.0' + type: string jobs: ios_ui_tests: @@ -19,12 +25,13 @@ jobs: - uses: subosito/flutter-action@v2 with: - flutter-version: '3.24.0' + flutter-version: ${{ inputs.flutter-version }} channel: 'stable' + cache: true + cache-key: ${{ env.FLUTTER_VERSION }} - run: flutter pub get - run: dart pub global activate patrol_cli - run: patrol doctor - run: open -a Simulator && xcrun simctl boot 'iPhone 15' -# TODO Add github environment values -# - run: patrol test -t example/integration_test/drop_in_test/open_drop_in_test.dart -d 'iPhone 15' \ No newline at end of file + - run: patrol test -t example/integration_test/drop_in_test/open_drop_in_test.dart --dart-define=CLIENT_KEY='${{ secrets.ADYEN_TEST_CLIENT_KEY }}' --dart-define=X_API_KEY='${{ secrets.ADYEN_TEST_X_API_KEY }}' -d 'iPhone 15' \ No newline at end of file diff --git a/.github/workflows/ios_unit_tests.yml b/.github/workflows/ios_unit_tests.yml new file mode 100644 index 00000000..a6eacec5 --- /dev/null +++ b/.github/workflows/ios_unit_tests.yml @@ -0,0 +1,53 @@ +name: iOS unit tests + +on: + workflow_call: + inputs: + flutter-version: + description: 'Flutter version' + required: true + default: '3.24.0' + type: string + +jobs: + ios_tests: + runs-on: macos-13 + defaults: + run: + working-directory: example/ios + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ inputs.flutter-version }} + channel: 'stable' + cache: true + + - run: flutter doctor -v + - run: flutter clean + - run: flutter pub get + + - name: Pod install + run: pod install + + - name: Lint check + working-directory: ios + run: swiftlint --config .swiftlint.yml --output "swiftLintReport.json" + + - name: Cache iOS reports + uses: actions/cache/save@v4 + id: save-iOS-reports + with: + path: ios/ + key: ios-reports + + - name: Run ios unit tests + run: | + xcodebuild test \ + -workspace Runner.xcworkspace \ + -scheme Runner \ + -destination "platform=iOS Simulator,name=iPhone 14" \ + -enableCodeCoverage YES | xcpretty --utf --color && exit ${PIPESTATUS[0]} \ No newline at end of file