Commit 1814c4b
ci: improve safety and reliability of integration logcat script
This PR improves the stability, safety, and maintainability of the integration
test Bash script used in the Android CI pipeline.
### ✔ Summary of Improvements
This update focuses on hardening the script and preventing silent failures,
unexpected behavior, and log corruption during integration test execution.
### 🔧 Key Changes
- Enabled strict Bash mode (`set -euo pipefail`) to ensure the script stops on
errors, avoids undefined variables, and surfaces pipeline failures.
- Quoted all variable expansions to prevent word-splitting, globbing, and
incorrect argument parsing during CI execution.
- Replaced the hardcoded Codecov token with a secure environment variable
(`$CODECOV_TOKEN`) to avoid credential leakage in the repository.
- Added proper cleanup logic for the background `adb logcat` process, using:
- `wait "$LOGCAT_PID"` to flush any buffered output
- `kill "$LOGCAT_PID" 2>/dev/null || true` to avoid CI crashes if the process exits early
- Improved the reliability of logcat upload logic and ensured that log files
are preserved whenever an integration test step fails.
- Ensured correct exit code propagation so that Drone CI reflects accurate
build/test results.
- General scripting cleanup and modernization to better align with Bash best
practices and CI reproducibility.
### 💡 Why These Changes Matter
The previous version of the script:
- could continue execution after failed commands,
- could kill unrelated processes or truncate log output,
- exposed a sensitive token in plain text,
- did not properly handle asynchronous processes,
- could cause inconsistent CI behavior depending on the environment.
With these improvements, the integration test pipeline becomes:
- more secure,
- more deterministic,
- easier to debug,
- and safer for automated execution.
### 🧪 Testing Notes
Only CI-related behavior was modified.
No app logic was touched.
This PR has been tested across multiple invocations to confirm stable behavior
and proper log handling.
---
This PR does not affect end users but significantly improves CI reliability for
maintainers and contributors.
Signed-off-by: Gorlesunilkumar <[email protected]>1 parent f09e71e commit 1814c4b
1 file changed
+19
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | | - | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
35 | 38 | | |
36 | | - | |
37 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | | - | |
41 | | - | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | | - | |
| 56 | + | |
51 | 57 | | |
52 | | - | |
53 | | - | |
| 58 | + | |
| 59 | + | |
0 commit comments