-
Notifications
You must be signed in to change notification settings - Fork 15
2151 lines (1838 loc) · 78.9 KB
/
Copy pathrelease.yml
File metadata and controls
2151 lines (1838 loc) · 78.9 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
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Checks and release
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
# Manual release support - consolidated here to work with npm trusted publishing
# npm only allows ONE workflow file as trusted publisher, so all publishing
# must go through this workflow (release.yml)
workflow_dispatch:
inputs:
release_mode:
description: 'Manual release mode'
required: true
type: choice
default: 'instant'
options:
- instant
- changeset-pr
bump_type:
description: 'Manual release type'
required: true
type: choice
options:
- patch
- minor
- major
description:
description: 'Manual release description (optional)'
required: false
type: string
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
# === DETECT CHANGES ===
detect-changes:
runs-on: ubuntu-latest
outputs:
mjs-changed: ${{ steps.changes.outputs.mjs }}
package-changed: ${{ steps.changes.outputs.package }}
docs-changed: ${{ steps.changes.outputs.docs }}
workflow-changed: ${{ steps.changes.outputs.workflow }}
docker-changed: ${{ steps.changes.outputs.docker }}
any-code-changed: ${{ steps.changes.outputs.code }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Detect changes
id: changes
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: node scripts/detect-code-changes.mjs
# === CHANGESET CHECK - only runs on PRs with code changes ===
# Docs-only PRs (./docs folder, markdown files) don't require changesets
changeset-check:
name: Check for Changesets
runs-on: ubuntu-latest
needs: [detect-changes]
if: github.event_name == 'pull_request' && needs.detect-changes.outputs.any-code-changed == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Check for changesets
env:
# Pass PR context to the validation script
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Skip changeset check for automated version PRs
if [[ "${{ github.head_ref }}" == "changeset-release/"* ]]; then
echo "Skipping changeset check for automated release PR"
exit 0
fi
# Run changeset validation script
# This validates that exactly ONE changeset was ADDED by this PR
# Pre-existing changesets from other merged PRs are ignored
node scripts/validate-changeset.mjs
# === FAST CHECKS (FAIL FAST) ===
# These checks run quickly (~7-21 seconds each) and should pass before long-running tests
# === COMPILATION & SYNTAX CHECKS ===
test-compilation:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check]
# Run if: push event, OR changeset-check succeeded, OR changeset-check was skipped (docs-only PR)
if: always() && (github.event_name == 'push' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') && (needs.detect-changes.outputs.any-code-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Test solve.mjs compilation
run: |
echo "Testing solve.mjs compilation..."
timeout 30s node --check src/solve.mjs
echo "solve.mjs compiles successfully"
- name: Test hive.mjs compilation
run: |
echo "Testing hive.mjs compilation..."
timeout 30s node --check src/hive.mjs
echo "hive.mjs compiles successfully"
- name: Check Node.js syntax for all .mjs files
run: |
echo "Checking syntax for all .mjs files..."
for file in *.mjs; do
if [ -f "$file" ]; then
echo "Checking $file..."
timeout 10s node --check "$file"
fi
done
for file in src/*.mjs; do
if [ -f "$file" ]; then
echo "Checking $file..."
timeout 10s node --check "$file"
fi
done
for file in tests/*.mjs; do
if [ -f "$file" ]; then
echo "Checking $file..."
node --check "$file"
fi
done
# === ESLINT CODE QUALITY CHECK ===
# Lint runs independently of changeset-check - it's a fast check that should always run
# See: docs/case-studies/issue-1023 for why this dependency was removed
lint:
runs-on: ubuntu-latest
needs: [detect-changes]
if: needs.detect-changes.outputs.mjs-changed == 'true' || needs.detect-changes.outputs.docs-changed == 'true' || needs.detect-changes.outputs.package-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm ci
- name: Run Prettier format check
run: |
echo "Running Prettier format check..."
npm run format:check
echo "Prettier format check passed"
- name: Run ESLint
run: |
echo "Running ESLint code quality checks..."
npm run lint
echo "ESLint checks passed"
# === FILE LINE LIMIT CHECK ===
check-file-line-limits:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check]
# Run if: push event, OR changeset-check succeeded, OR changeset-check was skipped (docs-only PR)
if: always() && (github.event_name == 'push' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') && (needs.detect-changes.outputs.mjs-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check .mjs file line limits
run: |
echo "Checking that all .mjs files are under 1500 lines..."
FAILURES_FILE=$(mktemp)
find . -name "*.mjs" -type f | while read -r file; do
line_count=$(wc -l < "$file")
echo "$file: $line_count lines"
if [ $line_count -gt 1500 ]; then
echo "ERROR: $file has $line_count lines, which exceeds the 1500 line limit!"
echo "::error file=$file::File has $line_count lines (limit: 1500)"
echo "$file" >> "$FAILURES_FILE"
fi
done
if [ -s "$FAILURES_FILE" ]; then
echo ""
echo "The following .mjs files exceed the 1500 line limit:"
cat "$FAILURES_FILE"
rm -f "$FAILURES_FILE"
exit 1
else
echo ""
echo "All .mjs files are within the 1500 line limit!"
rm -f "$FAILURES_FILE"
fi
# === LONG-RUNNING CHECKS ===
# These checks take significant time (30s to 4+ minutes) and only run after all fast checks pass
# === UNIT TESTS ===
test-suites:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check, test-compilation, lint, check-file-line-limits]
if: |
always() &&
!cancelled() &&
!contains(needs.*.result, 'failure') &&
(github.event_name == 'push' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') &&
needs.test-compilation.result == 'success' &&
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
(needs.check-file-line-limits.result == 'success' || needs.check-file-line-limits.result == 'skipped') &&
(needs.detect-changes.outputs.any-code-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm install
- name: Run test suite for solve.mjs
run: |
echo "Running test suite for solve.mjs..."
node tests/test-solve.mjs
- name: Run test suite for hive.mjs
run: |
echo "Running test suite for hive.mjs..."
node tests/test-hive.mjs
- name: Run test suite for memory-check.mjs
run: |
echo "Running test suite for memory-check.mjs..."
node tests/test-memory-check.mjs
- name: Run branch name validation test (Issue #647)
run: |
echo "Running test suite for branch name validation..."
node tests/test-branch-name-validation.mjs
- name: Run feedback lines regression test (Issue #168)
run: |
echo "Running feedback lines regression test..."
node tests/test-feedback-lines-simple.mjs
- name: Run feedback lines integration test (Issue #168)
env:
GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_USER_TOKEN || secrets.GITHUB_TOKEN }}
TEST_GITHUB_USERNAME: ${{ secrets.TEST_GITHUB_USERNAME }}
TEST_GITHUB_USER_TOKEN: ${{ secrets.TEST_GITHUB_USER_TOKEN }}
run: |
echo "Running feedback lines integration test with real repository..."
node tests/test-feedback-lines-integration.mjs
- name: Run Sentry integration test
run: |
echo "Running test suite for Sentry integration..."
node tests/test-sentry.mjs
- name: Run telegram-bot dry-run test (Issue #487)
run: |
echo "Running test suite for telegram-bot --dry-run mode..."
node tests/test-telegram-bot-dry-run.mjs
- name: Run telegram-bot hero Links Notation test (Issue #623)
run: |
echo "Running test suite for telegram-bot hero example with Links Notation..."
node tests/test-telegram-bot-hero-links-notation.mjs
- name: Run hive command silent failure test (Issue #504)
run: |
echo "Running test suite for hive command silent failures..."
node tests/test-hive-no-silent-failure.mjs
- name: Run GitHub linking keyword detection test (Issue #568)
run: |
echo "Running test suite for GitHub linking keyword detection..."
node tests/test-github-linking.mjs
- name: Run Telegram Markdown escaping test (Issue #580)
run: |
echo "Running test suite for Telegram Markdown escaping..."
node tests/test-telegram-markdown-escaping.mjs
- name: Run lenv-reader test (Issue #604)
run: |
echo "Running test suite for lenv-reader.lib.mjs..."
node tests/test-lenv-reader.mjs
- name: Run lino test (Issue #1086)
run: |
echo "Running test suite for lino.lib.mjs..."
node tests/test-lino.mjs
- name: Run Telegram URL extraction test (Issue #603)
run: |
echo "Running test suite for Telegram URL extraction..."
node tests/test-telegram-url-extraction.mjs
- name: Run Telegram URL validation test (Issue #630)
run: |
echo "Running test suite for Telegram URL validation..."
node tests/test-telegram-validate-url.mjs
- name: Run interactive mode test (Issue #800)
run: |
echo "Running test suite for interactive mode..."
node tests/test-interactive-mode.mjs
- name: Run start-screen test (Issue #539)
run: |
echo "Running test suite for start-screen.mjs..."
node tests/test-start-screen.mjs
- name: Run buildCostInfoString test (Issue #1015)
run: |
echo "Running test suite for buildCostInfoString..."
node tests/test-build-cost-info-string.mjs
- name: Run token sanitization test (Issue #1037)
run: |
echo "Running test suite for token sanitization..."
node tests/test-token-sanitization.mjs
- name: Run Telegram special character handling test (Issue #1070)
run: |
echo "Running test suite for Telegram special character handling..."
node tests/test-telegram-special-char-handling.mjs
# === EXECUTION TESTS ===
test-execution:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check, test-compilation, lint, check-file-line-limits]
if: |
always() &&
!cancelled() &&
!contains(needs.*.result, 'failure') &&
(github.event_name == 'push' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') &&
needs.test-compilation.result == 'success' &&
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
(needs.check-file-line-limits.result == 'success' || needs.check-file-line-limits.result == 'skipped') &&
(needs.detect-changes.outputs.any-code-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm install
- name: Test solve.mjs execution
run: |
echo "Testing solve.mjs basic execution..."
timeout 10s ./src/solve.mjs --help || echo "Help command completed"
echo "solve.mjs executes without critical errors"
timeout 10s ./src/solve.mjs --version || true
- name: Verify log files contain version and command (Issue #517)
run: |
echo "Testing that log files contain version and command at the start..."
timeout 30s ./src/solve.mjs "https://github.com/test/repo/issues/1" --dry-run --skip-tool-check 2>&1 | tee test-log-output.txt || true
LOG_FILE=$(grep -o "solve-[0-9T-]*Z\.log" test-log-output.txt | head -1)
if [ -z "$LOG_FILE" ]; then
echo "Could not find log file path in output"
cat test-log-output.txt
exit 1
fi
echo "Log file: $LOG_FILE"
if [ ! -f "$LOG_FILE" ]; then
echo "Log file not found: $LOG_FILE"
ls -la solve-*.log || echo "No solve log files found"
exit 1
fi
echo ""
echo "Checking log file contents..."
head -30 "$LOG_FILE"
echo ""
echo "Verifying version appears in log..."
if grep -q "solve v" "$LOG_FILE"; then
echo "Version found in log file"
else
echo "Version NOT found in log file"
exit 1
fi
echo ""
echo "Verifying command appears in log..."
if grep -q "Raw command executed:" "$LOG_FILE"; then
echo "Command found in log file"
else
echo "Command NOT found in log file"
exit 1
fi
echo ""
echo "Log file verification passed - version and command are present"
- name: Test hive.mjs execution
run: |
echo "Testing hive.mjs basic execution..."
timeout 10s ./src/hive.mjs --help || echo "Help command completed"
echo "hive.mjs executes without critical errors"
timeout 10s ./src/hive.mjs --version || true
- name: Test telegram-bot.mjs execution
run: |
echo "Testing telegram-bot.mjs basic execution..."
timeout 10s ./src/telegram-bot.mjs --help || echo "Help command completed"
echo "telegram-bot.mjs executes without critical errors"
echo ""
echo "Testing telegram-bot.mjs --dry-run with issue #487 command..."
timeout 10s ./src/telegram-bot.mjs \
--token "test_token_123" \
--allowed-chats "(-1002975819706 -1002861722681)" \
--no-hive \
--solve-overrides $'( \n --auto-continue\n --attach-logs\n --verbose\n --no-tool-check\n)' \
--dry-run
echo "Issue #487 command passes with --dry-run"
- name: Test memory-check.mjs execution
run: |
./src/memory-check.mjs --help
./src/memory-check.mjs --min-memory 10 --min-disk-space 100 --json
- name: Test global command installation
run: |
echo "Testing npm global command installation from local folder..."
npm link
echo "npm link completed successfully"
echo ""
echo "Testing 'hive' global command..."
timeout 10s hive --version || true
timeout 10s hive --help || echo "Help command completed"
echo "'hive' global command works"
echo ""
echo "Testing 'solve' global command..."
timeout 10s solve --version || true
timeout 10s solve --help || echo "Help command completed"
echo "'solve' global command works"
echo ""
echo "Testing 'hive-telegram-bot' global command..."
timeout 10s hive-telegram-bot --help || echo "Help command completed"
echo "'hive-telegram-bot' global command works"
echo ""
echo "Testing hive-telegram-bot --dry-run (issue #487)..."
timeout 30s hive-telegram-bot \
--token "test_token" \
--allowed-chats "(-1 -2)" \
--no-hive \
--solve-overrides "(--auto-continue --verbose)" \
--dry-run
echo "'hive-telegram-bot --dry-run' works"
echo ""
echo "Cleaning up global link..."
npm unlink || true
- name: Test hive dry-run with solve integration
run: |
echo "Testing hive dry-run mode with solve command integration..."
timeout 30s ./src/hive.mjs https://github.com/test/repo --dry-run --skip-claude-check --once --max-issues 1 2>&1 | tee hive_dry_run.log || true
if grep -q "solve.*--dry-run.*--skip-claude-check" hive_dry_run.log; then
echo "hive correctly passes --dry-run and --skip-claude-check flags to solve command"
else
echo "Could not verify flag propagation in dry-run mode (may be due to no issues found)"
fi
echo ""
echo "Testing solve.mjs with --dry-run and --skip-claude-check flags..."
timeout 10s ./src/solve.mjs https://github.com/test/repo/issues/1 --dry-run --skip-claude-check 2>&1 | head -20 || true
echo "solve.mjs accepts --dry-run and --skip-claude-check flags"
- name: Test --auto-fork option
run: |
echo "Testing --auto-fork option with dry-run mode..."
echo ""
echo "Testing solve.mjs with --auto-fork and --dry-run..."
timeout 10s ./src/solve.mjs https://github.com/test/repo/issues/1 --auto-fork --dry-run --skip-tool-check 2>&1 | tee solve_auto_fork.log || true
if grep -qE "(auto-fork|Auto-fork)" solve_auto_fork.log; then
echo "solve.mjs recognizes --auto-fork flag"
else
echo "Could not verify --auto-fork flag in solve output"
fi
echo ""
echo "Testing hive.mjs with --auto-fork and --dry-run..."
timeout 30s ./src/hive.mjs https://github.com/test/repo --auto-fork --dry-run --skip-tool-check --once --max-issues 1 2>&1 | tee hive_auto_fork.log || true
if grep -qE "(auto-fork|Auto-fork)" hive_auto_fork.log; then
echo "hive.mjs recognizes --auto-fork flag"
else
echo "Could not verify --auto-fork flag in hive output"
fi
echo ""
echo "Testing start-screen.mjs passes --auto-fork to solve..."
timeout 5s ./src/start-screen.mjs solve https://github.com/test/repo/issues/1 --auto-fork 2>&1 | tee start_screen_auto_fork.log || true
if grep -qE "(auto-fork|GNU Screen|screen.*not.*installed)" start_screen_auto_fork.log; then
echo "start-screen.mjs accepts --auto-fork flag"
else
echo "Could not verify start-screen flag acceptance"
fi
echo ""
echo "All --auto-fork option tests completed"
# === MEMORY CHECKS - LINUX ===
memory-check-linux:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check, test-compilation, lint, check-file-line-limits]
if: |
always() &&
!cancelled() &&
!contains(needs.*.result, 'failure') &&
(github.event_name == 'push' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') &&
needs.test-compilation.result == 'success' &&
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
(needs.check-file-line-limits.result == 'success' || needs.check-file-line-limits.result == 'skipped') &&
(needs.detect-changes.outputs.any-code-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: System info
run: |
echo "=== System Information ==="
uname -a
echo ""
echo "=== Memory Information ==="
free -h
echo ""
echo "=== Disk Information ==="
df -h
echo ""
echo "=== CPU Information ==="
lscpu | head -20
- name: Run memory-check tests
run: |
chmod +x tests/test-memory-check.mjs
node tests/test-memory-check.mjs
- name: Test memory-check with various thresholds
run: |
echo "Testing with low thresholds (should pass)..."
./src/memory-check.mjs --min-memory 10 --min-disk-space 100 --json
echo ""
echo "Testing verbose output..."
./src/memory-check.mjs --min-memory 10 --min-disk-space 100
echo ""
echo "Testing quiet mode..."
./src/memory-check.mjs --min-memory 10 --min-disk-space 100 --quiet --json
- name: Test memory-check failure conditions
run: |
echo "Testing with impossible memory requirement (should fail)..."
if ./src/memory-check.mjs --min-memory 999999 --exit-on-failure --quiet --json; then
echo "ERROR: Should have failed with impossible memory requirement"
exit 1
else
echo "Correctly failed with impossible memory requirement"
fi
echo ""
echo "Testing with impossible disk requirement (should fail)..."
if ./src/memory-check.mjs --min-disk-space 999999999 --exit-on-failure --quiet --json; then
echo "ERROR: Should have failed with impossible disk requirement"
exit 1
else
echo "Correctly failed with impossible disk requirement"
fi
# === DOCUMENTATION VALIDATION (FAST) ===
validate-docs:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check]
# Run if: push event, OR changeset-check succeeded, OR changeset-check was skipped (docs-only PR)
if: always() && (github.event_name == 'push' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') && needs.detect-changes.outputs.docs-changed == 'true'
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Validate documentation files
run: |
echo "Running documentation validation tests..."
chmod +x tests/docs-validation.mjs
node tests/docs-validation.mjs
# === DOCKER PR CHECK ===
docker-pr-check:
runs-on: ubuntu-latest
needs: [detect-changes, changeset-check, test-compilation, lint, check-file-line-limits]
# Run if: changeset-check succeeded OR was skipped (docs-only PR), and required checks passed
if: |
always() &&
!cancelled() &&
!contains(needs.*.result, 'failure') &&
github.event_name == 'pull_request' &&
(needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped') &&
(needs.test-compilation.result == 'success' || needs.test-compilation.result == 'skipped') &&
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
(needs.check-file-line-limits.result == 'success' || needs.check-file-line-limits.result == 'skipped') &&
(needs.detect-changes.outputs.docker-changed == 'true' || needs.detect-changes.outputs.workflow-changed == 'true')
env:
REGISTRY: docker.io
IMAGE_NAME: konard/hive-mind
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Free up disk space
run: node scripts/free-disk-space.mjs
- name: Build Docker image with log capture
run: |
echo "Building Docker image with log capture..."
# Note: Multi-platform builds (amd64+arm64) are tested in docker-publish job during release
# PR checks only validate amd64 using standard docker build (not buildx) to ensure
# the image is properly loaded into Docker daemon for container verification
docker build --progress=plain -t ${{ env.IMAGE_NAME }}:test . 2>&1 | tee build-output.log
echo ""
echo "Docker image built successfully"
docker images | grep -E "${{ env.IMAGE_NAME }}|REPOSITORY"
- name: Verify system & development tools installation in build logs
run: |
echo "Checking installation status in build logs..."
echo "Verifying all tools are installed (in alphabetical order to reduce merge conflicts)"
echo ""
# Check for failures - alphabetical order
if grep -E '\[!\] Bun: not found' build-output.log; then
echo "ERROR: Bun installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Cargo: not found' build-output.log; then
echo "ERROR: Cargo installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Clang: not found' build-output.log; then
echo "ERROR: Clang installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Clang\+\+: not found' build-output.log; then
echo "ERROR: Clang++ installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] CMake: not found' build-output.log; then
echo "ERROR: CMake installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Deno: not found' build-output.log; then
echo "ERROR: Deno installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Elan: not found' build-output.log; then
echo "ERROR: Elan installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] G\+\+: not found' build-output.log; then
echo "ERROR: G++ installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] GCC: not found' build-output.log; then
echo "ERROR: GCC installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Git: not found' build-output.log; then
echo "ERROR: Git installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] GitHub CLI: not found' build-output.log; then
echo "ERROR: GitHub CLI installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Go: not found' build-output.log; then
echo "ERROR: Go installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Homebrew: not found' build-output.log; then
echo "ERROR: Homebrew installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Java: not found' build-output.log; then
echo "ERROR: Java installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Lake: not found' build-output.log; then
echo "ERROR: Lake installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Lean: not found' build-output.log; then
echo "ERROR: Lean installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] LLD Linker: not found' build-output.log; then
echo "ERROR: LLD Linker installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] LLVM: not found' build-output.log; then
echo "ERROR: LLVM installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Make: not found' build-output.log; then
echo "ERROR: Make installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Node\.js: not found' build-output.log; then
echo "ERROR: Node.js installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] NPM: not found' build-output.log; then
echo "ERROR: NPM installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Opam: not found' build-output.log; then
echo "ERROR: Opam installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] PHP: not found' build-output.log; then
echo "ERROR: PHP installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Perl: not found' build-output.log; then
echo "ERROR: Perl installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Perlbrew: not found' build-output.log; then
echo "ERROR: Perlbrew installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Playwright: not found' build-output.log; then
echo "ERROR: Playwright installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Python: not found' build-output.log; then
echo "ERROR: Python installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Pyenv: not found' build-output.log; then
echo "ERROR: Pyenv installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Rocq/Coq: not found' build-output.log; then
echo "ERROR: Rocq/Coq installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] Rust: not found' build-output.log; then
echo "ERROR: Rust installation failed - showing as 'not found'"
exit 1
fi
if grep -E '\[!\] SDKMAN: not found' build-output.log; then
echo "ERROR: SDKMAN installation failed - showing as 'not found'"
exit 1
fi
# Check for unbound variable errors (issue #989)
# These indicate shell scripts using $1 or other variables without protection under set -u
if grep -E 'unbound variable' build-output.log; then
echo "ERROR: Unbound variable error detected in Docker build"
echo "This typically indicates a shell script issue with set -u compatibility"
grep -E 'unbound variable' build-output.log || true
exit 1
fi
# Verify successful installations - alphabetical order
echo ""
echo "Verifying successful installations..."
if grep -E '\[✓\] Bun:' build-output.log; then
echo "Bun installation verified in build logs"
else
echo "WARNING: Bun success message not found in logs"
fi
if grep -E '\[✓\] Cargo:' build-output.log; then
echo "Cargo installation verified in build logs"
else
echo "WARNING: Cargo success message not found in logs"
fi
if grep -E '\[✓\] Clang:' build-output.log; then
echo "Clang installation verified in build logs"
else
echo "WARNING: Clang success message not found in logs"
fi
if grep -E '\[✓\] Clang\+\+:' build-output.log; then
echo "Clang++ installation verified in build logs"
else
echo "WARNING: Clang++ success message not found in logs"
fi
if grep -E '\[✓\] CMake:' build-output.log; then
echo "CMake installation verified in build logs"
else
echo "WARNING: CMake success message not found in logs"
fi
if grep -E '\[✓\] Deno:' build-output.log; then
echo "Deno installation verified in build logs"
else
echo "WARNING: Deno success message not found in logs"
fi
if grep -E '\[✓\] Elan:' build-output.log; then
echo "Elan installation verified in build logs"
else
echo "WARNING: Elan success message not found in logs"
fi
if grep -E '\[✓\] G\+\+:' build-output.log; then
echo "G++ installation verified in build logs"
else
echo "WARNING: G++ success message not found in logs"
fi
if grep -E '\[✓\] GCC:' build-output.log; then
echo "GCC installation verified in build logs"
else
echo "WARNING: GCC success message not found in logs"
fi
if grep -E '\[✓\] Git:' build-output.log; then
echo "Git installation verified in build logs"
else
echo "WARNING: Git success message not found in logs"
fi
if grep -E '\[✓\] GitHub CLI:' build-output.log; then
echo "GitHub CLI installation verified in build logs"
else
echo "WARNING: GitHub CLI success message not found in logs"
fi
if grep -E '\[✓\] Go:' build-output.log; then
echo "Go installation verified in build logs"
else
echo "WARNING: Go success message not found in logs"
fi
if grep -E '\[✓\] Homebrew:' build-output.log; then
echo "Homebrew installation verified in build logs"
else
echo "WARNING: Homebrew success message not found in logs"
fi
if grep -E '\[✓\] Java:' build-output.log; then
echo "Java installation verified in build logs"
else
echo "WARNING: Java success message not found in logs"
fi
if grep -E '\[✓\] Lake:' build-output.log; then
echo "Lake installation verified in build logs"
else
echo "WARNING: Lake success message not found in logs"
fi
if grep -E '\[✓\] Lean:' build-output.log; then
echo "Lean installation verified in build logs"
else
echo "WARNING: Lean success message not found in logs"
fi
if grep -E '\[✓\] LLD Linker:' build-output.log; then
echo "LLD Linker installation verified in build logs"
else
echo "WARNING: LLD Linker success message not found in logs"
fi
if grep -E '\[✓\] LLVM:' build-output.log; then
echo "LLVM installation verified in build logs"
else
echo "WARNING: LLVM success message not found in logs"
fi
if grep -E '\[✓\] Make:' build-output.log; then
echo "Make installation verified in build logs"
else
echo "WARNING: Make success message not found in logs"
fi
if grep -E '\[✓\] Node\.js:' build-output.log; then
echo "Node.js installation verified in build logs"
else
echo "WARNING: Node.js success message not found in logs"
fi
if grep -E '\[✓\] NPM:' build-output.log; then
echo "NPM installation verified in build logs"
else
echo "WARNING: NPM success message not found in logs"
fi
if grep -E '\[✓\] Opam:' build-output.log; then
echo "Opam installation verified in build logs"
else
echo "WARNING: Opam success message not found in logs"
fi
if grep -E '\[✓\] PHP:' build-output.log; then
echo "PHP installation verified in build logs"
else
echo "WARNING: PHP success message not found in logs (may appear as 'installed but not in current PATH' during build)"
fi