Skip to content

Commit 56061bb

Browse files
authored
Merge pull request #579 from session-foundation/dev
Release 2.14.3
2 parents 65bcb4c + dc234ca commit 56061bb

File tree

427 files changed

+15236
-5945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

427 files changed

+15236
-5945
lines changed

.drone.jsonnet

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ local clean_up_old_test_sims_on_commit_trigger = {
7777
{
7878
name: 'Build and Run Tests',
7979
commands: [
80-
'echo "Explicitly running unit tests on \'App_Store_Release\' configuration to ensure optimisation behaviour is consistent"',
81-
'echo "If tests fail inconsistently from local builds this is likely the difference"',
82-
'echo ""',
83-
'NSUnbufferedIO=YES xcodebuild test -project Session.xcodeproj -scheme Session -derivedDataPath ./build/derivedData -resultBundlePath ./build/artifacts/testResults.xcresult -parallelizeTargets -configuration "App_Store_Release" -destination "platform=iOS Simulator,id=$(<./build/artifacts/sim_uuid)" -parallel-testing-enabled NO -test-timeouts-enabled YES -maximum-test-execution-time-allowance 10 -collect-test-diagnostics never ENABLE_TESTABILITY=YES 2>&1 | xcbeautify --is-ci',
80+
'./Scripts/build_ci.sh test -resultBundlePath ./build/artifacts/testResults.xcresult -destination "platform=iOS Simulator,id=$(<./build/artifacts/sim_uuid)" -parallel-testing-enabled NO -test-timeouts-enabled YES -maximum-test-execution-time-allowance 10 -collect-test-diagnostics never ENABLE_TESTABILITY=YES',
8481
],
8582
depends_on: [
8683
'Reset SPM Cache if Needed',
@@ -99,31 +96,27 @@ local clean_up_old_test_sims_on_commit_trigger = {
9996
status: ['success', 'failure'],
10097
},
10198
},
102-
{
103-
name: 'Check for Build/Test Failures',
104-
commands: [
105-
'echo "Checking for build errors or test failures in xcresult bundle..."',
106-
'xcresultparser --output-format cli --failed-tests-only ./build/artifacts/testResults.xcresult'
107-
],
108-
depends_on: ['Build and Run Tests']
109-
},
11099
{
111100
name: 'Log Failed Test Summary',
112101
commands: [
113102
'echo "--- FAILED TESTS ---"',
114-
'xcresultparser --output-format cli --failed-tests-only ./build/artifacts/testResults.xcresult'
103+
'xcresultparser --output-format cli --failed-tests-only ./build/artifacts/testResults.xcresult',
104+
'exit 1' // Always fail if this runs to make it more obvious in the UI
115105
],
116-
depends_on: ['Check for Build/Test Failures'],
106+
depends_on: ['Build and Run Tests'],
117107
when: {
118108
status: ['failure'], // Only run this on failure
119109
},
120110
},
121111
{
122-
name: 'Convert xcresult to xml',
112+
name: 'Generate Code Coverage Report',
123113
commands: [
124114
'xcresultparser --output-format cobertura ./build/artifacts/testResults.xcresult > ./build/artifacts/coverage.xml',
125115
],
126116
depends_on: ['Build and Run Tests'],
117+
when: {
118+
status: ['success'],
119+
},
127120
},
128121
],
129122
},
@@ -157,8 +150,7 @@ local clean_up_old_test_sims_on_commit_trigger = {
157150
{
158151
name: 'Build',
159152
commands: [
160-
'mkdir build',
161-
'NSUnbufferedIO=YES && xcodebuild archive -project Session.xcodeproj -scheme Session -derivedDataPath ./build/derivedData -parallelizeTargets -configuration "App_Store_Release" -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator" | xcbeautify --is-ci',
153+
'./Scripts/build_ci.sh archive -sdk iphonesimulator -archivePath ./build/Session_sim.xcarchive -destination "generic/platform=iOS Simulator"',
162154
],
163155
depends_on: [
164156
'Reset SPM Cache if Needed',

Scripts/EmojiGenerator.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ enum RemoteModel {
5353
case flags = "Flags"
5454
case components = "Component"
5555

56-
var localizedKey: String = {
56+
var localizedKey: String {
5757
switch self {
5858
case .smileys:
5959
return "Smileys"
@@ -77,8 +77,8 @@ enum RemoteModel {
7777
return "Flags"
7878
case .components:
7979
return "Component"
80-
}
81-
}()
80+
}
81+
}
8282
}
8383

8484
static func fetchEmojiData() throws -> Data {
@@ -569,8 +569,9 @@ extension EmojiGenerator {
569569
fileHandle.indent {
570570
let stringKey = "emojiCategory\(category.localizedKey)"
571571
let stringComment = "The name for the emoji category '\(category.rawValue)'"
572-
573-
fileHandle.writeLine("return NSLocalizedString(\"\(stringKey)\", comment: \"\(stringComment)\")")
572+
573+
fileHandle.writeLine("// \(stringComment)")
574+
fileHandle.writeLine("return \"\(stringKey)\".localized()")
574575
}
575576
}
576577
fileHandle.writeLine("}")

Scripts/build_ci.sh

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/bash
2+
3+
IFS=$' \t\n'
4+
5+
set -euo pipefail
6+
7+
if [ $# -lt 1 ]; then
8+
echo "Error: Missing mode. Usage: $0 [test|archive] [unique_xcodebuild_args...]"
9+
exit 1
10+
fi
11+
12+
MODE="$1"
13+
shift
14+
15+
COMMON_ARGS=(
16+
-project Session.xcodeproj
17+
-scheme Session
18+
-derivedDataPath ./build/derivedData
19+
-parallelizeTargets
20+
-configuration "App_Store_Release"
21+
)
22+
23+
UNIQUE_ARGS=("$@")
24+
XCODEBUILD_RAW_LOG=$(mktemp)
25+
26+
trap 'rm -f "$XCODEBUILD_RAW_LOG"' EXIT
27+
28+
if [[ "$MODE" == "test" ]]; then
29+
30+
echo "--- Running Build and Unit Tests (App_Store_Release) ---"
31+
32+
xcodebuild_exit_code=0
33+
34+
# We wrap the pipeline in parentheses to capture the exit code of xcodebuild
35+
# which is at PIPESTATUS[0]. We do not use tee to a file here, as the complexity
36+
# of reading back the UUID is not necessary if we pass it via args.
37+
(
38+
NSUnbufferedIO=YES xcodebuild test \
39+
"${COMMON_ARGS[@]}" \
40+
"${UNIQUE_ARGS[@]}" 2>&1 | tee "$XCODEBUILD_RAW_LOG" | xcbeautify --is-ci
41+
) || xcodebuild_exit_code=${PIPESTATUS[0]}
42+
43+
echo ""
44+
echo "--- xcodebuild finished with exit code: $xcodebuild_exit_code ---"
45+
46+
if [ "$xcodebuild_exit_code" -eq 0 ]; then
47+
echo "✅ All tests passed and build succeeded!"
48+
exit 0
49+
fi
50+
51+
echo ""
52+
echo "🔴 Build failed"
53+
echo "----------------------------------------------------"
54+
echo "Checking for test failures in xcresult bundle..."
55+
56+
xcresultparser --output-format cli --no-test-result --coverage ./build/artifacts/testResults.xcresult
57+
parser_output=$(xcresultparser --output-format cli --no-test-result ./build/artifacts/testResults.xcresult)
58+
59+
build_errors_count=$(echo "$parser_output" | grep "Number of errors" | awk '{print $NF}')
60+
failed_tests_count=$(echo "$parser_output" | grep "Number of failed tests" | awk '{print $NF}')
61+
62+
if [ "${build_errors_count:-0}" -gt 0 ] || [ "${failed_tests_count:-0}" -gt 0 ]; then
63+
echo ""
64+
echo "🔴 Found $build_errors_count build error(s) and $failed_tests_count failed test(s) in the xcresult bundle."
65+
exit 1
66+
else
67+
echo "No test failures found in results. Failure was likely a build error."
68+
echo ""
69+
70+
echo "--- Summary of Potential Build Errors ---"
71+
grep -E --color=always '(:[0-9]+:[0-9]+: error:)|(ld: error:)|(error: linker command failed)|(PhaseScriptExecution)|(rsync error:)' "$XCODEBUILD_RAW_LOG" || true
72+
echo ""
73+
echo "--- End of Raw Log ---"
74+
tail -n 20 "$XCODEBUILD_RAW_LOG"
75+
echo "-------------------------"
76+
exit "$xcodebuild_exit_code"
77+
fi
78+
79+
echo "----------------------------------------------------"
80+
exit "$xcodebuild_exit_code"
81+
82+
elif [[ "$MODE" == "archive" ]]; then
83+
84+
echo "--- Running Simulator Archive Build (App_Store_Release) ---"
85+
86+
NSUnbufferedIO=YES xcodebuild archive \
87+
"${COMMON_ARGS[@]}" \
88+
"${UNIQUE_ARGS[@]}" 2>&1 | xcbeautify --is-ci
89+
90+
else
91+
echo "Error: Invalid mode '$MODE' specified. Use 'test' or 'archive'."
92+
exit 1
93+
fi

0 commit comments

Comments
 (0)