-
Notifications
You must be signed in to change notification settings - Fork 262
1947 lines (1730 loc) · 79 KB
/
Copy pathtest-standalone-install.yml
File metadata and controls
1947 lines (1730 loc) · 79 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: Test Standalone Install Scripts
permissions: {}
on:
workflow_dispatch:
pull_request:
paths:
- 'packages/cli/install.sh'
- 'packages/cli/install.ps1'
- 'packages/cli/install-legacy.sh'
- 'packages/cli/install-legacy.ps1'
- 'packages/tools/src/install-global-cli.ts'
- 'packages/tools/src/local-npm-registry.ts'
- 'crates/vp_installer/**'
- 'crates/vp_trampoline/**'
- 'crates/vp_global_cli/**'
- 'crates/vp_shared/**'
- 'crates/vp_pm_cli/**'
- 'crates/vp_setup/**'
- '.github/workflows/test-standalone-install.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
test-install-sh:
name: Test install.sh (${{ matrix.name }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: Linux x64 glibc
- os: macos-15-intel
name: macOS x64
- os: macos-latest
name: macOS ARM64
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Pin VP_HOME for pre-split published CLI
# This job installs the published CLI, which does not support the split
# layout. Set VP_HOME so the new installer writes a compatible
# single-root tree.
run: echo "VP_HOME=$HOME/.vite-plus" >> $GITHUB_ENV
- name: Check bootstrap handoff
run: bash .github/scripts/test-install-bootstrap.sh
- name: Run install.sh
run: cat packages/cli/install.sh | VP_LEGACY_INSTALLER_URL="file://$PWD/packages/cli/install-legacy.sh" bash
- name: Verify installation
working-directory: ${{ runner.temp }}
run: |
# Source shell config to get PATH updated
if [ -f ~/.zshenv ]; then
# non-interactive shells use zshenv
source ~/.zshenv
elif [ -f ~/.zshrc ]; then
# interactive shells use zshrc
source ~/.zshrc
elif [ -f ~/.bash_profile ]; then
# non-interactive shells use bash_profile
source ~/.bash_profile
elif [ -f ~/.bashrc ]; then
# interactive shells use bashrc
source ~/.bashrc
else
export PATH="$HOME/.vite-plus/bin:$PATH"
fi
echo "PATH: $PATH"
ls -al ~/
vp --version
vp --help
# test create command
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build && vp --version
- name: Set PATH
shell: bash
run: |
echo "$HOME/.vite-plus/bin" >> $GITHUB_PATH
- name: Verify bin setup
run: |
# Verify bin directory was created by vp env --setup
BIN_PATH="$HOME/.vite-plus/bin"
ls -al "$BIN_PATH"
if [ ! -d "$BIN_PATH" ]; then
echo "Error: Bin directory not found: $BIN_PATH"
exit 1
fi
# Verify shim executables exist
for shim in node npm npx; do
if [ ! -f "$BIN_PATH/$shim" ]; then
echo "Error: Shim not found: $BIN_PATH/$shim"
exit 1
fi
echo "Found shim: $BIN_PATH/$shim"
done
# Verify vp env doctor works
vp env doctor
vp env run --node 24 -- node -p "process.versions"
which node
which npm
which npx
which vp
- name: Verify upgrade
run: |
# --check queries npm registry and prints update status
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
# rollback to the previous version (should succeed after a real update)
vp upgrade --rollback
vp --version
test-install-sh-layout:
name: Test install.sh layout (fresh split + grandfather)
runs-on: ubuntu-latest
permissions:
contents: read
env:
VP_LOCAL_BINARY: ${{ github.workspace }}/target/release/vp
VP_SKIP_DEPS_INSTALL: '1'
VP_NODE_MANAGER: 'yes'
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- uses: ./.github/actions/clone
- uses: oxc-project/setup-rust@68c3199c5339f965e6e163924c3c450773eba42b # main (pending v1.0.17 — Swatinem/rust-cache v2.9.1 for node24)
- name: Shell config paths preserve metacharacters
run: |
# Sourced installer functions use these globals and literal
# metacharacters. Keep them unchanged.
# shellcheck disable=SC2016,SC2034
set -euo pipefail
sudo apt-get update
sudo apt-get install --no-install-recommends -y fish zsh
# Load installer helpers without invoking main.
eval "$(sed '/^main "[$]@"$/d' packages/cli/install-legacy.sh)"
TEST_ROOT=$(mktemp -d)
export HOME="$TEST_ROOT/home"
export USERPROFILE='C:/Users/alice'
export XDG_CONFIG_HOME="$TEST_ROOT/shell-config"
mkdir -p "$HOME" "$XDG_CONFIG_HOME"
# Windows layout resolution uses USERPROFILE first. Shell source
# entries can use short paths only for the shell HOME.
is_windows_uname() { return 0; }
unset VP_HOME
use_legacy_layout
test "$CONFIG_DIR" = "$USERPROFILE/.vite-plus"
test "$CONFIG_DIR_REF_POSIX" = "$CONFIG_DIR"
test "$CONFIG_DIR_REF_FISH" = "$CONFIG_DIR"
test "$CONFIG_DIR_REF_NU" = "$CONFIG_DIR"
fake_vp() {
printf 'bin\t%s/bin\n' "$USERPROFILE"
printf 'data\t%s/AppData/Local/vite-plus/data\n' "$USERPROFILE"
printf 'cache\t%s/AppData/Local/vite-plus/cache\n' "$USERPROFILE"
printf 'config\t%s/AppData/Roaming/vite-plus\n' "$USERPROFILE"
printf 'state\t%s/AppData/Local/vite-plus/state\n' "$USERPROFILE"
}
apply_dirs_from_vp fake_vp
test "$CONFIG_DIR_REF_POSIX" = "$CONFIG_DIR"
test "$CONFIG_DIR_REF_FISH" = "$CONFIG_DIR"
test "$CONFIG_DIR_REF_NU" = "$CONFIG_DIR"
export USERPROFILE="$HOME"
SPECIAL=$(printf 'config-$USER-"-\047-`-\134')
CONFIG_DIR="$TEST_ROOT/$SPECIAL"
mkdir -p "$CONFIG_DIR"
set_config_dir_refs "$CONFIG_DIR" "$HOME"
SHELL_CONFIG_SUMMARY=()
SHELL_CONFIG_FAILED_SHELLS=()
SHELL_CONFIG_HAS_UPDATED=false
SHELL_CONFIG_HAS_CONFIGURED=false
SHELL_CONFIG_HAS_FAILURE=false
printf '%s\n' 'export VP_CONFIG_SOURCE_MARKER=bash-zsh' > "$CONFIG_DIR/env"
touch "$HOME/.bashrc"
configure_bash_path
configure_zsh_path
bash --noprofile --norc -c 'source "$HOME/.bashrc"; test "$VP_CONFIG_SOURCE_MARKER" = bash-zsh'
zsh -f -c 'source "$HOME/.zshenv"; test "$VP_CONFIG_SOURCE_MARKER" = bash-zsh'
printf '%s\n' 'set -gx VP_CONFIG_SOURCE_MARKER fish' > "$CONFIG_DIR/env.fish"
configure_fish_path
fish --no-config -c 'source "$XDG_CONFIG_HOME/fish/conf.d/vite-plus.fish"; test "$VP_CONFIG_SOURCE_MARKER" = fish'
NUSHELL_DIR="$TEST_ROOT/nushell"
discover_nushell_vendor_autoload_dir() { printf '%s\n' "$NUSHELL_DIR"; }
configure_nushell_path
python3 - "$NUSHELL_DIR/vite-plus.nu" "$CONFIG_DIR/env.nu" <<'PY'
import json
import pathlib
import sys
line = pathlib.Path(sys.argv[1]).read_text().splitlines()[1]
assert line.startswith('source '), line
assert json.loads(line.removeprefix('source ')) == sys.argv[2], line
PY
- name: Build local vp
run: cargo build --release -p vp_global_cli
- name: Shell installer rejects an unversioned Node sidecar
run: |
set -euo pipefail
eval "$(sed '/^main "[$]@"$/d' packages/cli/install-legacy.sh)"
TEST_ROOT=$(mktemp -d)
TEST_BIN="$TEST_ROOT/bin"
INSTALL_DIR="$TEST_ROOT/data"
mkdir -p "$TEST_BIN"
touch "$TEST_BIN/node.exe" "$TEST_ROOT/vp.exe"
printf '%s\n' "$INSTALL_DIR" > "$TEST_BIN/node.shim"
if is_vite_plus_node_shim "$TEST_BIN" "$TEST_ROOT/vp.exe"; then
echo "install.sh accepted an unversioned node.shim"
exit 1
fi
- name: CI hides shell file warnings
run: |
set -euo pipefail
eval "$(sed '/^main "[$]@"$/d' packages/cli/install-legacy.sh)"
SHELL_CONFIG=$(mktemp)
chmod 444 "$SHELL_CONFIG"
CI=true
RESULT=0
OUTPUT=$(append_source_to_file "$SHELL_CONFIG" '. "$HOME/.vite-plus/env"' 2>&1) || RESULT=$?
test "$RESULT" -eq 3
test -z "$OUTPUT"
VP_LOG=trace
RESULT=0
OUTPUT=$(append_source_to_file "$SHELL_CONFIG" '. "$HOME/.vite-plus/env"' 2>&1) || RESULT=$?
test "$RESULT" -eq 3
echo "$OUTPUT" | grep -F "trace"
echo "$OUTPUT" | grep -F "permission denied"
CI=false
unset VP_LOG
RESULT=0
OUTPUT=$(append_source_to_file "$SHELL_CONFIG" '. "$HOME/.vite-plus/env"' 2>&1) || RESULT=$?
test "$RESULT" -eq 3
echo "$OUTPUT" | grep -F "warn"
echo "$OUTPUT" | grep -F "permission denied"
- name: Incomplete directory overrides are rejected
run: |
set -euo pipefail
OUTPUT=$(mktemp)
if (
unset VP_HOME VP_BIN_DIR VP_CACHE_DIR
export VP_DATA_DIR="$RUNNER_TEMP/incomplete-vp-data"
bash packages/cli/install.sh
) >"$OUTPUT" 2>&1; then
cat "$OUTPUT"
echo "install.sh accepted an incomplete directory override group"
exit 1
fi
cat "$OUTPUT"
grep -F "Set VP_BIN_DIR, VP_DATA_DIR, and VP_CACHE_DIR together" "$OUTPUT"
- name: Existing GitHub setup-vp uses legacy layout
run: |
set -euo pipefail
LEGACY=$(mktemp -d)
FAKE_TGZ=$(mktemp)
export HOME="$LEGACY"
export USERPROFILE="$LEGACY"
export GITHUB_ACTION_REPOSITORY=voidzero-dev/setup-vp
unset VP_VPDIRS_AWARE
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-setup-vp-legacy bash packages/cli/install.sh
test -e "$LEGACY/.vite-plus/current"
test -e "$LEGACY/.vite-plus/bin/vp"
test ! -d "$LEGACY/.local/share/vite-plus"
test "$(readlink "$LEGACY/.vite-plus/bin/vp")" = "$LEGACY/.vite-plus/current/bin/vp"
"$LEGACY/.vite-plus/bin/vp" --version
- name: Existing GitLab setup-vp uses legacy layout
run: |
set -euo pipefail
LEGACY=$(mktemp -d)
FAKE_TGZ=$(mktemp)
export HOME="$LEGACY"
export USERPROFILE="$LEGACY"
unset GITHUB_ACTION_REPOSITORY
export GITLAB_CI=true
export SETUP_VP_SETUP_REF=v1.15.0
unset VP_VPDIRS_AWARE
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-setup-vp-gitlab-legacy bash packages/cli/install.sh
test -e "$LEGACY/.vite-plus/current"
test -e "$LEGACY/.vite-plus/bin/vp"
test ! -d "$LEGACY/.local/share/vite-plus"
test "$(readlink "$LEGACY/.vite-plus/bin/vp")" = "$LEGACY/.vite-plus/current/bin/vp"
"$LEGACY/.vite-plus/bin/vp" --version
- name: Fresh home uses split layout
run: |
set -euo pipefail
FRESH="$(mktemp -d)/home with 'quotes' and \$dollar"
mkdir -p "$FRESH"
FAKE_TGZ=$(mktemp)
export HOME="$FRESH"
export USERPROFILE="$FRESH"
export GITHUB_ACTION_REPOSITORY=voidzero-dev/setup-vp
export VP_VPDIRS_AWARE=1
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
# setup-vp sources the installer and reads SHIM_DIR in its own shell.
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test source packages/cli/install.sh
test "$SHIM_DIR" = "$FRESH/.local/share/vite-plus/bin"
test ! -d "$FRESH/.vite-plus"
test -e "$FRESH/.local/share/vite-plus/current"
test -e "$FRESH/.local/share/vite-plus/bin/vp"
test -f "$FRESH/.config/vite-plus/env"
test "$(readlink "$FRESH/.local/share/vite-plus/bin/vp")" = "$FRESH/.local/share/vite-plus/current/bin/vp"
"$FRESH/.local/share/vite-plus/bin/vp" --version
DUMP=$(VP_DUMP_DIRS=1 "$FRESH/.local/share/vite-plus/bin/vp")
dump_dir() { printf '%s\n' "$DUMP" | awk -F'\t' -v key="$1" '$1 == key { print $2; exit }'; }
test "$(dump_dir bin)" = "$FRESH/.local/share/vite-plus/bin"
test "$(dump_dir data)" = "$FRESH/.local/share/vite-plus"
test "$(dump_dir cache)" = "$FRESH/.cache/vite-plus"
test "$(dump_dir config)" = "$FRESH/.config/vite-plus"
test "$(dump_dir state)" = "$FRESH/.local/state/vite-plus"
test "$INSTALL_DIR" = "$(dump_dir data)"
test "$SHIM_DIR" = "$(dump_dir bin)"
test "$CACHE_DIR" = "$(dump_dir cache)"
test "$CONFIG_DIR" = "$(dump_dir config)"
test "$STATE_DIR" = "$(dump_dir state)"
- name: Custom shared bin refreshes Node even in system-first mode
run: |
set -euo pipefail
FOREIGN=$(mktemp -d)
FAKE_TGZ=$(mktemp)
mkdir -p "$FOREIGN/.local/bin" "$FOREIGN/user-bin"
printf '#!/bin/sh\necho foreign-node\n' > "$FOREIGN/.local/bin/node"
chmod +x "$FOREIGN/.local/bin/node"
cp "$FOREIGN/.local/bin/node" "$FOREIGN/user-bin/node"
export HOME="$FOREIGN"
export USERPROFILE="$FOREIGN"
export GITHUB_ACTION_REPOSITORY=voidzero-dev/setup-vp
unset VP_VPDIRS_AWARE
export VP_BIN_DIR="$FOREIGN/.local/bin"
export VP_DATA_DIR="$FOREIGN/.local/share/vite-plus"
export VP_CACHE_DIR="$FOREIGN/.cache/vite-plus"
# Explicitly sharing the Vite+ bin directory accepts replacement there; system-first tools elsewhere stay intact.
export VP_NODE_MANAGER=no
export PATH="$FOREIGN/user-bin:$PATH"
unset VP_HOME
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-foreign-node bash packages/cli/install.sh
test ! -d "$FOREIGN/.vite-plus"
test -f "$FOREIGN/.local/bin/node"
test -L "$FOREIGN/.local/bin/node"
test "$("$FOREIGN/user-bin/node")" = "foreign-node"
- name: Existing ~/.vite-plus is reused
run: |
set -euo pipefail
GRAND=$(mktemp -d)
FAKE_TGZ=$(mktemp)
# A prior install must contain a `current` link. An empty
# ~/.vite-plus directory is not an install.
mkdir -p "$GRAND/.vite-plus/0.0.1/bin"
ln -s 0.0.1 "$GRAND/.vite-plus/current"
echo keep > "$GRAND/.vite-plus/.keep"
export HOME="$GRAND"
export USERPROFILE="$GRAND"
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test bash packages/cli/install.sh
test -f "$GRAND/.vite-plus/.keep"
test -e "$GRAND/.vite-plus/current"
test -e "$GRAND/.vite-plus/bin/vp"
test ! -d "$GRAND/.local/share/vite-plus"
test "$(readlink "$GRAND/.vite-plus/bin/vp")" = "$GRAND/.vite-plus/current/bin/vp"
"$GRAND/.vite-plus/bin/vp" --version
- name: Stray ~/.vite-plus does not capture a split install
run: |
set -euo pipefail
STRAY=$(mktemp -d)
FAKE_TGZ=$(mktemp)
export HOME="$STRAY"
export USERPROFILE="$STRAY"
unset VP_HOME VP_BIN_DIR VP_DATA_DIR VP_CACHE_DIR
unset XDG_DATA_HOME XDG_CACHE_HOME XDG_CONFIG_HOME XDG_STATE_HOME
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test bash packages/cli/install.sh
# A local pre-split Vite+ can create ~/.vite-plus for caches, config,
# and managed runtimes. This tree has no `current` link, so it is not
# an install.
mkdir -p "$STRAY/.vite-plus/cache" "$STRAY/.vite-plus/js_runtime"
echo '{}' > "$STRAY/.vite-plus/config.json"
# Resolution must use the split roots with and without the environment
# script variables.
data_root() { VP_DUMP_DIRS=1 "$STRAY/.local/share/vite-plus/bin/vp" | awk -F'\t' '$1=="data"{print $2}'; }
test "$(data_root)" = "$STRAY/.local/share/vite-plus"
test "$(VP_DATA_DIR="$STRAY/.local/share/vite-plus" VP_BIN_DIR="$STRAY/.local/bin" VP_CACHE_DIR="$STRAY/.cache/vite-plus" data_root)" = "$STRAY/.local/share/vite-plus"
# A reinstall must continue to use the split roots. It must not change
# the stray tree. `vp upgrade` uses the same resolution chain.
VP_LOCAL_TGZ="$FAKE_TGZ" VP_VERSION=local-test2 bash packages/cli/install.sh
test -x "$STRAY/.local/share/vite-plus/local-test2/bin/vp"
test "$(readlink "$STRAY/.local/share/vite-plus/current")" = "local-test2"
test ! -e "$STRAY/.vite-plus/current"
test ! -e "$STRAY/.vite-plus/bin"
"$STRAY/.local/share/vite-plus/bin/vp" --version
test-install-sh-old-version:
name: Test install.sh pre-split release (${{ matrix.name }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
env:
VP_VERSION: '0.2.9'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: Linux x64 glibc
- os: macos-latest
name: macOS ARM64
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Run install.sh for a pre-split release
# Do not set VP_HOME. A pre-VpDirs release must select the monolithic
# ~/.vite-plus root.
run: |
cat packages/cli/install.sh | VP_LEGACY_INSTALLER_URL="file://$PWD/packages/cli/install-legacy.sh" bash 2>&1 | tee install-output.txt
grep -F "does not support the split directory layout" install-output.txt
- name: Verify monolithic layout
run: |
test -x "$HOME/.vite-plus/$VP_VERSION/bin/vp"
test -e "$HOME/.vite-plus/current"
test -f "$HOME/.vite-plus/env"
# No split-layout leftovers.
test ! -d "$HOME/.local/share/vite-plus"
test ! -d "$HOME/.config/vite-plus"
test ! -e "$HOME/.local/bin/vp"
ls -al "$HOME/.vite-plus/bin"
for shim in vp vpr vpx node npm npx corepack; do
test -e "$HOME/.vite-plus/bin/$shim"
done
- name: Verify PATH-resolved commands work
run: |
export PATH="$HOME/.vite-plus/bin:$PATH"
command -v vp | grep -F "$HOME/.vite-plus/bin/vp"
vp --version
node --version
npm --version
vp env doctor
test-install-ps1-old-version:
name: Test install.ps1 pre-split release (Windows x64)
# On a GitHub-hosted runner, %USERPROFILE% matches the operating-system
# profile. The old resolver and `vp env doctor` must report the install path.
runs-on: windows-latest
permissions:
contents: read
env:
VP_VERSION: '0.2.9'
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Run install.ps1 for a pre-split release
# Do not set VP_HOME. A pre-VpDirs release must select the monolithic
# %USERPROFILE%\.vite-plus root.
shell: pwsh
run: |
# *>&1 adds the Write-Host information stream to the pipeline.
# Tee-Object can then record installer notices.
& ./packages/cli/install.ps1 *>&1 | Tee-Object -FilePath install-output.txt
if (-not (Select-String -Path install-output.txt -Pattern "does not support the split directory layout" -SimpleMatch -Quiet)) {
Write-Error "Expected the pre-split fallback notice in installer output"
exit 1
}
if (-not (Select-String -Path install-output.txt -Pattern "Install locations:" -SimpleMatch -Quiet)) {
Write-Error "Expected install locations in installer output"
exit 1
}
if (-not (Select-String -Path install-output.txt -Pattern "Data directory: ~\.vite-plus" -SimpleMatch -Quiet)) {
Write-Error "Expected the single-root data directory in installer output"
exit 1
}
if (-not (Select-String -Path install-output.txt -Pattern "Bin directory: ~\.vite-plus\bin" -SimpleMatch -Quiet)) {
Write-Error "Expected the single-root bin directory in installer output"
exit 1
}
- name: Verify monolithic layout
shell: pwsh
run: |
$root = Join-Path $env:USERPROFILE ".vite-plus"
if (-not (Test-Path "$root\$env:VP_VERSION\bin\vp.exe")) { Write-Error "payload missing"; exit 1 }
if (-not (Test-Path "$root\current")) { Write-Error "current link missing"; exit 1 }
# No split-layout leftovers.
foreach ($split in @((Join-Path $env:LOCALAPPDATA "vite-plus"), (Join-Path $env:APPDATA "vite-plus"))) {
if (Test-Path $split) { Write-Error "unexpected split dir: $split"; exit 1 }
}
Get-ChildItem -Force "$root\bin"
foreach ($shim in @("vp.exe", "vpr.exe", "vpx.exe", "node.exe", "npm.exe", "npx.exe")) {
if (-not (Test-Path "$root\bin\$shim")) { Write-Error "shim missing: $shim"; exit 1 }
}
- name: Verify PATH-resolved commands work
shell: pwsh
run: |
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
where.exe vp
vp --version
node --version
npm --version
vp env doctor
test-install-sh-readonly-config:
name: Test install.sh (readonly shell config)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Pin VP_HOME for pre-split published CLI
run: echo "VP_HOME=$HOME/.vite-plus" >> $GITHUB_ENV
- name: Make shell config files read-only
run: |
# Simulate Nix-managed or read-only shell configs
touch ~/.bashrc ~/.bash_profile ~/.profile
chmod 444 ~/.bashrc ~/.bash_profile ~/.profile
- name: Run install.sh
run: |
output=$(cat packages/cli/install.sh | VP_LEGACY_INSTALLER_URL="file://$PWD/packages/cli/install-legacy.sh" bash 2>&1) || {
echo "$output"
echo "Install script exited with non-zero status"
exit 1
}
echo "$output"
# Verify installation succeeds (not a fatal error)
echo "$output" | grep -q "successfully installed"
# Verify the success message shows the single-root locations
echo "$output" | grep -q "Install locations:"
echo "$output" | grep -q "Data directory: ~/.vite-plus"
echo "$output" | grep -q "Bin directory: ~/.vite-plus/bin"
# CI gets PATH from the runner environment.
# VP_LOG=trace shows shell file errors.
# Normal output does not show these errors.
if echo "$output" | grep -Eqi "permission denied|Shell configuration:|Some shells still need manual setup"; then
echo "Installer printed shell configuration details in CI"
exit 1
fi
- name: Verify vp works via direct path
run: |
~/.vite-plus/bin/vp --version
test-install-sh-arm64:
name: Test install.sh (Linux ARM64 glibc via QEMU)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Set up QEMU
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4.3.0
with:
platforms: arm64
- name: Run install.sh in ARM64 container
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
ubuntu:20.04 bash -c "
ls -al ~/
apt-get update && apt-get install -y curl ca-certificates
export VP_HOME=\"\$HOME/.vite-plus\"
cat /workspace/packages/cli/install.sh | VP_LEGACY_INSTALLER_URL=file:///workspace/packages/cli/install-legacy.sh bash
if [ -f ~/.profile ]; then
source ~/.profile
elif [ -f ~/.bashrc ]; then
source ~/.bashrc
else
export PATH="$HOME/.vite-plus/bin:$PATH"
fi
vp --version
vp --help
vp dlx print-current-version
# Verify bin setup
BIN_PATH=\"\$HOME/.vite-plus/bin\"
if [ ! -d \"\$BIN_PATH\" ]; then
echo \"Error: Bin directory not found: \$BIN_PATH\"
exit 1
fi
for shim in node npm npx; do
if [ ! -f \"\$BIN_PATH/\$shim\" ]; then
echo \"Error: Shim not found: \$BIN_PATH/\$shim\"
exit 1
fi
echo \"Found shim: \$BIN_PATH/\$shim\"
done
vp env doctor
export VP_LOG=trace
vp env run --node 24 -- node -p \"process.versions\"
# Verify upgrade
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
# FIXME: qemu: uncaught target signal 11 (Segmentation fault) - core dumped
# vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
# cd hello && vp run build
"
test-install-sh-musl-x64:
name: Test install.sh (Linux x64 musl)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Run install.sh in Alpine container
run: |
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-e CI=true \
alpine:3.21 sh -c "
# libstdc++: required by unofficial-builds Node.js musl binary
apk add --no-cache bash curl ca-certificates libstdc++
export VP_HOME=\"\$HOME/.vite-plus\"
cat /workspace/packages/cli/install.sh | VP_LEGACY_INSTALLER_URL=file:///workspace/packages/cli/install-legacy.sh bash
export PATH=\"\$HOME/.vite-plus/bin:\$PATH\"
vp --version
vp --help
vp dlx print-current-version
# Verify bin setup
BIN_PATH=\"\$HOME/.vite-plus/bin\"
if [ ! -d \"\$BIN_PATH\" ]; then
echo \"Error: Bin directory not found: \$BIN_PATH\"
exit 1
fi
for shim in node npm npx; do
if [ ! -f \"\$BIN_PATH/\$shim\" ]; then
echo \"Error: Shim not found: \$BIN_PATH/\$shim\"
exit 1
fi
echo \"Found shim: \$BIN_PATH/\$shim\"
done
vp env doctor
vp env run --node 24 -- node -p \"process.versions\"
# Test create command
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello && vp run build && vp --version
cd ..
# Verify upgrade
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
"
test-install-sh-musl-arm64:
name: Test install.sh (Linux ARM64 musl via QEMU)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Set up QEMU
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4.3.0
with:
platforms: arm64
- name: Run install.sh in ARM64 Alpine container
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
-e CI=true \
alpine:3.21 sh -c "
# libstdc++ is needed by unofficial-builds Node.js musl binary
apk add --no-cache bash curl ca-certificates libstdc++
export VP_HOME=\"\$HOME/.vite-plus\"
cat /workspace/packages/cli/install.sh | VP_LEGACY_INSTALLER_URL=file:///workspace/packages/cli/install-legacy.sh bash
export PATH=\"\$HOME/.vite-plus/bin:\$PATH\"
vp --version
vp --help
vp dlx print-current-version
# Verify bin setup
BIN_PATH=\"\$HOME/.vite-plus/bin\"
if [ ! -d \"\$BIN_PATH\" ]; then
echo \"Error: Bin directory not found: \$BIN_PATH\"
exit 1
fi
for shim in node npm npx; do
if [ ! -f \"\$BIN_PATH/\$shim\" ]; then
echo \"Error: Shim not found: \$BIN_PATH/\$shim\"
exit 1
fi
echo \"Found shim: \$BIN_PATH/\$shim\"
done
vp env doctor
export VP_LOG=trace
vp env run --node 24 -- node -p \"process.versions\"
# FIXME: QEMU doesn't support all syscalls needed by rolldown/tsdown
# vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
# cd hello && vp run build && vp --version
# Verify upgrade
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
"
test-install-ps1-v5:
name: Test install.ps1 (Windows x64, PowerShell 5.1)
runs-on: namespace-profile-windows-4c-8g
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Pin VP_HOME to USERPROFILE
# Namespace's Windows runners run jobs under a service account whose real
# profile (C:\Windows\system32\config\systemprofile) differs from
# %USERPROFILE%; vp resolves its home from the OS profile. Pin VP_HOME so
# the install, generated shims, and these assertions share one location.
shell: bash
run: echo "VP_HOME=$USERPROFILE\.vite-plus" >> $GITHUB_ENV
- name: Assert PowerShell 5.x
shell: powershell
run: |
Write-Host "PowerShell version: $($PSVersionTable.PSVersion)"
if ($PSVersionTable.PSVersion.Major -ne 5) {
Write-Error "Expected PowerShell 5.x but got $($PSVersionTable.PSVersion)"
exit 1
}
- name: Check bootstrap handoff
shell: powershell
run: ./.github/scripts/test-install-bootstrap.ps1
- name: Run install.ps1
shell: powershell
run: |
& ./packages/cli/install.ps1
- name: Run install.ps1 via irm simulation (catches BOM issues)
shell: powershell
# Piped installers cannot locate a sibling script; use this PR's legacy implementation.
env:
VP_LEGACY_INSTALLER_URL: https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}/packages/cli/install-legacy.ps1
run: |
$ErrorActionPreference = "Stop"
Get-Content ./packages/cli/install.ps1 -Raw | Invoke-Expression
- name: Set PATH
shell: bash
run: |
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
- name: Verify installation
shell: powershell
working-directory: ${{ runner.temp }}
run: |
Write-Host "PATH: $env:Path"
vp --version
vp --help
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello
vp run build
vp --version
- name: Verify bin setup
shell: powershell
run: |
$binPath = "$env:USERPROFILE\.vite-plus\bin"
Get-ChildItem -Force $binPath
if (-not (Test-Path $binPath)) {
Write-Error "Bin directory not found: $binPath"
exit 1
}
$expectedShims = @("node.exe", "npm.exe", "npx.exe")
foreach ($shim in $expectedShims) {
$shimFile = Join-Path $binPath $shim
if (-not (Test-Path $shimFile)) {
Write-Error "Shim not found: $shimFile"
exit 1
}
Write-Host "Found shim: $shimFile"
}
where.exe node
where.exe npm
where.exe npx
where.exe vp
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
vp env doctor
vp env run --node 24 -- node -p "process.versions"
- name: Verify upgrade
shell: powershell
run: |
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
test-install-ps1-arm64:
name: Test install.ps1 (Windows ARM64)
runs-on: windows-11-arm
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Pin VP_HOME for pre-split published CLI
shell: bash
run: echo "VP_HOME=$USERPROFILE\.vite-plus" >> $GITHUB_ENV
- name: Run install.ps1
shell: pwsh
run: |
& ./packages/cli/install.ps1
- name: Set PATH
shell: bash
run: |
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
- name: Verify installation
shell: pwsh
working-directory: ${{ runner.temp }}
run: |
Write-Host "PATH: $env:Path"
vp --version
vp --help
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello
vp run build
vp --version
- name: Verify bin setup
shell: pwsh
run: |
$binPath = "$env:USERPROFILE\.vite-plus\bin"
Get-ChildItem -Force $binPath
if (-not (Test-Path $binPath)) {
Write-Error "Bin directory not found: $binPath"
exit 1
}
$expectedShims = @("node.exe", "npm.exe", "npx.exe")
foreach ($shim in $expectedShims) {
$shimFile = Join-Path $binPath $shim
if (-not (Test-Path $shimFile)) {
Write-Error "Shim not found: $shimFile"
exit 1
}
Write-Host "Found shim: $shimFile"
}
where.exe node
where.exe npm
where.exe npx
where.exe vp
$env:Path = "$env:USERPROFILE\.vite-plus\bin;$env:Path"
vp env doctor
vp env run --node 24 -- node -p "process.versions"
- name: Verify upgrade
shell: pwsh
run: |
vp upgrade --check
vp upgrade 0.1.14-alpha.1
vp --version
vp upgrade --rollback
vp --version
test-install-ps1-v76:
name: Test install.ps1 (Windows x64, PowerShell 7.6)
runs-on: namespace-profile-windows-4c-8g
permissions:
contents: read
steps:
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
- name: Pin VP_HOME to USERPROFILE
# Namespace's Windows runners run jobs under a service account whose real
# profile (C:\Windows\system32\config\systemprofile) differs from
# %USERPROFILE%; vp resolves its home from the OS profile. Pin VP_HOME so
# the install, generated shims, and these assertions share one location.
shell: bash
run: echo "VP_HOME=$USERPROFILE\.vite-plus" >> $GITHUB_ENV
- name: Install PowerShell 7.6
shell: pwsh
run: |
# --tool-path (not --global): a global tool install resolves the target
# under the OS user profile, which is the service-account systemprofile
# on Namespace, not %USERPROFILE%. An explicit path is account-independent.
dotnet tool install --tool-path "$env:USERPROFILE\.dotnet\tools" PowerShell --version 7.6.0
$pwsh76 = "$env:USERPROFILE\.dotnet\tools\pwsh.exe"
echo "PWSH76=$pwsh76" >> $env:GITHUB_ENV
$ver = & $pwsh76 -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
Write-Host "PowerShell version: $ver"
if (-not $ver.StartsWith("7.6")) {
Write-Error "Expected PowerShell 7.6.x but got $ver"
exit 1
}
- name: Run install.ps1 via iex under PowerShell 7.6
shell: pwsh
# Piped installers cannot locate a sibling script; use this PR's legacy implementation.
env:
VP_LEGACY_INSTALLER_URL: https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}/packages/cli/install-legacy.ps1
run: |
& $env:PWSH76 -NoProfile -Command "Get-Content ./packages/cli/install.ps1 -Raw | Invoke-Expression"
- name: Set PATH
shell: bash
run: |
echo "$USERPROFILE\.vite-plus\bin" >> $GITHUB_PATH
- name: Verify installation
shell: pwsh
working-directory: ${{ runner.temp }}
run: |
Write-Host "PATH: $env:Path"
vp --version
vp --help
vp create vite --no-interactive --no-agent -- hello --no-interactive -t vanilla
cd hello
vp run build
vp --version