-
Notifications
You must be signed in to change notification settings - Fork 10
962 lines (915 loc) · 29.2 KB
/
test.yml
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
jobs:
default:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
cache: [true, false]
runs-on: ${{ matrix.os }}
name: default ${{ matrix.cache == true && 'with' || 'without' }} cache (${{ matrix.os }})
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
# check the action logs to see if the cache was used or not
with:
cache: ${{ matrix.cache }}
- run: |
set -o pipefail
pixi info
test -f .pixi/envs/default/bin/python
./.pixi/envs/default/bin/python --version | grep -q 3.11
shell: bash
if: matrix.os != 'windows-latest'
- run: |
set -o pipefail
pixi info
test -f .pixi/envs/default/python.exe
./.pixi/envs/default/python.exe --version | grep -q 3.11
shell: bash
if: matrix.os == 'windows-latest'
- run: |
pixi run python --version | grep -q 3.11
pixi run test | grep -q "Hello world"
no-run-install:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
run-install: false
cache: false
- run: |
! test -d .pixi
shell: bash
no-pixi-toml:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
with:
run-install: false
- run: |
! test -d .pixi
shell: bash
- run: pixi info
custom-pixi-version:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/old-pixi-lockfiles/* .
- uses: ./
with:
cache: false
pixi-version: v0.1.0
# pixi 0.1.0 doesn't support --locked
locked: false
- run: pixi --version | grep -q "pixi 0.1.0"
old-lockfile:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
locked: [true, false]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/old-pixi-lockfiles/* .
- uses: ./
with:
pixi-version: latest
cache: false
locked: ${{ matrix.locked }}
- if: matrix.os == 'windows-latest'
run: choco install yq
# assert that the lockfile wasn't updated
- run: test "$(yq '.version' pixi.lock)" = 1
install-path:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
with:
run-install: false
- run: test "$(which pixi)" = "$HOME/.pixi/bin/pixi"
shell: bash
global-install:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
with:
run-install: false
- run: pixi global install cowpy
- run: |
pixi global list 2>&1 | grep cowpy
cowpy hello world
test "$(which cowpy)" = "$HOME/.pixi/bin/cowpy"
if: matrix.os != 'windows-latest'
- run: cowpy hello world
if: matrix.os == 'windows-latest'
frozen:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
frozen: true
- run: pixi run python --version | grep -q 3.11
locked:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
locked: true
- run: pixi run python --version | grep -q 3.11
custom-pixi-url:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/old-pixi-lockfiles/* .
- uses: ./
with:
cache: false
pixi-url: https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-unknown-linux-musl
- run: pixi --version | grep -q "pixi 0.14.0"
custom-manifest-path:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
with:
cache: false
manifest-path: test/default/pixi.toml
different-log-level:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
log-level: v
custom-bin-path:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
pixi-bin-path: custom-bin/pixi${{ matrix.os == 'windows-latest' && '.exe' || '' }}
- run: |
test -f custom-bin/pixi${{ matrix.os == 'windows-latest' && '.exe' || '' }}
pixi --help
which pixi | grep -q custom-bin/pixi
# which pixi should be absolute
which pixi | grep -q "^/"
existing-pixi-bin:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ignore-reason: [none, version, version-latest, url, bin-path]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- name: Create pixi directory and add to PATH
run: |
mkdir -p $HOME/custom-existing-pixi
echo $HOME/custom-existing-pixi >> $GITHUB_PATH
if: matrix.os != 'windows-latest'
- name: Create pixi directory and add to PATH (Windows)
run: |
mkdir $env:USERPROFILE\custom-existing-pixi
echo $env:USERPROFILE\custom-existing-pixi >> $env:GITHUB_PATH
shell: pwsh
if: matrix.os == 'windows-latest'
- name: Download pixi binary (Ubuntu)
run: |
set -o pipefail
curl -L --output $HOME/custom-existing-pixi/pixi https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-unknown-linux-musl
chmod +x $HOME/custom-existing-pixi/pixi
if: matrix.os == 'ubuntu-latest'
- name: Download pixi binary (macOS)
run: |
set -o pipefail
curl -L --output $HOME/custom-existing-pixi/pixi https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-apple-darwin
chmod +x $HOME/custom-existing-pixi/pixi
if: matrix.os == 'macos-latest'
- name: Download pixi binary (Windows)
run: |
curl -L --output $HOME/custom-existing-pixi/pixi.exe https://github.com/prefix-dev/pixi/releases/download/v0.14.0/pixi-x86_64-pc-windows-msvc.exe
if: matrix.os == 'windows-latest'
- run: |
echo "Path: $PATH"
shell: bash
- name: Verify pixi version (before setup-pixi)
run: |
pixi --version
pixi --version | grep -q "pixi 0.14.0"
shell: bash
- name: Verify pixi path (before setup-pixi)
run: |
which pixi | grep -q $HOME/custom-existing-pixi/pixi
shell: bash
- name: Run Action (should use preinstalled pixi)
uses: ./
with:
cache: false
if: matrix.ignore-reason == 'none'
- name: Run Action (version-latest should overwrite preinstalled pixi)
uses: ./
with:
cache: false
pixi-version: latest
if: matrix.ignore-reason == 'version-latest'
- name: Run Action (version should overwrite preinstalled pixi)
uses: ./
with:
cache: false
pixi-version: v0.16.0
if: matrix.ignore-reason == 'version'
- name: Run Action (url should overwrite preinstalled pixi)
uses: ./
with:
cache: false
pixi-url: |
${{
matrix.os == 'ubuntu-latest' &&
'https://github.com/prefix-dev/pixi/releases/download/v0.16.0/pixi-x86_64-unknown-linux-musl'
|| matrix.os == 'macos-latest' &&
'https://github.com/prefix-dev/pixi/releases/download/v0.16.0/pixi-x86_64-apple-darwin'
|| 'https://github.com/prefix-dev/pixi/releases/download/v0.16.0/pixi-x86_64-pc-windows-msvc.exe'
}}
if: matrix.ignore-reason == 'url'
- name: Create custom bin directory
run: mkdir custom-bin
shell: bash
if: matrix.ignore-reason == 'bin-path'
- name: Run Action (pixi-bin-path should overwrite preinstalled pixi)
uses: ./
with:
cache: false
# this will implicitly set pixi-version to latest
pixi-bin-path: custom-bin/pixi${{ matrix.os == 'windows-latest' && '.exe' || '' }}
if: matrix.ignore-reason == 'bin-path'
- name: Verify pixi version (after setup-pixi) - still at 0.14.0
run: |
pixi --version
pixi --version | grep -q 0.14.0
shell: bash
if: matrix.ignore-reason == 'none'
- name: Verify pixi version (after setup-pixi) - should be 0.16.0
run: |
pixi --version
pixi --version | grep -q 0.16.0
shell: bash
if: matrix.ignore-reason != 'none' && matrix.ignore-reason != 'bin-path' && matrix.ignore-reason != 'version-latest'
- name: Verify pixi version (after setup-pixi) - should be latest
run: |
pixi --version
pixi --version | grep -vq 0.14.0
pixi --version | grep -vq 0.16.0
shell: bash
if: matrix.ignore-reason == 'bin-path' || matrix.ignore-reason == 'version-latest'
- name: Verify pixi path (after setup-pixi, no ignore reason)
run: |
which pixi | grep -q $HOME/custom-existing-pixi/pixi
shell: bash
if: matrix.ignore-reason == 'none'
- name: Verify pixi path (after setup-pixi, ignore reason)
run: |
which pixi | grep -vq $HOME/custom-existing-pixi/pixi
shell: bash
if: matrix.ignore-reason != 'none'
auth-token:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
auth-host: https://custom-conda-registry.com
auth-token: custom-token
- run: |
cat ~/.rattler/credentials.json
[ $(jq '."*.custom-conda-registry.com".BearerToken' -r ~/.rattler/credentials.json) = "custom-token" ]
# all other platforms have the credentials stored in the keychain
# https://github.com/prefix-dev/pixi/issues/330
if: matrix.os == 'ubuntu-latest'
auth-username-password:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
auth-host: https://custom-conda-registry.com
auth-username: custom-username
auth-password: custom-password
- run: |
cat ~/.rattler/credentials.json
[ $(jq '."*.custom-conda-registry.com".BasicHTTP.username' -r ~/.rattler/credentials.json) = "custom-username" ]
[ $(jq '."*.custom-conda-registry.com".BasicHTTP.password' -r ~/.rattler/credentials.json) = "custom-password" ]
# all other platforms have the credentials stored in the keychain
# https://github.com/prefix-dev/pixi/issues/330
if: matrix.os == 'ubuntu-latest'
auth-conda-token:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
auth-host: https://custom-conda-registry.com
auth-conda-token: custom-conda-token
- run: |
cat ~/.rattler/credentials.json
[ $(jq '."*.custom-conda-registry.com".CondaToken' -r ~/.rattler/credentials.json) = "custom-conda-token" ]
# all other platforms have the credentials stored in the keychain
# https://github.com/prefix-dev/pixi/issues/330
if: matrix.os == 'ubuntu-latest'
auth-token-install:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/auth/* .
- uses: ./
with:
cache: false
auth-host: https://repo.prefix.dev
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- name: Ensure private-package is installed
run: |
test -f .pixi/envs/default/conda-meta/private-package-0.0.1-0.json
pixi-shell:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
cache: false
- run: |
python --version | grep -q "3.11"
shell: pixi run bash -e {0}
- run: |
import sys
print(sys.version)
print("Hello world")
shell: pixi run python {0}
- run: |
python --version | Select-String "3.11"
shell: pixi run pwsh -Command {0}
pixi-shell-exec:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
with:
run-install: false
- run: |
python --version | grep -q "3.11"
shell: pixi exec --spec python=3.11.* -- bash -e {0}
- run: |
import ruamel.yaml
shell: pixi exec --spec python --spec ruamel.yaml -- python {0}
- run: |
python --version | Select-String "3.11"
shell: pixi exec --spec python=3.11.* -- pwsh -Command {0}
post-cleanup-linux:
runs-on: ubuntu-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/.rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/.cache/rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
cache: false
post-cleanup: ${{ matrix.post-cleanup }}
# ~/.rattler is only created if the user has logged in
auth-host: https://custom-conda-registry.com
auth-token: custom-token
post-cleanup-linux-no-login:
runs-on: ubuntu-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
! test -d ~/.rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/.cache/rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
cache: false
post-cleanup: ${{ matrix.post-cleanup }}
post-cleanup-macos:
runs-on: macos-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d ~/Library/Caches/rattler
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
cache: false
post-cleanup: ${{ matrix.post-cleanup }}
post-cleanup-windows:
runs-on: windows-latest
strategy:
matrix:
post-cleanup: ['true', 'false']
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
run: |
set -euxo pipefail
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d .pixi
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -d "$LOCALAPPDATA/rattler"
${{ matrix.post-cleanup == 'true' && '! ' || '' }}test -f ~/.pixi/bin/pixi
- uses: ./
with:
cache: false
post-cleanup: ${{ matrix.post-cleanup }}
no-lockfile:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/no-lockfile/* .
- uses: ./
with:
cache: false
- run: |
set -o pipefail
pixi info
test -f .pixi/envs/default/bin/python
./.pixi/envs/default/bin/python --version | grep -q 3.11
shell: bash
if: matrix.os != 'windows-latest'
- run: |
set -o pipefail
pixi info
test -f .pixi/envs/default/python.exe
./.pixi/envs/default/python.exe --version | grep -q 3.11
shell: bash
if: matrix.os == 'windows-latest'
- run: |
pixi run python --version | grep -q 3.11
pixi run test | grep -q "Hello world"
multiple-environments:
name: multiple-environments (${{ matrix.os }}, cache=${{ matrix.cache }})
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, macos-13]
cache: ['true', 'false']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/multiple-environments/* .
- uses: ./
with:
environments: py311 py312
cache: ${{ matrix.cache }}
- run: |
set -o pipefail
pixi info
test -f .pixi/envs/py311/bin/python
test -f .pixi/envs/py312/bin/python
! test -d .pixi/envs/default
./.pixi/envs/py311/bin/python --version | grep -q 3.11
./.pixi/envs/py312/bin/python --version | grep -q 3.12
shell: bash
if: matrix.os != 'windows-latest'
- run: |
set -o pipefail
pixi info
test -f .pixi/envs/py311/python.exe
test -f .pixi/envs/py312/python.exe
! test -d .pixi/envs/default
./.pixi/envs/py311/python.exe --version | grep -q 3.11
./.pixi/envs/py312/python.exe --version | grep -q 3.12
shell: bash
if: matrix.os == 'windows-latest'
cache-write-true:
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache-write: true
test-cache1:
name: Test cache 1/2
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache: true
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
# check the action logs to see if the cache was written
- run: |
test -f .pixi/envs/default/bin/python
if: matrix.os != 'windows-latest'
- run: |
test -f .pixi/envs/default/python.exe
if: matrix.os == 'windows-latest'
test-cache2:
name: Test cache 2/2
timeout-minutes: 10
needs: test-cache1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache: true
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
# check the action logs to see if the cache was restored
- run: |
test -f .pixi/envs/default/bin/python
if: matrix.os != 'windows-latest'
- run: |
test -f .pixi/envs/default/python.exe
if: matrix.os == 'windows-latest'
test-cache-no-write:
name: Test cache no write
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/default/* .
- uses: ./
with:
cache: true
cache-write: false
cache-key: test-cache-${{ github.sha }}-${{ github.run_attempt }}-
# check the action logs to see if the cache write was skipped
pyproject:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Move pixi files
run: mv test/pyproject-manifest/* .
- uses: ./
- run: test -f .pixi/envs/default/bin/python
- run: pixi run test
custom-pyproject-manifest-path:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./
with:
cache: true
manifest-path: test/pyproject-manifest/pyproject.toml
environment-activation-unix:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
activate-environment: true
- run: which python | grep '.pixi/envs/default/bin/python'
- run: env | grep CONDA_PREFIX
- run: '[[ $PIXI_ENVIRONMENT_NAME = "default" ]]'
environment-activation-windows-bash:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
activate-environment: true
- run: which python | grep '.pixi/envs/default/python'
- run: env | grep CONDA_PREFIX
- run: '[[ $PIXI_ENVIRONMENT_NAME = "default" ]]'
environment-activation-windows-pwsh:
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
activate-environment: true
- run: if (-Not (Get-Command python).Path -like '*\.pixi\envs\default\python') { exit 1 }
- run: if (!$env:CONDA_PREFIX) { exit 1 }
- run: if ($env:PIXI_ENVIRONMENT_NAME -ne "default") { exit 1 }
environment-activation-windows-cmd:
runs-on: windows-latest
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
activate-environment: true
- run: where python | findstr "\.pixi\\envs\\default\\python.exe"
- run: set | findstr CONDA_PREFIX
- run: |
if defined PIXI_ENVIRONMENT_NAME (
if "%PIXI_ENVIRONMENT_NAME%" NEQ "default" (
exit 1
)
)
environment-activation-false:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/default/* .
- uses: ./
with:
activate-environment: false
- run: '[[ $PIXI_ENVIRONMENT_NAME = "" ]]'
environment-activation-explicit-env:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/multiple-environments/* .
- uses: ./
with:
environments: py311
activate-environment: true
- run: which python | grep '.pixi/envs/py311/bin/python'
- run: '[[ $PIXI_ENVIRONMENT_NAME = "py311" ]]'
environment-activation-multiple-env:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Move pixi.toml
run: mv test/multiple-environments/* .
- uses: ./
with:
environments: >-
py311 py312
activate-environment: py311
- run: which python | grep '.pixi/envs/py311/bin/python'
- run: '[[ $PIXI_ENVIRONMENT_NAME = "py311" ]]'
# not properly testable
# https://github.com/actions/runner/issues/2347
# https://github.com/orgs/community/discussions/15452
# test-cache-fail-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# cache: true
# cache-key: test-cache-no-lockfile-${{ github.sha }}-${{ github.run_attempt }}-
# - run: exit 1
# if: success()
# test-incorrect-version:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/default/* .
# - uses: ./
# with:
# pixi-version: 0.1.0
# - run: exit 1
# if: success()
# test-frozen-and-locked:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/default/* .
# - uses: ./
# with:
# pixi-version: v0.5.0
# frozen: true
# locked: true
# - run: exit 1
# if: success()
# test-frozen-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# frozen: true
# - run: exit 1
# if: success()
# test-locked-no-lockfile:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# locked: true
# - run: exit 1
# if: success()
# test-lockfile-not-up-to-date:
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/lockfile-not-up-to-date/* .
# - uses: ./
# # locked: true is implicit
# - run: exit 1
# if: success()
# cache-write-true-no-lockfile:
# timeout-minutes: 10
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
# steps:
# - uses: actions/checkout@v4
# - name: Move pixi files
# run: mv test/no-lockfile/* .
# - uses: ./
# with:
# cache-write: true