Repository navigation
1510 lines (1380 loc) · 86.2 KB
/
Copy pathcommit.yml
File metadata and controls
1510 lines (1380 loc) · 86.2 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
# GitHub runner workflow for building, verifying and testing the XVM repo.
#
# This is the main CI workflow that runs on every push. It builds the XDK,
# runs tests, and uploads build artifacts. After a successful build, publishing
# workflows (snapshot-release, docker-build, homebrew-update) are automatically
# triggered on master branch or when manually run with test-publishing=true.
#
# PLATFORM NOTES:
# - Ubuntu: ubuntu-latest (currently Ubuntu 22.04)
# - Windows: windows-latest
#
name: Verify Commit
permissions:
contents: write
actions: write
on:
push:
# Only run on master (after PRs are merged)
branches: [master]
pull_request:
# Test all PRs before merging. JIT is included because it is a long-running integration
# branch that feature work is targeted at, and this filter matches the *base* branch, so
# without it nothing aimed at JIT is ever built. Publishing steps are separately gated on
# "push to master", so this cannot trigger a release of any kind.
branches: [master, JIT]
# Manual trigger - optionally triggers publishing workflows after successful completion
# This allows testing the full publishing pipeline from any branch
# without pushing to master.
workflow_dispatch:
inputs:
publish-snapshots:
description: 'Trigger publishing workflows after build (snapshot, docker, homebrew)'
type: boolean
required: false
default: false
publish-intellij-plugin:
description: 'Trigger IntelliJ plugin snapshot publishing after build'
type: boolean
required: false
default: false
force-publish-intellij-plugin:
description: 'Force IntelliJ plugin snapshot publishing regardless of publish-intellij-plugin or IntelliJ plugin input changes'
type: boolean
required: false
default: false
publish-vscode-extension:
description: 'Trigger VS Code extension snapshot publishing after build'
type: boolean
required: false
default: false
force-publish-vscode-extension:
description: 'Force VS Code extension snapshot publishing regardless of publish-vscode-extension or VS Code extension input changes'
type: boolean
required: false
default: false
platforms:
description: 'Run only single platform (ubuntu-latest, windows-latest, or all platforms)'
type: choice
required: false
default: 'ubuntu-latest'
options:
- 'ubuntu-latest'
- 'windows-latest'
- 'all'
extra-gradle-options:
description: 'Extra Gradle options to pass to the build'
required: false
skip-tests:
description: 'Skip manual tests'
type: boolean
required: false
default: false
parallel-test-mode:
description: 'Run manual tests in parallel mode'
type: boolean
required: false
default: false
include-lang:
description: 'Include lang projects in build and run tree-sitter validation'
type: boolean
required: false
default: false
env:
# Add manual tests as included builds - defaults to true for push/PR and for workflow_dispatch
# unless manual tests are explicitly skipped. This must not depend on include-lang.
ORG_GRADLE_PROJECT_includeBuildManualTests: ${{ github.event_name != 'workflow_dispatch' || !(github.event.inputs.skip-tests == true || github.event.inputs.skip-tests == 'true') }}
ORG_GRADLE_PROJECT_includeBuildAttachManualTests: ${{ github.event_name != 'workflow_dispatch' || !(github.event.inputs.skip-tests == true || github.event.inputs.skip-tests == 'true') }}
ORG_GRADLE_PROJECT_xtcPluginOverrideVerboseLogging: true
RUN_INTEGRATION_TESTS: true
# Lang build inclusion - overrides gradle.properties default (true) to exclude lang
# from push/PR CI builds. Only included via workflow_dispatch with include-lang=true.
# Tree-sitter validation steps have their own path-based gating.
ORG_GRADLE_PROJECT_includeBuildLang: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.include-lang == true || github.event.inputs.include-lang == 'true') }}
ORG_GRADLE_PROJECT_includeBuildAttachLang: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.include-lang == true || github.event.inputs.include-lang == 'true') }}
skip_manual_tests: ${{ github.event.inputs.skip-tests == true || github.event.inputs.skip-tests == 'true' }}
# TODO: Temporarily keep CI manual tests sequential until the runtime INSTANCE/template startup
# race is fixed. Manual workflow_dispatch runs can still opt into parallel mode to reproduce it.
run_manual_tests_parallel: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.parallel-test-mode == true || github.event.inputs.parallel-test-mode == 'true') }}
trigger_publishing: ${{ github.event.inputs.publish-snapshots == true || github.event.inputs.publish-snapshots == 'true' }}
GRADLE_CACHE_INSPECT_ENABLED: false
# The commit that names and stamps this run's artifacts. Consumers (publish-docker,
# publish-snapshot, homebrew-update) look artifacts up by the run's head_sha. On pull_request
# runs github.sha is GitHub's synthetic merge commit instead, so use the PR head; on pushes
# and manual dispatches the two are the same.
ARTIFACT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
# Gradle cache inspection function
GRADLE_CACHE_INSPECT: |
inspect_gradle_cache() {
if [ "${GRADLE_CACHE_INSPECT_ENABLED:-false}" != "true" ]; then
return 0
fi
local label="${1:-}"
local gradle_home="${GRADLE_USER_HOME:-$HOME/.gradle}"
echo "🔍 Gradle Cache Inspection${label:+ ($label)}:"
echo " Cache location: $gradle_home"
if [ ! -d "$gradle_home" ]; then
echo " Cache exists: ❌"
return 0
fi
echo " Cache exists: ✅"
local total_size=$(du -sh "$gradle_home" 2>/dev/null | cut -f1 || echo "unknown")
echo " Cache size: $total_size"
for dir in caches wrapper build-cache; do
if [ -d "$gradle_home/$dir" ]; then
local dir_size=$(du -sh "$gradle_home/$dir" 2>/dev/null | cut -f1 || echo "unknown")
echo " $dir: $dir_size"
fi
done
}
# Concurrency settings: group by workflow and ref to prevent duplicate runs
# Push and pull_request for the same branch will cancel each other (keeping latest)
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
# What CI this change needs. .github/scripts/ci-changes.py holds the one definition of what
# each piece of CI reads and derives every answer from it:
# - docs-only: the change touches only documentation (markdown anywhere, the doc/ tree, apart
# from what the VSIX bundles). A pull request like that skips build-and-test; the required
# "All builds complete" check still reports. Master pushes and manual runs always build.
# - which lang checks the change needs, and a fingerprint of each check's inputs:
# - core (tree-sitter grammar, XDK corpus, native libraries; LSP adapter and DSL tests)
# - IntelliJ plugin (main build with the lang composite attached, Plugin Verifier)
# - VS Code extension (headless tests, VSIX)
# Their inputs live inside lang/ and outside it (build-logic, the Gradle wrapper, XDK sources
# the core checks parse, files the plugins bundle, and the version catalog entries each part
# of the lang build uses). A change to the shared lang build needs every check; a plugin
# change only that plugin's; an XDK source change only the core checks. So a VS Code-only
# change (such as the weekly Dependabot npm bumps) does not build and verify the IntelliJ
# plugin with the two IntelliJ distributions (~3 GB) that downloads, and an XDK-only bump that
# lang does not use runs no lang check.
changes:
name: Classify changes
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.classify.outputs.docs-only }}
lang: ${{ steps.classify.outputs.lang }}
core: ${{ steps.classify.outputs.core }}
intellij: ${{ steps.classify.outputs.intellij }}
vscode: ${{ steps.classify.outputs.vscode }}
reason: ${{ steps.classify.outputs.reason }}
core-fingerprint: ${{ steps.classify.outputs.core-fingerprint }}
intellij-fingerprint: ${{ steps.classify.outputs.intellij-fingerprint }}
vscode-fingerprint: ${{ steps.classify.outputs.vscode-fingerprint }}
steps:
- name: Fetch Sources
uses: actions/checkout@v7
with:
fetch-depth: 0 # The comparison base must be in the history
persist-credentials: false
- name: Classify changes
id: classify
shell: bash
run: |
case "${{ github.event_name }}" in
pull_request) BASE="${{ github.event.pull_request.base.sha }}" ;;
push) BASE="${{ github.event.before }}" ;;
*) BASE=$(git merge-base origin/master HEAD) ;;
esac
python3 .github/scripts/ci-changes.py "$BASE" HEAD | tee -a "$GITHUB_OUTPUT"
build-and-test:
needs: changes
if: github.event_name != 'pull_request' || needs.changes.outputs.docs-only != 'true'
outputs:
lang-changed: ${{ needs.changes.outputs.lang }}
effective-publish-intellij: ${{ steps.publish-flags.outputs.effective }}
effective-publish-vscode: ${{ steps.publish-flags.outputs.effective-vscode }}
strategy:
matrix:
os: ${{ github.event.inputs.platforms == 'ubuntu-latest' && fromJSON('["ubuntu-latest"]') || github.event.inputs.platforms == 'windows-latest' && fromJSON('["windows-latest"]') || github.event.inputs.platforms == 'all' && fromJSON('["ubuntu-latest", "windows-latest"]') || fromJSON('["ubuntu-latest"]') }}
runs-on: ${{ matrix.os }}
steps:
- name: Fetch Sources
uses: actions/checkout@v7
with:
fetch-depth: 0 # Full history for git version details (palantir git-version in javatools)
show-progress: true
persist-credentials: false
# Cache markers (see the marker steps below) need a file to save.
- name: Prepare lang check markers
if: github.event_name == 'pull_request' && needs.changes.outputs.lang == 'true'
shell: bash
run: echo "$GITHUB_SHA" > "$RUNNER_TEMP/lang-ci-marker"
# A pull request re-ran every lang check on each push while its diff touched lang, even
# when the push (a rebase, a commit elsewhere) left a check's inputs as an earlier run of
# the pull request had checked them. A check that passes saves a marker under its
# fingerprint, and later runs with the same fingerprint skip it. Pull request caches are
# scoped to the pull request, so markers never cross pull requests.
- name: Look up lang core marker
id: core-marker
if: github.event_name == 'pull_request' && needs.changes.outputs.core == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/lang-ci-marker
key: lang-core-passed-${{ needs.changes.outputs.core-fingerprint }}
lookup-only: true
- name: Look up IntelliJ plugin marker
id: intellij-marker
if: github.event_name == 'pull_request' && needs.changes.outputs.intellij == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/lang-ci-marker
key: lang-intellij-passed-${{ needs.changes.outputs.intellij-fingerprint }}
lookup-only: true
- name: Look up VS Code extension marker
id: vscode-marker
if: github.event_name == 'pull_request' && needs.changes.outputs.vscode == 'true'
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/lang-ci-marker
key: lang-vscode-passed-${{ needs.changes.outputs.vscode-fingerprint }}
lookup-only: true
# Gating policy. Each check runs when the change needs it (changes job) or a manual
# override asks for it, unless an earlier run of this pull request passed it on the same
# inputs:
# - include-lang=true runs every check
# - publish-/force-publish-intellij-plugin=true runs the core and IntelliJ plugin checks
# - publish-/force-publish-vscode-extension=true runs the core and VS Code extension checks
# so nothing publishes without its checks. Each plugin publishes, from its own inputs:
# 1. force-publish-<plugin>=true (workflow_dispatch only) -> always publish
# 2. push to master with changes to that plugin's inputs -> auto-publish
# 3. workflow_dispatch with publish-<plugin>=true and changes to that plugin's inputs -> publish
- name: Compute lang check and publish flags
id: publish-flags
shell: bash
run: |
FORCE_INTELLIJ="${{ github.event.inputs.force-publish-intellij-plugin }}"
REQUESTED_INTELLIJ="${{ github.event.inputs.publish-intellij-plugin }}"
FORCE_VSCODE="${{ github.event.inputs.force-publish-vscode-extension }}"
REQUESTED_VSCODE="${{ github.event.inputs.publish-vscode-extension }}"
INCLUDE_LANG="${{ github.event.inputs.include-lang }}"
EVENT_NAME="${{ github.event_name }}"
REF="${{ github.ref }}"
MASTER_PUSH=false
if [ "$EVENT_NAME" = "push" ] && [ "$REF" = "refs/heads/master" ]; then
MASTER_PUSH=true
fi
# override INPUT=VALUE...: prints the first input set to true.
override() {
for setting in "$@"; do
if [ "${setting#*=}" = "true" ]; then
echo "${setting%%=*}=true"
return
fi
done
}
INTELLIJ_OVERRIDE=$(override "include-lang=$INCLUDE_LANG" \
"force-publish-intellij-plugin=$FORCE_INTELLIJ" "publish-intellij-plugin=$REQUESTED_INTELLIJ")
VSCODE_OVERRIDE=$(override "include-lang=$INCLUDE_LANG" \
"force-publish-vscode-extension=$FORCE_VSCODE" "publish-vscode-extension=$REQUESTED_VSCODE")
CORE_OVERRIDE=${INTELLIJ_OVERRIDE:-$VSCODE_OVERRIDE}
# check NAME NEEDED OVERRIDE MARKER_HIT: prints "true|false<TAB>reason".
check() {
if [ "$2" != "true" ] && [ -z "$3" ]; then
printf 'false\tno changes to %s inputs and no manual override\n' "$1"
elif [ "$EVENT_NAME" = "pull_request" ] && [ "$4" = "true" ]; then
printf 'false\t%s inputs unchanged since an earlier run of this pull request passed its checks\n' "$1"
elif [ "$2" = "true" ]; then
printf 'true\t%s inputs changed\n' "$1"
else
printf 'true\tmanual override: %s\n' "$3"
fi
}
# publish NAME CHANGED FORCE REQUESTED INPUT: prints "true|false<TAB>reason".
publish() {
if [ "$3" = "true" ]; then
printf 'true\tforced via force-%s=true (overrides all other gating)\n' "$5"
elif [ "$MASTER_PUSH" = "true" ] && [ "$2" = "true" ]; then
printf 'true\tauto-publish on master merge with %s input changes\n' "$1"
elif [ "$MASTER_PUSH" = "true" ]; then
printf 'false\tmaster push without %s input changes -- nothing to publish (use force-%s=true via workflow_dispatch to override)\n' "$1" "$5"
elif [ "$4" = "true" ] && [ "$2" = "true" ]; then
printf 'true\tmanual dispatch with %s=true and %s input changes\n' "$5" "$1"
elif [ "$4" = "true" ]; then
printf 'false\tmanual dispatch with %s=true but no %s input changes (set force-%s=true to override)\n' "$5" "$1" "$5"
elif [ "$EVENT_NAME" = "workflow_dispatch" ]; then
printf 'false\tmanual dispatch but neither %s nor force-%s was enabled\n' "$5" "$5"
else
printf 'false\tevent=%s on %s -- plugins only publish on master push or manual dispatch\n' "$EVENT_NAME" "$REF"
fi
}
IFS=$'\t' read -r VALIDATE_CORE CORE_REASON < <(check "lang core" \
"${{ needs.changes.outputs.core }}" "$CORE_OVERRIDE" "${{ steps.core-marker.outputs.cache-hit }}")
IFS=$'\t' read -r VERIFY_INTELLIJ VERIFY_REASON < <(check "IntelliJ plugin" \
"${{ needs.changes.outputs.intellij }}" "$INTELLIJ_OVERRIDE" "${{ steps.intellij-marker.outputs.cache-hit }}")
IFS=$'\t' read -r VALIDATE_VSCODE VSCODE_REASON < <(check "VS Code extension" \
"${{ needs.changes.outputs.vscode }}" "$VSCODE_OVERRIDE" "${{ steps.vscode-marker.outputs.cache-hit }}")
IFS=$'\t' read -r EFFECTIVE REASON < <(publish "IntelliJ plugin" \
"${{ needs.changes.outputs.intellij }}" "$FORCE_INTELLIJ" "$REQUESTED_INTELLIJ" "publish-intellij-plugin")
IFS=$'\t' read -r EFFECTIVE_VSCODE VSCODE_PUBLISH_REASON < <(publish "VS Code extension" \
"${{ needs.changes.outputs.vscode }}" "$FORCE_VSCODE" "$REQUESTED_VSCODE" "publish-vscode-extension")
# The lang validation step runs the core and VS Code extension checks.
VALIDATE_LANG=false
if [ "$VALIDATE_CORE" = "true" ] || [ "$VALIDATE_VSCODE" = "true" ]; then
VALIDATE_LANG=true
fi
{
echo "effective=$EFFECTIVE"
echo "reason=$REASON"
echo "effective-vscode=$EFFECTIVE_VSCODE"
echo "vscode-reason=$VSCODE_PUBLISH_REASON"
echo "verify-intellij=$VERIFY_INTELLIJ"
echo "verify-intellij-reason=$VERIFY_REASON"
echo "validate-core=$VALIDATE_CORE"
echo "validate-vscode=$VALIDATE_VSCODE"
echo "validate-lang=$VALIDATE_LANG"
echo "validate-lang-reason=lang core: $CORE_REASON; VS Code extension: $VSCODE_REASON"
} >> "$GITHUB_OUTPUT"
# show WILL_RUN LABEL REASON
show() {
if [ "$1" = "true" ]; then echo "✅ $2: WILL RUN"; else echo "⏭️ $2: WILL SKIP"; fi
echo " $3"
}
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🌳 lang changed: ${{ needs.changes.outputs.lang }} (${{ needs.changes.outputs.reason }})"
echo " 📋 fingerprints: core ${{ needs.changes.outputs.core-fingerprint }}, IntelliJ plugin ${{ needs.changes.outputs.intellij-fingerprint }}, VS Code extension ${{ needs.changes.outputs.vscode-fingerprint }}"
echo " 📋 event: $EVENT_NAME on $REF; runner: ${{ matrix.os }} (lang checks only run on ubuntu-latest)"
echo " 📋 overrides: IntelliJ plugin ${INTELLIJ_OVERRIDE:-<none>}, VS Code extension ${VSCODE_OVERRIDE:-<none>}"
show "$VALIDATE_CORE" "Lang core checks (tree-sitter, XDK corpus, LSP adapter and DSL tests)" "$CORE_REASON"
show "$VERIFY_INTELLIJ" "IntelliJ plugin checks (lang build, Plugin Verifier)" "$VERIFY_REASON"
show "$VALIDATE_VSCODE" "VS Code extension checks (headless tests, VSIX)" "$VSCODE_REASON"
show "$EFFECTIVE" "IntelliJ plugin publication" "$REASON"
show "$EFFECTIVE_VSCODE" "VS Code extension publication" "$VSCODE_PUBLISH_REASON"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
- name: 🚀 Publishing Configuration
shell: bash
run: |
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Determine if publishing will be triggered
WILL_PUBLISH=false
# Check if this is a Dependabot merge (always skip)
if [ "${{ github.actor }}" = "dependabot[bot]" ]; then
echo "::notice::⏭️ PUBLISHING DISABLED: Dependabot merge detected"
echo -e "\033[1;33m"
echo " ⏭️ NO PUBLISHING WORKFLOWS WILL BE TRIGGERED"
echo -e "\033[0m"
echo " 📋 Reason: Dependabot merges don't trigger publishing"
echo " 📋 Actor: ${{ github.actor }}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
exit 0
fi
# Check if this is master + push
if [ "${{ github.ref }}" = "refs/heads/master" ] && [ "${{ github.event_name }}" = "push" ]; then
WILL_PUBLISH=true
TRIGGER_REASON="Push to master branch"
fi
# Check if this is manual trigger with any publishing enabled
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && \
{ [ "${{ github.event.inputs.publish-snapshots }}" = "true" ] || \
[ "${{ github.event.inputs.publish-intellij-plugin }}" = "true" ] || \
[ "${{ github.event.inputs.force-publish-intellij-plugin }}" = "true" ] || \
[ "${{ github.event.inputs.publish-vscode-extension }}" = "true" ] || \
[ "${{ github.event.inputs.force-publish-vscode-extension }}" = "true" ]; }; then
WILL_PUBLISH=true
TRIGGER_REASON="Manual trigger with publish-snapshots or a plugin publish input enabled"
fi
INTELLIJ_REQUESTED=false
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && \
{ [ "${{ github.event.inputs.publish-intellij-plugin }}" = "true" ] || \
[ "${{ github.event.inputs.force-publish-intellij-plugin }}" = "true" ]; }; then
INTELLIJ_REQUESTED=true
fi
INTELLIJ_EFFECTIVE="${{ steps.publish-flags.outputs.effective }}"
INTELLIJ_SKIP_REASON=""
if [ "$INTELLIJ_REQUESTED" = "true" ] && [ "$INTELLIJ_EFFECTIVE" != "true" ]; then
INTELLIJ_SKIP_REASON="${{ steps.publish-flags.outputs.reason }}"
fi
VSCODE_REQUESTED=false
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && \
{ [ "${{ github.event.inputs.publish-vscode-extension }}" = "true" ] || \
[ "${{ github.event.inputs.force-publish-vscode-extension }}" = "true" ]; }; then
VSCODE_REQUESTED=true
fi
VSCODE_EFFECTIVE="${{ steps.publish-flags.outputs.effective-vscode }}"
VSCODE_SKIP_REASON=""
if [ "$VSCODE_REQUESTED" = "true" ] && [ "$VSCODE_EFFECTIVE" != "true" ]; then
VSCODE_SKIP_REASON="${{ steps.publish-flags.outputs.vscode-reason }}"
fi
if [ "$WILL_PUBLISH" = "true" ]; then
echo "::notice::📦 PUBLISHING ENABLED: Snapshot publishing workflows will be triggered after successful build"
echo -e "\033[1;32m"
echo " 🚀 PUBLISHING WORKFLOWS WILL BE TRIGGERED"
echo -e "\033[0m"
echo " 📋 Reason: $TRIGGER_REASON"
echo " 📦 Workflows: Publish Snapshots, Publish Docker Images, Update Homebrew"
if [ "$INTELLIJ_EFFECTIVE" = "true" ]; then
echo " 📦 IntelliJ Plugin Snapshot: ENABLED"
elif [ "$INTELLIJ_REQUESTED" = "true" ]; then
echo " ⏭️ IntelliJ Plugin Snapshot: SKIPPED"
echo " 📋 Reason: $INTELLIJ_SKIP_REASON"
else
echo " ⏭️ IntelliJ Plugin Snapshot: DISABLED"
fi
if [ "$VSCODE_EFFECTIVE" = "true" ]; then
echo " 📦 VS Code Extension Snapshot: ENABLED"
elif [ "$VSCODE_REQUESTED" = "true" ]; then
echo " ⏭️ VS Code Extension Snapshot: SKIPPED"
echo " 📋 Reason: $VSCODE_SKIP_REASON"
else
echo " ⏭️ VS Code Extension Snapshot: DISABLED"
fi
else
echo "::notice::⏭️ PUBLISHING DISABLED: No publishing workflows will be triggered"
echo -e "\033[1;33m"
echo " ⏭️ NO PUBLISHING WORKFLOWS WILL BE TRIGGERED"
echo -e "\033[0m"
echo " 📋 Branch: ${{ github.ref_name }}"
echo " 📋 Event: ${{ github.event_name }}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo " 📋 publish-snapshots: ${{ github.event.inputs.publish-snapshots }}"
echo " 📋 publish-intellij-plugin: ${{ github.event.inputs.publish-intellij-plugin }}"
echo " 📋 force-publish-intellij-plugin: ${{ github.event.inputs.force-publish-intellij-plugin }}"
echo " 📋 publish-vscode-extension: ${{ github.event.inputs.publish-vscode-extension }}"
echo " 📋 force-publish-vscode-extension: ${{ github.event.inputs.force-publish-vscode-extension }}"
echo " 📋 include-lang: ${{ github.event.inputs.include-lang }}"
if [ "$INTELLIJ_REQUESTED" = "true" ] && [ "$INTELLIJ_EFFECTIVE" != "true" ]; then
echo " 📋 IntelliJ skip reason: $INTELLIJ_SKIP_REASON"
fi
if [ "$VSCODE_REQUESTED" = "true" ] && [ "$VSCODE_EFFECTIVE" != "true" ]; then
echo " 📋 VS Code skip reason: $VSCODE_SKIP_REASON"
fi
fi
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
- name: Setup XVM Project
id: versions
uses: ./.github/actions/setup-xvm-project
with:
setup-build: true
# Only master writes the Gradle cache that PR runs restore from. Caches saved from
# a PR ref are visible only to later runs of that same PR, and saving one cost
# about 75 s of "Post Setup" per run.
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
enable-debug: false
- name: Debug Environment (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
echo "=== Windows Debug Information ==="
echo "OS: $RUNNER_OS"
echo "Operating System: $(uname -a 2>/dev/null || echo 'N/A')"
echo "Java version:"
java -version 2>&1 || echo "Java not available"
echo "=== End Debug Information ==="
- name: Dump environment info
shell: bash
run: |
echo "*** Branch (github.ref) : ${{ github.ref }}"
echo "*** Commit (github.sha) : ${{ github.sha }}"
echo "*** Runner OS : ${{ runner.os }}"
echo "*** XDK Version : ${{ steps.versions.outputs.xdk-version }}"
echo "*** Java Version : ${{ steps.versions.outputs.java-version }}"
- name: Compute IntelliJ plugin publish version
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.effective == 'true'
id: intellij-version
shell: bash
run: |
SUFFIX=$(date -u +%Y%m%d%H%M%S)
BASE_VERSION="${{ steps.versions.outputs.xdk-version }}"
PUBLISH_VERSION="${BASE_VERSION}.${SUFFIX}"
RELEASE_CHANNEL=$(grep "^xdk.intellij.release.channel=" version.properties | cut -d'=' -f2 | tr -d '\n\r ')
echo "suffix=$SUFFIX" >> $GITHUB_OUTPUT
echo "publish-version=$PUBLISH_VERSION" >> $GITHUB_OUTPUT
echo "release-channel=$RELEASE_CHANNEL" >> $GITHUB_OUTPUT
echo "🔖 IntelliJ Marketplace publish version: $PUBLISH_VERSION"
# NOTE: We deliberately do NOT cache lang/.intellijPlatform/ides via
# actions/cache. ~1 GB per IDE distribution would eat a meaningful chunk
# of the 10 GB per-repo cache budget that's far more valuable for PR
# builds and Gradle/dep caches. The verifier only needs the IDE on the
# rare lang/-changed run (PR validation or master publish), and the
# IntelliJ Platform Gradle Plugin will redownload it on demand. Slower
# by ~1-2 minutes on those runs, but it doesn't displace the caches we
# actually rely on for everything else.
- name: Build the XDK and create a distribution
shell: bash
env:
GRADLE_OPTS: ${{ steps.versions.outputs.gradle-jvm-opts }}
ENABLE_INTELLIJ_RELEASE_BUILD: ${{ matrix.os == 'ubuntu-latest' && steps.publish-flags.outputs.effective == 'true' }}
ENABLE_INTELLIJ_VERIFY: ${{ matrix.os == 'ubuntu-latest' && steps.publish-flags.outputs.verify-intellij == 'true' }}
ENABLE_SNAPSHOT_BUNDLE_BUILD: ${{ matrix.os == 'ubuntu-latest' && ((github.ref == 'refs/heads/master' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && (github.event.inputs.publish-snapshots == true || github.event.inputs.publish-snapshots == 'true'))) }}
ORG_GRADLE_PROJECT_githubUsername: ${{ github.actor }}
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_XTCLANG_MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_XTCLANG_MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signing_keyId: ${{ secrets.ORG_XTCLANG_SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signing_password: ${{ secrets.ORG_XTCLANG_SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signing_key: ${{ secrets.ORG_XTCLANG_SIGNING_KEY }}
run: |
${{ env.GRADLE_CACHE_INSPECT }}
# Combine standard options with optional extra options
GRADLE_OPTIONS="${{ steps.versions.outputs.gradle-options }} ${{ github.event.inputs.extra-gradle-options }}"
# Root check includes spotlessCheck; CI disables the local automatic spotlessApply.
BUILD_TASKS="distZip check :plugin:compileJava"
BUILD_PROPS="-Porg.xtclang.java.test.failFast=true -Porg.xtclang.plugin.java.lint=true"
BUILD_JVM_ARGS=""
CONSUMER_REPO_DIR="$PWD/ci-artifacts/consumer-maven-repo"
SNAPSHOT_REPO_DIR="$PWD/ci-artifacts/snapshot-maven-repo"
cwd_path=$(pwd)
echo "Executing primary Gradle build from: '$cwd_path'"
# No clean: GitHub-hosted runners start from a fresh checkout with no build outputs,
# so `./gradlew clean` only cost a full configuration pass (about 50 s).
inspect_gradle_cache "before build"
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
echo "📦 Folding consumer Maven repository publication into the main CI build..."
rm -rf "$CONSUMER_REPO_DIR"
mkdir -p "$CONSUMER_REPO_DIR"
BUILD_TASKS="$BUILD_TASKS publishLocal"
BUILD_JVM_ARGS="-Dmaven.repo.local=$CONSUMER_REPO_DIR"
fi
if [ "${ENABLE_SNAPSHOT_BUNDLE_BUILD}" = "true" ]; then
echo "📦 Folding snapshot publication bundle generation into the main CI build..."
rm -rf "$SNAPSHOT_REPO_DIR"
mkdir -p "$SNAPSHOT_REPO_DIR"
BUILD_TASKS="$BUILD_TASKS publishSnapshotBundle"
BUILD_PROPS="$BUILD_PROPS -Porg.xtclang.publish.snapshotBundleRepo=$SNAPSHOT_REPO_DIR"
fi
# IntelliJ plugin handling. There is exactly one place in CI that
# runs :lang:intellij-plugin:verifyPlugin: this main Gradle invocation.
# verifyPlugin depends on buildPlugin (which depends on patchPluginXml),
# so re-running verifyPlugin in a separate Gradle invocation rewrites
# lang/intellij-plugin/build/distributions/intellij-plugin-*.zip with
# whatever properties that second invocation sees -- which is exactly
# how a prior CI shape (a standalone "Verify IntelliJ plugin
# compatibility" step that did not pass -PenablePublish) silently
# clobbered the timestamped Marketplace ZIP with the bare base
# version. Keeping verification colocated with the build means the
# staged distribution and the verified distribution are always the
# same artifact, by construction.
if [ "${ENABLE_INTELLIJ_RELEASE_BUILD}" = "true" ]; then
echo "🔌 Building release-grade IntelliJ plugin and running verifyPlugin in main CI build"
echo " Reason: ${{ steps.publish-flags.outputs.reason }}"
BUILD_TASKS="$BUILD_TASKS :lang:intellij-plugin:buildSearchableOptions :lang:intellij-plugin:buildPlugin :lang:intellij-plugin:verifyPlugin"
BUILD_PROPS="$BUILD_PROPS -PincludeBuildLang=true -PincludeBuildAttachLang=true -PenablePublish=true -Pjetbrains.publish.suffix=${{ steps.intellij-version.outputs.suffix }} -Plsp.buildSearchableOptions=true"
elif [ "${ENABLE_INTELLIJ_VERIFY}" = "true" ]; then
echo "🔌 Running IntelliJ plugin verifier in main CI build (no Marketplace publication for this run)"
echo " Reason: ${{ steps.publish-flags.outputs.verify-intellij-reason }}"
BUILD_TASKS="$BUILD_TASKS :lang:intellij-plugin:verifyPlugin"
BUILD_PROPS="$BUILD_PROPS -PincludeBuildLang=true -PincludeBuildAttachLang=true"
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
echo "⏭️ Not building or verifying IntelliJ plugin"
echo " Reason: ${{ steps.publish-flags.outputs.verify-intellij-reason }}"
fi
./gradlew $GRADLE_OPTIONS $BUILD_JVM_ARGS $BUILD_PROPS $BUILD_TASKS
# Run manual tests inline if enabled (avoids cache rebuild)
if [ "${{ env.skip_manual_tests }}" == "true" ]; then
echo "⏭️ Manual tests skipped (disabled)"
exit 0
fi
echo "🧪 Running manual tests inline (cache still hot)..."
inspect_gradle_cache "before manual tests"
mkdir -p manualTests/build/logs
# Which branch is this build ultimately for? For a pull request that is the branch
# being merged into; for a push it is the branch itself. Deciding on the target
# rather than on the source means merging JIT into master cannot drag the reduced
# JIT test selection along with it: once the target is master, the full suite runs.
target_branch="${{ github.base_ref != '' && github.base_ref || github.ref_name }}"
echo "Target branch for this build: $target_branch"
if [ "$target_branch" = "JIT" ]; then
# Temporary: while the JIT backend is still being built out, work targeted at
# the JIT branch runs only the JIT test suites, not the whole manual test set.
echo "Target is JIT: running the JIT test suites only"
./gradlew $GRADLE_OPTIONS manualTests:runJitTests manualTests:runSmallFloatsJit
else
manual_task_main=$( [ "${{ env.run_manual_tests_parallel }}" = "true" ] && echo "runCiTestTasksParallel" || echo "runCiTestTasks" )
echo "Running manual tests (main task: $manual_task_main)"
./gradlew $GRADLE_OPTIONS "manualTests:$manual_task_main"
fi
echo "🧾 Manual test logs captured under manualTests/build/logs and uploaded as CI artifacts."
inspect_gradle_cache "after manual tests"
echo "✅ Manual tests completed"
# Runs the launcher scripts of the distribution the build produced: the POSIX scripts on
# Ubuntu, the .bat scripts on Windows.
- name: Test the XDK launcher scripts
shell: bash
run: .github/scripts/test-launchers.sh xdk/build/distributions/xdk-*.zip
# The main build ran the IntelliJ plugin checks (the lang composite attached, the Plugin
# Verifier) and passed; later runs of this pull request on the same inputs skip them.
- name: Record IntelliJ plugin checks pass
if: |
success() &&
github.event_name == 'pull_request' &&
steps.publish-flags.outputs.verify-intellij == 'true'
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/lang-ci-marker
key: lang-intellij-passed-${{ needs.changes.outputs.intellij-fingerprint }}
- name: Skip lang validation
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.validate-lang != 'true'
run: |
echo "⏭️ Skipping lang validation"
echo "Reason: ${{ steps.publish-flags.outputs.validate-lang-reason }}"
- name: Validate lang (tree-sitter grammar, LSP adapters, VS Code extension)
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.validate-lang == 'true'
shell: bash
env:
GRADLE_OPTS: ${{ steps.versions.outputs.gradle-jvm-opts }}
VALIDATE_CORE: ${{ steps.publish-flags.outputs.validate-core }}
VALIDATE_VSCODE: ${{ steps.publish-flags.outputs.validate-vscode }}
VSCODE_MARKETPLACE_PUBLISH: ${{ vars.VSCODE_MARKETPLACE_PUBLISH }}
run: |
GRADLE_OPTIONS="${{ steps.versions.outputs.gradle-options }}"
# Enable the lang composite build only for these lang/LSP-targeted invocations.
# The job-level env keeps lang excluded for the rest of the build to avoid
# paying the IntelliJ-plugin resolution cost on every CI run.
LANG_OPTS="-PincludeBuildLang=true -PincludeBuildAttachLang=true"
# One Gradle invocation for the core and VS Code extension checks that run: each
# separate invocation paid its own configuration pass for the lang composite.
# Gradle stops at the first failing task and names it in the output.
# - core: tree-sitter grammar compiles (tree-sitter generate), parser handles the
# XDK corpus, native libraries build for all platforms (cached by content
# hash); LSP adapter tests with the tree-sitter adapter; DSL tests, which also
# read the XDK corpus
# - VS Code extension: headless integration tests, then bundle and package the VSIX, and,
# only when the repository variable VSCODE_MARKETPLACE_PUBLISH is true, the
# Marketplace pre-release VSIX, whose patch is this workflow's run number
LANG_TASKS=""
if [ "$VALIDATE_CORE" = "true" ]; then
LANG_TASKS="$LANG_TASKS :lang:tree-sitter:validateTreeSitterGrammar :lang:tree-sitter:testTreeSitterParse"
LANG_TASKS="$LANG_TASKS :lang:tree-sitter:buildAllNativeLibrariesOnDemand :lang:lsp-server:test :lang:dsl:test"
fi
if [ "$VALIDATE_VSCODE" = "true" ]; then
# @vscode/test-electron launches a real Electron build inside
# the Linux runner. Without a virtual framebuffer it has no
# display to draw on, so we install xvfb if it is not already
# present. ubuntu-latest images ship with it sometimes but
# not always; the `command -v` guard is cheap either way.
# scripts/run-vscode-tests.cjs auto-detects Linux + no DISPLAY
# + xvfb-run on PATH and wraps the test runner accordingly.
if ! command -v xvfb-run >/dev/null 2>&1; then
echo "📋 Installing xvfb for headless Electron..."
sudo apt-get update -qq
sudo apt-get install -y -qq xvfb
fi
LANG_TASKS="$LANG_TASKS :lang:vscode-extension:testVscodeExtension :lang:vscode-extension:packageExtension"
if [ "$VSCODE_MARKETPLACE_PUBLISH" = "true" ]; then
LANG_TASKS="$LANG_TASKS :lang:vscode-extension:packageMarketplaceExtension -Pvscode.marketplace.build=${{ github.run_number }}"
fi
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🌳 LANG VALIDATION: core $VALIDATE_CORE, VS Code extension $VALIDATE_VSCODE"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
./gradlew $GRADLE_OPTIONS $LANG_OPTS -Plsp.adapter=treesitter $LANG_TASKS
echo ""
if [ "$VALIDATE_CORE" = "true" ]; then
echo "✅ Grammar: VALID"
echo "✅ Corpus parsing: PASSED"
echo "✅ Native libraries: BUILT"
echo "✅ Tree-sitter adapter tests: PASSED"
echo "✅ DSL tests: PASSED"
fi
if [ "$VALIDATE_VSCODE" = "true" ]; then
echo "✅ VS Code extension tests: PASSED"
echo "✅ VS Code extension packaged: $(ls lang/vscode-extension/build/distributions/*.vsix)"
if [ "$VSCODE_MARKETPLACE_PUBLISH" = "true" ]; then
echo "✅ VS Code Marketplace pre-release packaged: $(ls lang/vscode-extension/build/marketplace/*.vsix)"
fi
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🎉 ALL LANG VALIDATION COMPLETE"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
- name: Require compiler-consumer test results
if: |
success() && matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.validate-core == 'true'
shell: bash
run: |
python3 - <<'PYTEST'
from pathlib import Path
from xml.etree import ElementTree
result = ElementTree.parse(Path("lang/lsp-server/build/test-results/test/TEST-org.xvm.lsp.adapter.CompilerConsumerTest.xml")).getroot()
counts = {key: int(result.attrib[key]) for key in ("tests", "failures", "errors", "skipped")}
assert counts["tests"] > 0 and all(counts[key] == 0 for key in ("failures", "errors", "skipped")), counts
print("adapter.CompilerConsumerTest", counts)
PYTEST
# The checks that lang validation ran passed; later runs of this pull request on the
# same inputs skip them.
- name: Record lang core checks pass
if: |
success() &&
github.event_name == 'pull_request' &&
steps.publish-flags.outputs.validate-core == 'true'
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/lang-ci-marker
key: lang-core-passed-${{ needs.changes.outputs.core-fingerprint }}
- name: Record VS Code extension checks pass
if: |
success() &&
github.event_name == 'pull_request' &&
steps.publish-flags.outputs.validate-vscode == 'true'
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/lang-ci-marker
key: lang-vscode-passed-${{ needs.changes.outputs.vscode-fingerprint }}
- name: Upload VS Code extension
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.validate-vscode == 'true'
uses: actions/upload-artifact@v7
with:
name: vscode-extension-${{ env.ARTIFACT_SHA }}
path: lang/vscode-extension/build/distributions/*.vsix
if-no-files-found: error
retention-days: 14
- name: Upload VS Code Marketplace pre-release
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.validate-vscode == 'true' &&
vars.VSCODE_MARKETPLACE_PUBLISH == 'true'
uses: actions/upload-artifact@v7
with:
name: vscode-marketplace-${{ env.ARTIFACT_SHA }}
path: lang/vscode-extension/build/marketplace/*.vsix
if-no-files-found: error
retention-days: 14
- name: Upload Plugin Verifier reports
if: |
always() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.verify-intellij == 'true'
uses: actions/upload-artifact@v7
with:
name: plugin-verifier-reports-${{ env.ARTIFACT_SHA }}
path: lang/intellij-plugin/build/reports/pluginVerifier/
if-no-files-found: ignore
retention-days: 14
# TODO:
# name: XTC App Template Integration Test
# if: success() && matrix.os == 'ubuntu-latest'
# ## 1) Clone out xtc-app-template from github.com/xtclang/xtc-app-template or wherever it is.
# ## 2) Run gradlew publishLocal on the xvm repo we are testing in this commit.yml file.
# ## 3) cd into the xtc-app-template folder and run ./gradlew greet, which should work and not fail
# uses: act
- name: Stage XDK distribution artifact metadata
if: success() && matrix.os == 'ubuntu-latest'
shell: bash
run: |
METADATA_DIR="$PWD/ci-artifacts/metadata"
mkdir -p "$METADATA_DIR"
ZIP_FILE=$(find "$PWD/xdk/build/distributions" -maxdepth 1 -name "xdk-*.zip" | head -1)
if [ -z "$ZIP_FILE" ] || [ ! -f "$ZIP_FILE" ]; then
echo "❌ ERROR: No XDK distribution ZIP found to stage metadata"
exit 1
fi
ZIP_NAME=$(basename "$ZIP_FILE")
ZIP_SHA256=$(shasum -a 256 "$ZIP_FILE" | awk '{print $1}')
cat > "$METADATA_DIR/xdk-dist-artifact.json" <<EOF
{
"commit": "${{ env.ARTIFACT_SHA }}",
"branch": "${{ github.ref_name }}",
"runId": "${{ github.run_id }}",
"workflow": "${{ github.workflow }}",
"xdkVersion": "${{ steps.versions.outputs.xdk-version }}",
"javaVersion": "${{ steps.versions.outputs.java-version }}",
"artifact": "xdk-dist-${{ env.ARTIFACT_SHA }}",
"file": "$ZIP_NAME",
"sha256": "$ZIP_SHA256"
}
EOF
echo "✅ XDK distribution metadata staged for: $ZIP_NAME"
- name: Upload XDK distribution artifact
if: success() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v7
with:
name: xdk-dist-${{ env.ARTIFACT_SHA }}
path: |
xdk/build/distributions/xdk-*.zip
ci-artifacts/metadata/xdk-dist-artifact.json
retention-days: 10
- name: Stage consumer Maven repository artifact
if: success() && matrix.os == 'ubuntu-latest'
shell: bash
run: |
STAGING_DIR="$PWD/ci-artifacts/consumer-maven-repo"
METADATA_DIR="$PWD/ci-artifacts/metadata"
echo "📦 Validating consumer Maven repository produced by the main CI build..."
rm -rf "$METADATA_DIR"
mkdir -p "$METADATA_DIR"
echo "📦 Staging consumer Maven repository artifact..."
if [ ! -d "$STAGING_DIR/org/xtclang" ]; then
echo "❌ ERROR: Expected isolated Maven Local subtree not found: $STAGING_DIR/org/xtclang"
exit 1
fi
cat > "$METADATA_DIR/consumer-artifacts.json" <<EOF
{
"commit": "${{ env.ARTIFACT_SHA }}",
"branch": "${{ github.ref_name }}",
"xdkVersion": "${{ steps.versions.outputs.xdk-version }}",
"javaVersion": "${{ steps.versions.outputs.java-version }}",
"runId": "${{ github.run_id }}",
"artifact": "consumer-maven-repo-${{ env.ARTIFACT_SHA }}",
"mavenRepoLocal": "consumer-maven-repo"
}
EOF
echo "✅ Consumer Maven repository staged at: $STAGING_DIR"
find "$STAGING_DIR" -maxdepth 4 -type f | sed -n '1,80p'
- name: Upload consumer Maven repository artifact
if: success() && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v7
with:
name: consumer-maven-repo-${{ env.ARTIFACT_SHA }}
path: |
ci-artifacts/consumer-maven-repo
ci-artifacts/metadata/consumer-artifacts.json
retention-days: 10
- name: Stage snapshot Maven repository artifact
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
(
(github.ref == 'refs/heads/master' && github.event_name == 'push')
||
(github.event_name == 'workflow_dispatch' &&
(github.event.inputs.publish-snapshots == true || github.event.inputs.publish-snapshots == 'true'))
)
shell: bash
run: |
STAGING_DIR="$PWD/ci-artifacts/snapshot-maven-repo"
METADATA_DIR="$PWD/ci-artifacts/metadata"
echo "📦 Validating snapshot Maven repository produced by the main CI build..."
mkdir -p "$METADATA_DIR"
if [ ! -d "$STAGING_DIR/org/xtclang" ]; then
echo "❌ ERROR: Expected snapshot Maven repository subtree not found: $STAGING_DIR/org/xtclang"
find "$PWD/ci-artifacts" -maxdepth 4 -type f | sed -n '1,120p' || true
exit 1
fi
cat > "$METADATA_DIR/snapshot-publish-artifacts.json" <<EOF
{
"commit": "${{ env.ARTIFACT_SHA }}",
"branch": "${{ github.ref_name }}",
"xdkVersion": "${{ steps.versions.outputs.xdk-version }}",
"javaVersion": "${{ steps.versions.outputs.java-version }}",
"runId": "${{ github.run_id }}",
"artifact": "snapshot-maven-repo-${{ env.ARTIFACT_SHA }}",
"snapshotRepo": "snapshot-maven-repo"
}
EOF
echo "✅ Snapshot Maven repository staged at: $STAGING_DIR"
find "$STAGING_DIR" -maxdepth 4 -type f | sed -n '1,80p'
- name: Upload snapshot Maven repository artifact
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
(
(github.ref == 'refs/heads/master' && github.event_name == 'push')
||
(github.event_name == 'workflow_dispatch' &&
(github.event.inputs.publish-snapshots == true || github.event.inputs.publish-snapshots == 'true'))
)
uses: actions/upload-artifact@v7
with:
name: snapshot-maven-repo-${{ env.ARTIFACT_SHA }}
path: |
ci-artifacts/snapshot-maven-repo
ci-artifacts/metadata/snapshot-publish-artifacts.json
retention-days: 10
- name: Stage release-grade IntelliJ plugin artifact
if: |
success() &&
matrix.os == 'ubuntu-latest' &&
steps.publish-flags.outputs.effective == 'true'
shell: bash
env:
GRADLE_OPTS: ${{ steps.versions.outputs.gradle-jvm-opts }}
run: |
PUBLISH_SUFFIX="${{ steps.intellij-version.outputs.suffix }}"
PUBLISH_VERSION="${{ steps.intellij-version.outputs.publish-version }}"
RELEASE_CHANNEL="${{ steps.intellij-version.outputs.release-channel }}"
STAGING_DIR="$PWD/ci-artifacts/intellij-plugin-dist"
VERIFIER_DIR="$PWD/lang/intellij-plugin/build/reports/pluginVerifier"
rm -rf "$STAGING_DIR"
mkdir -p "$STAGING_DIR"
echo "📦 Staging release-grade IntelliJ plugin artifact from outputs built in the main CI build..."
DIST_DIR="$PWD/lang/intellij-plugin/build/distributions"
ZIP_FILE=$(find "$DIST_DIR" -maxdepth 1 -name "*.zip" | head -1)
if [ -z "$ZIP_FILE" ]; then
echo "❌ ERROR: No IntelliJ plugin ZIP found after build"
ls -la "$DIST_DIR"