Skip to content

Commit 0a267bb

Browse files
committed
Improve error messages with log output and full log path
1 parent a54a2b8 commit 0a267bb

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
release:
1111
runs-on: macos-latest
12+
permissions:
13+
contents: write
1214
steps:
1315
- uses: actions/checkout@v4
1416

@@ -39,10 +41,22 @@ jobs:
3941
maestro-jars.zip
4042
maestro-ios-runner.zip
4143
44+
- name: Get version
45+
id: version
46+
run: |
47+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
48+
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
49+
else
50+
echo "version=v0.0.0-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
51+
fi
52+
4253
- name: Create release
43-
if: startsWith(github.ref, 'refs/tags/')
4454
uses: softprops/action-gh-release@v1
4555
with:
56+
tag_name: ${{ steps.version.outputs.version }}
57+
name: ${{ steps.version.outputs.version }}
58+
draft: false
59+
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
4660
files: |
4761
dist/maestro-ios-device-darwin-amd64
4862
dist/maestro-ios-device-darwin-arm64

cmd/maestro-ios-device/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func run() {
109109

110110
fmt.Println()
111111
fmt.Println("✅ Ready! Run:")
112-
fmt.Printf(" maestro --driver-host-port %d --device %s test <flow.yaml>\n\n", localPort, *deviceUDID)
112+
fmt.Printf(" maestro --driver-host-port %d --device %s --app-file /path/to/app.ipa test flow.yaml\n\n", localPort, *deviceUDID)
113113
fmt.Println("Press Ctrl+C to stop.")
114114

115115
<-sigChan

internal/runner/runner.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (r *Runner) Build(ctx context.Context) error {
7070
fmt.Println("🔨 Building (up to 10 min)...")
7171

7272
if err := cmd.Run(); err != nil {
73-
return fmt.Errorf("build failed (see %s)", logPath)
73+
return fmt.Errorf("build failed:\n%s\n\nFull log: %s", tailLog(logPath, 20), logPath)
7474
}
7575

7676
if _, err := r.findXctestrun(); err != nil {
@@ -122,7 +122,7 @@ func (r *Runner) Start(ctx context.Context) error {
122122
fmt.Println("▶️ Starting runner...")
123123

124124
if err := r.cmd.Start(); err != nil {
125-
return err
125+
return fmt.Errorf("failed to start runner: %w", err)
126126
}
127127

128128
if err := r.waitForStartup(logPath); err != nil {
@@ -166,7 +166,7 @@ func (r *Runner) waitForStartup(logPath string) error {
166166
return err
167167
}
168168
case <-timeout:
169-
return fmt.Errorf("startup timeout (see %s)", logPath)
169+
return fmt.Errorf("startup timeout (90s):\n%s\n\nFull log: %s", tailLog(logPath, 20), logPath)
170170
}
171171
}
172172
}
@@ -185,7 +185,19 @@ func checkLog(log, logPath string) error {
185185
return fmt.Errorf("certificate not trusted - trust it in Settings > General > VPN & Device Management")
186186
}
187187
if strings.Contains(log, "Testing failed:") {
188-
return fmt.Errorf("runner failed (see %s)", logPath)
188+
return fmt.Errorf("runner failed:\n%s\n\nFull log: %s", tailLog(logPath, 20), logPath)
189189
}
190190
return errNotReady
191191
}
192+
193+
func tailLog(path string, lines int) string {
194+
content, err := os.ReadFile(path)
195+
if err != nil {
196+
return fmt.Sprintf("(could not read log: %s)", err)
197+
}
198+
allLines := strings.Split(string(content), "\n")
199+
if len(allLines) <= lines {
200+
return string(content)
201+
}
202+
return strings.Join(allLines[len(allLines)-lines:], "\n")
203+
}

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ echo "╚═══════════════════════
2626
echo ""
2727

2828
printf "Continue with installation? [y/N] "
29-
read -r REPLY
29+
read -r REPLY </dev/tty
3030
if [ "$REPLY" != "y" ] && [ "$REPLY" != "Y" ]; then
3131
echo "Installation cancelled."
3232
exit 1

0 commit comments

Comments
 (0)