-
-
Notifications
You must be signed in to change notification settings - Fork 143
875 lines (711 loc) · 29.6 KB
/
build.yml
File metadata and controls
875 lines (711 loc) · 29.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
name: Build OpenTable
on:
push:
tags: ["v*"]
paths-ignore:
- "**.md"
- "docs/**"
- ".vscode/**"
env:
XCODE_PROJECT: OpenTable.xcodeproj
XCODE_SCHEME: OpenTable
BUILD_CONFIGURATION: Release
XCODE_VERSION: "26.2" # Updated to support macOS 26 Tahoe liquid design
jobs:
lint:
name: SwiftLint
runs-on: macos-26 # Updated to macOS 26 (Tahoe) runner
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache SwiftLint
uses: actions/cache@v4
with:
path: ~/Library/Caches/Homebrew/swiftlint*
key: swiftlint-${{ runner.os }}-${{ hashFiles('.swiftlint.yml') }}
restore-keys: |
swiftlint-${{ runner.os }}-
- name: Install SwiftLint
run: brew install swiftlint
- name: Run SwiftLint
run: swiftlint lint --strict
prepare-libs:
name: Prepare Universal Libraries
runs-on: macos-26 # Updated to macOS 26 (Tahoe) runner
needs: lint
timeout-minutes: 25
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Homebrew downloads
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/Library/Caches/Homebrew
key: brew-downloads-${{ runner.os }}-${{ hashFiles('**/build-release.sh') }}
restore-keys: |
brew-downloads-${{ runner.os }}-
- name: Install ARM64 Homebrew dependencies
run: |
echo "Installing ARM64 dependencies..."
# Check and install only if needed
if ! brew list mariadb-connector-c &>/dev/null; then
echo "📦 Installing mariadb-connector-c..."
brew install mariadb-connector-c
else
echo "✅ mariadb-connector-c already installed"
fi
if ! brew list libpq &>/dev/null; then
echo "📦 Installing libpq..."
brew install libpq
else
echo "✅ libpq already installed"
fi
# Link packages with --force (needed for keg-only formulas)
brew link --force mariadb-connector-c
brew link --force libpq
# Verify installations
if ! brew list mariadb-connector-c >/dev/null 2>&1; then
echo "❌ ERROR: mariadb-connector-c installation failed or incomplete"
exit 1
fi
if ! brew list libpq >/dev/null 2>&1; then
echo "❌ ERROR: libpq installation failed or incomplete"
exit 1
fi
# Get the actual prefix for mariadb-connector-c (handles keg-only formulas)
MARIADB_PREFIX=$(brew --prefix mariadb-connector-c)
echo "MariaDB Connector/C prefix: $MARIADB_PREFIX"
# Find the library file (may be in lib/ or lib/mariadb/)
MARIADB_LIB=""
for path in "$MARIADB_PREFIX/lib/mariadb/libmariadb.a" "$MARIADB_PREFIX/lib/libmariadb.a"; do
if [ -f "$path" ]; then
MARIADB_LIB="$path"
break
fi
done
if [ -z "$MARIADB_LIB" ]; then
echo "❌ ERROR: mariadb-connector-c installed but library file not found"
echo "Searched in:"
echo " - $MARIADB_PREFIX/lib/mariadb/libmariadb.a"
echo " - $MARIADB_PREFIX/lib/libmariadb.a"
echo ""
echo "Contents of $MARIADB_PREFIX/lib/:"
ls -la "$MARIADB_PREFIX/lib/" || echo "Directory not found"
exit 1
fi
echo "✅ Found ARM64 MariaDB library at: $MARIADB_LIB"
echo "ARM64_MARIADB_LIB=$MARIADB_LIB" >> $GITHUB_ENV
echo "✅ All ARM64 dependencies installed successfully"
- name: Install x86_64 Homebrew
run: |
# Install Rosetta 2 if needed
if ! arch -x86_64 /usr/bin/true 2>/dev/null; then
echo "Installing Rosetta 2..."
if ! softwareupdate --install-rosetta --agree-to-license; then
echo "❌ ERROR: Failed to install Rosetta 2"
echo "This is required to run x86_64 binaries on Apple Silicon"
exit 1
fi
# Verify Rosetta 2 is now working
if ! arch -x86_64 /usr/bin/true 2>/dev/null; then
echo "❌ ERROR: Rosetta 2 installed but not functional"
exit 1
fi
echo "✅ Rosetta 2 installed successfully"
else
echo "✅ Rosetta 2 already installed"
fi
# Check if x86_64 Homebrew is already installed
if [ ! -f /usr/local/bin/brew ]; then
echo "Installing x86_64 Homebrew..."
# Using official Homebrew installer (trusted source)
if ! arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; then
echo "❌ ERROR: Homebrew installation script failed"
exit 1
fi
# Verify installation
if [ ! -f /usr/local/bin/brew ]; then
echo "❌ ERROR: Homebrew installed but /usr/local/bin/brew not found"
exit 1
fi
# Verify it's executable
if ! /usr/local/bin/brew --version; then
echo "❌ ERROR: Homebrew binary is not functional"
exit 1
fi
echo "✅ x86_64 Homebrew installed successfully"
else
echo "x86_64 Homebrew already installed"
# Still verify it works
if ! /usr/local/bin/brew --version; then
echo "❌ ERROR: x86_64 Homebrew exists but is not functional"
exit 1
fi
fi
- name: Install x86_64 Homebrew dependencies
run: |
echo "Installing x86_64 dependencies..."
# Check and install only if needed
if ! arch -x86_64 /usr/local/bin/brew list mariadb-connector-c &>/dev/null; then
echo "📦 Installing mariadb-connector-c (x86_64)..."
arch -x86_64 /usr/local/bin/brew install mariadb-connector-c
else
echo "✅ mariadb-connector-c (x86_64) already installed"
fi
if ! arch -x86_64 /usr/local/bin/brew list libpq &>/dev/null; then
echo "📦 Installing libpq (x86_64)..."
arch -x86_64 /usr/local/bin/brew install libpq
else
echo "✅ libpq (x86_64) already installed"
fi
# Link packages with --force (needed for keg-only formulas)
arch -x86_64 /usr/local/bin/brew link --force mariadb-connector-c
arch -x86_64 /usr/local/bin/brew link --force libpq
# Verify installations
if ! arch -x86_64 /usr/local/bin/brew list mariadb-connector-c >/dev/null 2>&1; then
echo "❌ ERROR: mariadb-connector-c installation failed or incomplete"
exit 1
fi
if ! arch -x86_64 /usr/local/bin/brew list libpq >/dev/null 2>&1; then
echo "❌ ERROR: libpq installation failed or incomplete"
exit 1
fi
# Get the actual prefix for mariadb-connector-c (handles keg-only formulas)
X86_MARIADB_PREFIX=$(arch -x86_64 /usr/local/bin/brew --prefix mariadb-connector-c)
echo "x86_64 MariaDB Connector/C prefix: $X86_MARIADB_PREFIX"
# Find the library file (may be in lib/ or lib/mariadb/)
X86_MARIADB_LIB=""
for path in "$X86_MARIADB_PREFIX/lib/mariadb/libmariadb.a" "$X86_MARIADB_PREFIX/lib/libmariadb.a"; do
if [ -f "$path" ]; then
X86_MARIADB_LIB="$path"
break
fi
done
if [ -z "$X86_MARIADB_LIB" ]; then
echo "❌ ERROR: mariadb-connector-c installed but library file not found"
echo "Searched in:"
echo " - $X86_MARIADB_PREFIX/lib/mariadb/libmariadb.a"
echo " - $X86_MARIADB_PREFIX/lib/libmariadb.a"
echo ""
echo "Contents of $X86_MARIADB_PREFIX/lib/:"
ls -la "$X86_MARIADB_PREFIX/lib/" || echo "Directory not found"
exit 1
fi
echo "✅ Found x86_64 MariaDB library at: $X86_MARIADB_LIB"
echo "X86_MARIADB_LIB=$X86_MARIADB_LIB" >> $GITHUB_ENV
echo "✅ All x86_64 dependencies installed successfully"
- name: Create universal libmariadb library
run: |
echo "Creating universal libmariadb.a..."
# Use library paths from environment (set by previous steps)
ARM64_LIB="${ARM64_MARIADB_LIB}"
X86_LIB="${X86_MARIADB_LIB}"
echo "ARM64 library path: $ARM64_LIB"
echo "x86_64 library path: $X86_LIB"
# Verify input files exist
if [ -z "$ARM64_LIB" ] || [ ! -f "$ARM64_LIB" ]; then
echo "❌ ERROR: ARM64 library not found at: $ARM64_LIB"
echo "ARM64 Homebrew installation may have failed"
exit 1
fi
if [ -z "$X86_LIB" ] || [ ! -f "$X86_LIB" ]; then
echo "❌ ERROR: x86_64 library not found at: $X86_LIB"
echo "x86_64 Homebrew installation may have failed"
exit 1
fi
# Verify inputs are correct architectures
echo "Verifying input architectures:"
lipo -info "$ARM64_LIB"
lipo -info "$X86_LIB"
# Ensure output directory exists
mkdir -p Libs
# Create universal binary
if ! lipo -create "$ARM64_LIB" "$X86_LIB" -output Libs/libmariadb_universal.a; then
echo "❌ ERROR: Failed to create universal library"
echo "This could mean:"
echo " - Libraries are incompatible"
echo " - Libraries are already universal"
echo " - Output directory is not writable"
exit 1
fi
# Verify output
if [ ! -f "Libs/libmariadb_universal.a" ]; then
echo "❌ ERROR: Universal library was not created"
exit 1
fi
echo "✅ Universal library created successfully:"
lipo -info Libs/libmariadb_universal.a
ls -lh Libs/libmariadb_universal.a
# Verify it's actually universal (contains both architectures)
if ! lipo -info Libs/libmariadb_universal.a | grep -q "arm64"; then
echo "❌ ERROR: Universal library missing arm64 architecture"
exit 1
fi
if ! lipo -info Libs/libmariadb_universal.a | grep -q "x86_64"; then
echo "❌ ERROR: Universal library missing x86_64 architecture"
exit 1
fi
echo "✅ Verified: Library contains both arm64 and x86_64"
- name: Upload library artifacts
uses: actions/upload-artifact@v4
with:
name: libs-universal
path: Libs/
retention-days: 1
build-arm64:
name: Build ARM64
runs-on: macos-26 # Updated to macOS 26 (Tahoe) runner
needs: prepare-libs
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download library artifacts
uses: actions/download-artifact@v4
with:
name: libs-universal
path: Libs/
- name: Verify downloaded artifacts
run: |
echo "Verifying downloaded library artifacts..."
if [ ! -f "Libs/libmariadb_universal.a" ]; then
echo "❌ ERROR: Required library artifact not found: Libs/libmariadb_universal.a"
echo "This means:"
echo " - The prepare-libs job failed to create the library"
echo " - The artifact upload failed"
echo " - The artifact download was corrupted"
echo ""
echo "Contents of Libs directory:"
ls -la Libs/ || echo "Libs directory is empty or doesn't exist"
exit 1
fi
echo "✅ Universal library found"
lipo -info Libs/libmariadb_universal.a
ls -lh Libs/libmariadb_universal.a
- name: Cache Homebrew downloads
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/Library/Caches/Homebrew
key: brew-arm64-downloads-${{ runner.os }}-${{ hashFiles('**/build-release.sh') }}
restore-keys: |
brew-arm64-downloads-${{ runner.os }}-
- name: Install ARM64 dependencies
run: |
echo "Installing ARM64 dependencies..."
# Check and install only if needed
if ! brew list mariadb-connector-c &>/dev/null; then
echo "📦 Installing mariadb-connector-c..."
brew install mariadb-connector-c
else
echo "✅ mariadb-connector-c already installed"
fi
if ! brew list libpq &>/dev/null; then
echo "📦 Installing libpq..."
brew install libpq
else
echo "✅ libpq already installed"
fi
# Link packages with --force (needed for keg-only formulas)
brew link --force mariadb-connector-c
brew link --force libpq
# Verify installations
if ! brew list mariadb-connector-c >/dev/null 2>&1; then
echo "❌ ERROR: mariadb-connector-c installation failed"
exit 1
fi
if ! brew list libpq >/dev/null 2>&1; then
echo "❌ ERROR: libpq installation failed"
exit 1
fi
echo "✅ ARM64 dependencies installed"
- name: Select Xcode version
run: |
sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
echo "Selected Xcode version:"
xcodebuild -version
- name: Build ARM64
run: |
chmod +x build-release.sh
./build-release.sh arm64
- name: Verify build
run: |
echo "Verifying build output..."
BINARY_PATH="build/Release/OpenTable-arm64.app/Contents/MacOS/OpenTable"
# Check binary exists
if [ ! -f "$BINARY_PATH" ]; then
echo "❌ ERROR: Built binary not found at: $BINARY_PATH"
echo "Build may have failed silently"
exit 1
fi
# Check it's not empty
if [ ! -s "$BINARY_PATH" ]; then
echo "❌ ERROR: Binary file is empty"
exit 1
fi
# Check architecture
ARCH_INFO=$(lipo -info "$BINARY_PATH")
echo "Architecture: $ARCH_INFO"
if ! echo "$ARCH_INFO" | grep -q "arm64"; then
echo "❌ ERROR: Binary does not contain arm64 architecture"
echo "Expected: arm64 only"
echo "Got: $ARCH_INFO"
exit 1
fi
if echo "$ARCH_INFO" | grep -q "x86_64"; then
echo "❌ ERROR: Binary contains x86_64 but should be arm64 only"
exit 1
fi
# Check it's executable
if [ ! -x "$BINARY_PATH" ]; then
echo "❌ ERROR: Binary is not executable"
exit 1
fi
# Display info
echo "✅ Build verified successfully"
echo "Binary size: $(ls -lh "$BINARY_PATH" | awk '{print $5}')"
echo "App bundle size: $(du -sh build/Release/OpenTable-arm64.app | awk '{print $1}')"
- name: Create DMG installer
run: |
echo "Creating DMG installer..."
# Install create-dmg tool for proper icon handling in CI
echo "📦 Installing create-dmg tool..."
brew install create-dmg
# Make DMG creation script executable
chmod +x create-dmg.sh
# Create DMG with version from git tag or use default
# The script handles app renaming internally
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.1.13")
echo "📌 Using version: $VERSION"
./create-dmg.sh "$VERSION" "arm64" "build/Release/OpenTable-arm64.app"
# Verify DMG was created - check for the specific file or any arm64 DMG
DMG_FILE="build/Release/OpenTable-${VERSION}-arm64.dmg"
if [ -f "$DMG_FILE" ]; then
echo "✅ DMG installer created successfully: $DMG_FILE"
else
echo "⚠️ Expected DMG not found at: $DMG_FILE"
echo "📂 Checking for any DMG files in build/Release/:"
ls -la build/Release/*.dmg 2>/dev/null || echo " No DMG files found"
# Check if any arm64 DMG was created (version might differ)
if ls build/Release/*-arm64.dmg 1>/dev/null 2>&1; then
echo "✅ Found arm64 DMG file(s):"
ls -lh build/Release/*-arm64.dmg
else
echo "❌ ERROR: No arm64 DMG file was created"
exit 1
fi
fi
ls -lh build/Release/*.dmg
- name: Create ZIP archive (fallback)
run: |
echo "Creating ZIP archive..."
cd build/Release
if ! zip -r OpenTable-arm64.zip OpenTable-arm64.app; then
echo "❌ ERROR: Failed to create ZIP archive"
exit 1
fi
echo "✅ ZIP archive created"
ls -lh OpenTable-arm64.zip
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: OpenTable-arm64-${{ github.sha }}
path: |
build/Release/*.dmg
build/Release/OpenTable-arm64.zip
retention-days: ${{ startsWith(github.ref, 'refs/tags/v') && 90 || 7 }}
build-x86_64:
name: Build x86_64
runs-on: macos-26 # Updated to macOS 26 (Tahoe) runner
needs: prepare-libs
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download library artifacts
uses: actions/download-artifact@v4
with:
name: libs-universal
path: Libs/
- name: Verify downloaded artifacts
run: |
echo "Verifying downloaded library artifacts..."
if [ ! -f "Libs/libmariadb_universal.a" ]; then
echo "❌ ERROR: Required library artifact not found: Libs/libmariadb_universal.a"
echo ""
echo "Contents of Libs directory:"
ls -la Libs/ || echo "Libs directory is empty or doesn't exist"
exit 1
fi
echo "✅ Universal library found"
lipo -info Libs/libmariadb_universal.a
- name: Cache Homebrew downloads
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/Library/Caches/Homebrew
key: brew-x86_64-downloads-${{ runner.os }}-${{ hashFiles('**/build-release.sh') }}
restore-keys: |
brew-x86_64-downloads-${{ runner.os }}-
- name: Install Rosetta 2
run: |
if ! arch -x86_64 /usr/bin/true 2>/dev/null; then
echo "Installing Rosetta 2..."
if ! softwareupdate --install-rosetta --agree-to-license; then
echo "❌ ERROR: Failed to install Rosetta 2"
exit 1
fi
# Verify Rosetta 2 works
if ! arch -x86_64 /usr/bin/true 2>/dev/null; then
echo "❌ ERROR: Rosetta 2 installed but not functional"
exit 1
fi
echo "✅ Rosetta 2 installed"
else
echo "✅ Rosetta 2 already installed"
fi
- name: Install x86_64 Homebrew
run: |
if [ ! -f /usr/local/bin/brew ]; then
echo "Installing x86_64 Homebrew..."
if ! arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; then
echo "❌ ERROR: Homebrew installation failed"
exit 1
fi
if [ ! -f /usr/local/bin/brew ]; then
echo "❌ ERROR: Homebrew not found after installation"
exit 1
fi
if ! /usr/local/bin/brew --version; then
echo "❌ ERROR: Homebrew not functional"
exit 1
fi
echo "✅ x86_64 Homebrew installed"
else
echo "x86_64 Homebrew already installed"
if ! /usr/local/bin/brew --version; then
echo "❌ ERROR: Homebrew not functional"
exit 1
fi
fi
- name: Install x86_64 dependencies
run: |
echo "Installing x86_64 dependencies..."
# Check and install only if needed
if ! arch -x86_64 /usr/local/bin/brew list mariadb-connector-c &>/dev/null; then
echo "📦 Installing mariadb-connector-c (x86_64)..."
arch -x86_64 /usr/local/bin/brew install mariadb-connector-c
else
echo "✅ mariadb-connector-c (x86_64) already installed"
fi
if ! arch -x86_64 /usr/local/bin/brew list libpq &>/dev/null; then
echo "📦 Installing libpq (x86_64)..."
arch -x86_64 /usr/local/bin/brew install libpq
else
echo "✅ libpq (x86_64) already installed"
fi
# Link packages with --force (needed for keg-only formulas)
arch -x86_64 /usr/local/bin/brew link --force mariadb-connector-c
arch -x86_64 /usr/local/bin/brew link --force libpq
# Verify installations
if ! arch -x86_64 /usr/local/bin/brew list mariadb-connector-c >/dev/null 2>&1; then
echo "❌ ERROR: mariadb-connector-c installation failed"
exit 1
fi
if ! arch -x86_64 /usr/local/bin/brew list libpq >/dev/null 2>&1; then
echo "❌ ERROR: libpq installation failed"
exit 1
fi
echo "✅ x86_64 dependencies installed"
- name: Select Xcode version
run: |
sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
echo "Selected Xcode version:"
xcodebuild -version
- name: Build x86_64
run: |
chmod +x build-release.sh
./build-release.sh x86_64
- name: Verify build
run: |
echo "Verifying build output..."
BINARY_PATH="build/Release/OpenTable-x86_64.app/Contents/MacOS/OpenTable"
# Check binary exists
if [ ! -f "$BINARY_PATH" ]; then
echo "❌ ERROR: Built binary not found at: $BINARY_PATH"
exit 1
fi
# Check it's not empty
if [ ! -s "$BINARY_PATH" ]; then
echo "❌ ERROR: Binary file is empty"
exit 1
fi
# Check architecture
ARCH_INFO=$(lipo -info "$BINARY_PATH")
echo "Architecture: $ARCH_INFO"
if ! echo "$ARCH_INFO" | grep -q "x86_64"; then
echo "❌ ERROR: Binary does not contain x86_64 architecture"
echo "Expected: x86_64 only"
echo "Got: $ARCH_INFO"
exit 1
fi
if echo "$ARCH_INFO" | grep -q "arm64"; then
echo "❌ ERROR: Binary contains arm64 but should be x86_64 only"
exit 1
fi
# Check it's executable
if [ ! -x "$BINARY_PATH" ]; then
echo "❌ ERROR: Binary is not executable"
exit 1
fi
# Display info
echo "✅ Build verified successfully"
echo "Binary size: $(ls -lh "$BINARY_PATH" | awk '{print $5}')"
echo "App bundle size: $(du -sh build/Release/OpenTable-x86_64.app | awk '{print $1}')"
- name: Create DMG installer
run: |
echo "Creating DMG installer..."
# Install create-dmg tool for proper icon handling in CI
echo "📦 Installing create-dmg tool..."
brew install create-dmg
# Make DMG creation script executable
chmod +x create-dmg.sh
# Create DMG with version from git tag or use default
# The script handles app renaming internally
VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.1.13")
echo "📌 Using version: $VERSION"
./create-dmg.sh "$VERSION" "x86_64" "build/Release/OpenTable-x86_64.app"
# Verify DMG was created - check for the specific file or any x86_64 DMG
DMG_FILE="build/Release/OpenTable-${VERSION}-x86_64.dmg"
if [ -f "$DMG_FILE" ]; then
echo "✅ DMG installer created successfully: $DMG_FILE"
else
echo "⚠️ Expected DMG not found at: $DMG_FILE"
echo "📂 Checking for any DMG files in build/Release/:"
ls -la build/Release/*.dmg 2>/dev/null || echo " No DMG files found"
# Check if any x86_64 DMG was created (version might differ)
if ls build/Release/*-x86_64.dmg 1>/dev/null 2>&1; then
echo "✅ Found x86_64 DMG file(s):"
ls -lh build/Release/*-x86_64.dmg
else
echo "❌ ERROR: No x86_64 DMG file was created"
exit 1
fi
fi
ls -lh build/Release/*.dmg
- name: Create ZIP archive (fallback)
run: |
echo "Creating ZIP archive..."
cd build/Release
if ! zip -r OpenTable-x86_64.zip OpenTable-x86_64.app; then
echo "❌ ERROR: Failed to create ZIP archive"
exit 1
fi
echo "✅ ZIP archive created"
ls -lh OpenTable-x86_64.zip
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: OpenTable-x86_64-${{ github.sha }}
path: |
build/Release/*.dmg
build/Release/OpenTable-x86_64.zip
retention-days: ${{ startsWith(github.ref, 'refs/tags/v') && 90 || 7 }}
release:
name: Create GitHub Release
runs-on: macos-26 # Updated to macOS 26 (Tahoe) runner
needs: [build-arm64, build-x86_64]
if: startsWith(github.ref, 'refs/tags/v')
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download ARM64 artifact
uses: actions/download-artifact@v4
with:
name: OpenTable-arm64-${{ github.sha }}
path: artifacts/
- name: Download x86_64 artifact
uses: actions/download-artifact@v4
with:
name: OpenTable-x86_64-${{ github.sha }}
path: artifacts/
- name: Verify and organize artifacts for release
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [ -z "$VERSION" ]; then
echo "❌ ERROR: Failed to extract version from ref: $GITHUB_REF"
exit 1
fi
echo "Preparing artifacts for version: $VERSION"
echo "Contents of artifacts directory:"
ls -la artifacts/
# Note: DMG files should already have correct names from build
# ZIP files need to be renamed
# Rename ZIP files if they exist
if [ -f "artifacts/OpenTable-arm64.zip" ]; then
mv artifacts/OpenTable-arm64.zip "artifacts/OpenTable-${VERSION}-arm64.zip"
fi
if [ -f "artifacts/OpenTable-x86_64.zip" ]; then
mv artifacts/OpenTable-x86_64.zip "artifacts/OpenTable-${VERSION}-x86_64.zip"
fi
echo "✅ Artifacts organized successfully"
echo "Final artifacts:"
ls -lh artifacts/
- name: Generate release notes
id: release_notes
run: |
VERSION=${GITHUB_REF#refs/tags/}
# Try to get previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -z "$PREVIOUS_TAG" ]; then
echo "No previous tag found, showing recent commits"
CHANGES=$(git log --pretty=format:"- %s" HEAD~10..HEAD 2>/dev/null || echo "- Initial release")
else
echo "Generating changes since $PREVIOUS_TAG"
CHANGES=$(git log --pretty=format:"- %s" "$PREVIOUS_TAG"..HEAD 2>/dev/null || echo "- Initial release")
fi
if [ -z "$CHANGES" ]; then
CHANGES="- Initial release"
fi
cat > release_notes.md <<EOF
## OpenTable ${VERSION}
### Downloads
Choose the appropriate version for your Mac:
**Recommended (DMG Installer):**
- 🍎 **Apple Silicon (M1/M2/M3/M4)**: \`OpenTable-${VERSION}-arm64.dmg\`
- 💻 **Intel**: \`OpenTable-${VERSION}-x86_64.dmg\`
**Alternative (ZIP Archive):**
- \`OpenTable-${VERSION}-arm64.zip\` (Apple Silicon)
- \`OpenTable-${VERSION}-x86_64.zip\` (Intel)
### Installation
**DMG Installer (Recommended):**
1. Download and open the DMG file
2. Drag OpenTable to the Applications folder
3. Eject the DMG
4. Right-click OpenTable in Applications and select "Open" on first launch
**ZIP Archive:**
1. Download and unzip the file
2. Move OpenTable.app to your Applications folder
3. Right-click and select "Open" on first launch
> **Note:** This app is not signed with an Apple Developer certificate. You may need to allow it in System Settings > Privacy & Security on first launch.
### Changes
$CHANGES
EOF
echo "✅ Release notes generated"
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/*.dmg
artifacts/*.zip
body_path: release_notes.md
draft: false
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}