Skip to content

Commit 75e2325

Browse files
authored
Bugfix MTE-2964 Make "Bitrise Xcode Check and Update" works again (mozilla-mobile#20992)
* Reformat bitrise.yml by ruamel.yaml * Use default stack instead of latest/edge stacks * Modify stack just for NewXcodeVersions
1 parent ff9637b commit 75e2325

File tree

2 files changed

+52
-65
lines changed

2 files changed

+52
-65
lines changed

bitrise.yml

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ workflows:
4747
- restore-spm-cache@1:
4848
is_always_run: true
4949
- git::https://github.com/DamienBitrise/bitrise-test-plan-sharder.git@master:
50-
title: Bitrise Test Plan Sharder
51-
inputs:
52-
- xcode_project: Client.xcodeproj
53-
- target: Client
54-
- shards: '4'
55-
- scheme: Fennec
56-
- debug_mode: 'true'
57-
- test_path: ''
58-
- file_type: ".swift"
50+
title: Bitrise Test Plan Sharder
51+
inputs:
52+
- xcode_project: Client.xcodeproj
53+
- target: Client
54+
- shards: '4'
55+
- scheme: Fennec
56+
- debug_mode: 'true'
57+
- test_path: ''
58+
- file_type: ".swift"
5959
6060
title: Build for Testing
6161
inputs:
@@ -74,8 +74,7 @@ workflows:
7474
timeout: 600
7575
inputs:
7676
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.5
77-
- xcodebuild_options: '"COMPILER_INDEX_STORE_ENABLE=NO"
78-
"CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
77+
- xcodebuild_options: '"COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
7978
- xctestrun: "/Users/vagrant/git/DerivedData/Build/Products/Fennec_UnitTest_iphonesimulator17.5-arm64.xctestrun"
8079
- maximum_test_repetitions: 2
8180
- save-spm-cache@1:
@@ -132,7 +131,7 @@ workflows:
132131
133132
echo "bitrise_xcode"
134133
COUNT_XCUI=$(./test-fixtures/generate-metrics.sh /Users/vagrant/git/xcodebuild_fennec.log all)
135-
134+
136135
envman add --key SHOW_WARNING_IN_SLACK --value Show_Warnings
137136
envman add --key SHOW_WARNING_COUNT_XCUI --value "$COUNT_XCUI"
138137
@@ -174,35 +173,35 @@ workflows:
174173

175174
build_and_test_1_SmokeTest1:
176175
envs:
177-
- opts:
178-
is_expand: false
179-
SHARD: '1'
176+
- opts:
177+
is_expand: false
178+
SHARD: '1'
180179
after_run:
181-
- _build_and_test
180+
- _build_and_test
182181

183182
build_and_test_2_SmokeTest2:
184183
envs:
185-
- opts:
186-
is_expand: false
187-
SHARD: '2'
184+
- opts:
185+
is_expand: false
186+
SHARD: '2'
188187
after_run:
189-
- _build_and_test
188+
- _build_and_test
190189

191190
build_and_test_3_SmokeTest3:
192191
envs:
193-
- opts:
194-
is_expand: false
195-
SHARD: '3'
192+
- opts:
193+
is_expand: false
194+
SHARD: '3'
196195
after_run:
197-
- _build_and_test
196+
- _build_and_test
198197

199198
build_and_test_4_SmokeTest4:
200199
envs:
201-
- opts:
202-
is_expand: false
203-
SHARD: '4'
200+
- opts:
201+
is_expand: false
202+
SHARD: '4'
204203
after_run:
205-
- _build_and_test
204+
- _build_and_test
206205

207206
_build_and_test:
208207
before_run:
@@ -216,15 +215,12 @@ workflows:
216215
timeout: 1200
217216
inputs:
218217
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.5
219-
- xcodebuild_options: '"-derivedDataPath" "/Users/vagrant/git/DerivedData"
220-
"COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY="
221-
"CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
218+
- xcodebuild_options: '"-derivedDataPath" "/Users/vagrant/git/DerivedData" "COMPILER_INDEX_STORE_ENABLE=NO" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"'
222219
- xctestrun: "Users/vagrant/git/DerivedData/Build/Products/Fennec_Smoketest${SHARD}_iphonesimulator17.5-arm64.xctestrun"
223220
224221
run_if: '{{getenv "RUN_UI_TESTS" | eq "Run_UI_Tests"}}'
225222
inputs:
226223
- pipeline_intermediate_files: '$BITRISE_XCRESULT_PATH:BITRISE_UITESTS_${SHARD}_XCRESULT_PATH'
227-
228224
determine_apps_affected:
229225
steps:
230226
@@ -467,12 +463,12 @@ workflows:
467463
- script@1:
468464
inputs:
469465
- content: |-
470-
#!/usr/bin/env bash
471-
set -e
472-
set -x
473-
cd firefox-ios/Client.xcodeproj
474-
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Developer"/' project.pbxproj
475-
cd -
466+
#!/usr/bin/env bash
467+
set -e
468+
set -x
469+
cd firefox-ios/Client.xcodeproj
470+
sed -i '' 's/CODE_SIGN_IDENTITY = "iPhone Developer"/CODE_SIGN_IDENTITY = "iPhone Developer"/' project.pbxproj
471+
cd -
476472
title: Set xcodeproj code_sign_identity to iPhone Developer
477473
- script@1:
478474
inputs:
@@ -609,7 +605,7 @@ workflows:
609605
envman add --key RUN_UI_TESTS --value Run_UI_Tests
610606
exit 0
611607
fi
612-
608+
613609
# Match on file names in all directories and subdirectories
614610
#
615611
# Project Configs
@@ -762,6 +758,10 @@ workflows:
762758
- message: "The build run info: $BITRISE_GIT_MESSAGE"
763759
- webhook_url: "$WEBHOOK_SLACK_TOKEN"
764760
description: This Workflow is to build the app using latest xcode available in Bitrise
761+
meta:
762+
bitrise.io:
763+
stack: osx-xcode-15.4.x
764+
machine_type_id: g2-m1.8core
765765
L10nBuild:
766766
steps:
767767
- activate-ssh-key@4:
@@ -850,7 +850,8 @@ workflows:
850850
is_expand: false
851851
BITRISE_SCHEME: L10nSnapshotTest
852852
description: >-
853-
This Workflow is to run L10n tests in one locale and then share the bundle with the rest of the builds
853+
This Workflow is to run L10n tests in one locale and then share the bundle with
854+
the rest of the builds
854855
L10nScreenshotsTests:
855856
steps:
856857
- activate-ssh-key@4:
@@ -1227,7 +1228,7 @@ workflows:
12271228
- project_path: firefox-ios/Client.xcodeproj
12281229
- scheme: Fennec
12291230
- destination: platform=iOS Simulator,name=iPhone 15,OS=17.5
1230-
- test_plan: PerformanceTestPlan
1231+
- test_plan: PerformanceTestPlan
12311232
12321233
is_always_run: true
12331234
title: Create perfherder data object
@@ -1240,7 +1241,7 @@ workflows:
12401241
set -x
12411242
# get dependency
12421243
cd ./test-fixtures && git clone https://github.com/isabelrios/xcresult_extract.git
1243-
1244+
12441245
echo $BITRISE_XCRESULT_PATH
12451246
ls
12461247
ls $BITRISE_XCRESULT_PATH
@@ -1329,7 +1330,7 @@ workflows:
13291330
--no-record-video \
13301331
--client-details=matrixLabel="Bitrise" \
13311332
--quiet 2>&1)
1332-
1333+
13331334
GCLOUD_EXITCODE=$? # this will get the right-most command from the gcloud subshell
13341335
echo "GCLOUD_EXITCODE: $GCLOUD_EXITCODE"
13351336
@@ -1646,7 +1647,6 @@ workflows:
16461647
- channel: "#mobile-alerts-ios"
16471648
- message: "The build failed to build"
16481649
- webhook_url: "$SLACK_WEBHOOK"
1649-
16501650
focus_ui_test:
16511651
before_run:
16521652
- focus-pull-and-unzip-dependencies
@@ -1698,7 +1698,6 @@ workflows:
16981698
- channel: "#mobile-alerts-ios"
16991699
- message: "The build run the Focus testPlan: $TEST_PLAN_NAME"
17001700
- webhook_url: "$SLACK_WEBHOOK"
1701-
17021701
klar_unit_test:
17031702
before_run:
17041703
- focus-pull-and-unzip-dependencies
@@ -1754,7 +1753,7 @@ workflows:
17541753
- channel: "#mobile-alerts-ios"
17551754
- message: "The build run the Focus testPlan: UnitTests"
17561755
- webhook_url: "$SLACK_WEBHOOK"
1757-
1756+
17581757
# # FOCUS UTILITIES WORKFLOWS
17591758
focus-clone-and-build-dependencies:
17601759
description: Clones the repo and builds dependencies
@@ -1771,7 +1770,7 @@ workflows:
17711770
title: ContentBlockerGen
17721771

17731772
focus-pull-and-unzip-dependencies:
1774-
description: Pulls and unzip the dependencies from previous stage
1773+
description: Pulls and unzip the dependencies from previous stage
17751774
steps:
17761775
- pull-intermediate-files@1:
17771776
inputs:

test-fixtures/update.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121
]
2222
'''
2323
pattern = 'osx-xcode-'
24-
version_name = 'ventura'
25-
patterns = [pattern, version_name]
24+
patterns = [pattern]
2625
BITRISE_YML = 'bitrise.yml'
2726
WORKFLOW = 'NewXcodeVersions'
2827

29-
3028
resp = requests.get(BITRISE_STACK_INFO)
3129
resp.raise_for_status()
3230
resp_json = resp.json()
@@ -41,36 +39,26 @@ def parse_semver(raw_str):
4139
return False
4240

4341

44-
def available_stacks():
42+
def default_stack():
4543
try:
4644
resp = requests.get(BITRISE_STACK_INFO)
4745
resp_json = resp.json()
48-
return resp_json['available_stacks']
46+
return resp_json['project_types_with_default_stacks']['ios']['default_stack']
4947
except HTTPError as http_error:
5048
print('An HTTP error has occurred: {http_error}')
5149
except Exception as err:
5250
print('An exception has occurred: {err}')
5351

54-
55-
def largest_version():
56-
stacks = available_stacks()
57-
for item in stacks:
58-
# only look at XCode versions that aren't in beta
59-
if stacks[item]['beta-tag'] != '': continue
60-
# use the first version in the list that matches both platform and version
61-
if all([x in item for x in patterns]):
62-
return '{0}.x'.format('.'.join(item.split('.')[0:2]))
63-
6452
if __name__ == '__main__':
6553
'''
6654
STEPS
67-
1. check bitrise API stack info for latest XCode version
55+
1. check bitrise API stack info for the default stack version
6856
2. compare latest with current bitrise.yml stack version in repo
6957
3. if same exit, if not, continue
7058
4. modify bitrise.yml (update stack value)
7159
'''
7260

73-
largest_semver = largest_version()
61+
largest_semver = default_stack().split(pattern)[1]
7462
tmp_file = 'tmp.yml'
7563

7664
with open(BITRISE_YML, 'r') as infile:
@@ -84,7 +72,7 @@ def largest_version():
8472
y = obj_yaml.load(infile)
8573

8674
current_semver = y['workflows'][WORKFLOW]['meta']['bitrise.io']['stack']
87-
75+
8876
# remove pattern prefix from current_semver to compare with largest
8977
current_semver = current_semver.split(pattern)[1]
9078

0 commit comments

Comments
 (0)