From a54938cd8c4aa57f80811def6c414bf450113674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikko=20Va=CC=88lima=CC=88ki?= Date: Wed, 24 Jul 2024 17:15:13 +0300 Subject: [PATCH] Export test artifacts --- .github/workflows/xcode.yml | 6 ++++++ .gitignore | 4 +++- fastlane/Fastfile | 23 ++++++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/xcode.yml b/.github/workflows/xcode.yml index 9bf193c..6d66bad 100644 --- a/.github/workflows/xcode.yml +++ b/.github/workflows/xcode.yml @@ -42,3 +42,9 @@ jobs: - name: Test UI run: | bundle exec fastlane test_ui + - name: Archive UI test results on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-results + path: artifacts/ diff --git a/.gitignore b/.gitignore index 17d154d..3b0477d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ -# Created by https://www.gitignore.io/api/xcode,swift,objective-c,carthage,cocoapods +# GitHub + +artifacts ### Carthage ### # Carthage diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b6af9fb..675be74 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -4,14 +4,35 @@ platform :ios do desc "Run UI Tests" lane :test_ui do - run_tests( + scan( workspace: "DrawerView.xcworkspace", scheme: "DrawerViewUI", + ensure_devices_found: true, include_simulator_logs: false, output_xctestrun: false, verbose: true, open_report: false, + clean: true ) + + persist_artifacts end end + +error do |lane, exception| + persist_artifacts +end + +private_lane :persist_artifacts do |options| + xcresult_path = Actions.lane_context[SharedValues::SCAN_GENERATED_XCRESULT_PATH] + if "#{xcresult_path}" != "" + puts "Copying artifacts from #{xcresult_path}..." + copy_artifacts( + target_path: "artifacts", + artifacts: ["#{xcresult_path}"] + ) + else + puts "No xcresult_path specified, no artifacts to copy" + end +end