1+ require "fastlane/action"
2+ require "fastlane_core/configuration/config_item"
3+ require "octokit"
4+ require_relative "../helper/asana_helper"
5+ require_relative "../helper/ddg_apple_automation_helper"
6+ require_relative "../helper/git_helper"
7+
18module Fastlane
2- module Actions
3- class TdsPerfTestAction < Action
4- def self . run ( params )
5- UI . message ( "Starting TDS Performance Testing..." )
6-
7- # Create temporary directory
8- tmp_dir = "#{ ENV [ 'TMPDIR' ] } /tds-perf-testing"
9-
10- begin
11- Actions . sh ( "mkdir -p \" #{ tmp_dir } \" " )
9+ module Actions
10+ class TdsPerfTestAction < Action
11+ def self . run ( params )
12+ UI . message ( "Starting TDS Performance Testing..." )
13+
14+ # Create temporary directory
15+ tmp_dir = "#{ ENV . fetch ( 'TMPDIR' , nil ) } /tds-perf-testing"
16+
17+ begin
18+ Actions . sh ( "mkdir -p \" #{ tmp_dir } \" " )
19+
20+ # Navigate to temp directory
21+ Dir . chdir ( tmp_dir ) do
22+ # Clone repository
23+ Actions . sh ( "git clone --depth=1 git@github.com:duckduckgo/TrackerRadarKit.git" )
24+
25+ # Navigate to cloned repository
26+ Dir . chdir ( "TrackerRadarKit" ) do
27+ # Set environment variables and run test
28+ test_command = [
29+ "env" ,
30+ "TEST_RUNNER_TDS_UT_FILE_NAME=#{ params [ :ut_file_name ] } " ,
31+ "TEST_RUNNER_TDS_UT_URL=#{ params [ :ut_url ] } " ,
32+ "TEST_RUNNER_TDS_REF_FILE_NAME=#{ params [ :ref_file_name ] } " ,
33+ "TEST_RUNNER_TDS_REF_URL=#{ params [ :ref_url ] } " ,
34+ "xcodebuild test-without-building" ,
35+ "-scheme TrackerRadarKit" ,
36+ "-destination 'platform=macOS'" ,
37+ "-only-testing:TrackerRadarKitPerformanceTests/NextTrackerDataSetPerformanceTests"
38+ ] . join ( " " )
1239
13- # Navigate to temp directory
14- Dir . chdir ( tmp_dir ) do
15- # Clone repository
16- Actions . sh ( "git clone --depth=1 git@github.com:duckduckgo/TrackerRadarKit.git" )
17-
18- # Navigate to cloned repository
19- Dir . chdir ( "TrackerRadarKit" ) do
20- # Set environment variables and run test
21- test_command = [
22- "env" ,
23- "TEST_RUNNER_TDS_UT_FILE_NAME=#{ params [ :ut_file_name ] } " ,
24- "TEST_RUNNER_TDS_UT_URL=#{ params [ :ut_url ] } " ,
25- "TEST_RUNNER_TDS_REF_FILE_NAME=#{ params [ :ref_file_name ] } " ,
26- "TEST_RUNNER_TDS_REF_URL=#{ params [ :ref_url ] } " ,
27- "xcodebuild test-without-building" ,
28- "-scheme TrackerRadarKit" ,
29- "-destination 'platform=macOS'" ,
30- "-only-testing:TrackerRadarKitPerformanceTests/NextTrackerDataSetPerformanceTests"
31- ] . join ( " " )
32-
33- begin
34- Actions . sh ( test_command )
35- result = true
36- rescue => ex
37- UI . error ( "Performance tests failed: #{ ex } " )
38- result = false
39- end
40+ begin
41+ Actions . sh ( test_command )
42+ true
43+ rescue StandardError => e
44+ UI . error ( "Performance tests failed: #{ e } " )
45+ false
4046 end
4147 end
42- ensure
43- # Cleanup step - always executed regardless of success or failure
44- UI . message ( "Cleaning up temporary test directory..." )
45- Actions . sh ( "rm -rf \" #{ tmp_dir } \" " )
4648 end
49+ ensure
50+ # Cleanup step - always executed regardless of success or failure
51+ UI . message ( "Cleaning up temporary test directory..." )
52+ Actions . sh ( "rm -rf \" #{ tmp_dir } \" " )
4753 end
48-
49- def self . description
50- "Runs performance tests for Tracker Radar Kit with specified TDS files"
51- end
52-
53- def self . authors
54- [ "Your Name" ]
55- end
56-
57- def self . available_options
58- [
59- FastlaneCore :: ConfigItem . new (
60- key : :ut_file_name ,
61- env_name : "TEST_RUNNER_TDS_UT_FILE_NAME" ,
62- description : "The file name for the under-test TDS " ,
63- type : String ,
64- optional : false
65- ) ,
66- FastlaneCore :: ConfigItem . new (
67- key : :ut_url ,
68- env_name : "TEST_RUNNER_TDS_UT_URL" ,
69- description : "The URL for the under-test TDS " ,
70- type : String ,
71- optional : false
72- ) ,
73- FastlaneCore :: ConfigItem . new (
74- key : :ref_file_name ,
75- env_name : "TEST_RUNNER_TDS_REF_FILE_NAME" ,
76- description : "The file name for the reference TDS " ,
77- type : String ,
78- optional : false
79- ) ,
80- FastlaneCore :: ConfigItem . new (
81- key : :ref_url ,
82- env_name : "TEST_RUNNER_TDS_REF_URL" ,
83- description : "The URL for the reference TDS " ,
84- type : String ,
85- optional : false
86- )
87- ]
88- end
89-
90- def self . is_supported? ( platform )
91- [ :ios , :mac ] . include ?( platform )
92- end
93-
94- def self . return_value
95- "Returns true if tests passed, false otherwise"
96- end
54+ end
55+
56+ def self . description
57+ "Runs performance tests for Tracker Radar Kit with specified TDS files"
58+ end
59+
60+ def self . authors
61+ [ "Your Name" ]
62+ end
63+
64+ def self . available_options
65+ [
66+ FastlaneCore :: ConfigItem . new (
67+ key : :ut_file_name ,
68+ env_name : "TEST_RUNNER_TDS_UT_FILE_NAME " ,
69+ description : "The file name for the under-test TDS" ,
70+ type : String ,
71+ optional : false
72+ ) ,
73+ FastlaneCore :: ConfigItem . new (
74+ key : :ut_url ,
75+ env_name : "TEST_RUNNER_TDS_UT_URL " ,
76+ description : "The URL for the under-test TDS" ,
77+ type : String ,
78+ optional : false
79+ ) ,
80+ FastlaneCore :: ConfigItem . new (
81+ key : :ref_file_name ,
82+ env_name : "TEST_RUNNER_TDS_REF_FILE_NAME " ,
83+ description : "The file name for the reference TDS" ,
84+ type : String ,
85+ optional : false
86+ ) ,
87+ FastlaneCore :: ConfigItem . new (
88+ key : :ref_url ,
89+ env_name : "TEST_RUNNER_TDS_REF_URL " ,
90+ description : "The URL for the reference TDS" ,
91+ type : String ,
92+ optional : false
93+ )
94+ ]
95+ end
96+
97+ def self . is_supported ?( platform )
98+ [ :ios , :mac ] . include? ( platform )
99+ end
100+
101+ def self . return_value
102+ "Returns true if tests passed, false otherwise"
97103 end
98104 end
99105 end
100-
106+ end
0 commit comments