-
Notifications
You must be signed in to change notification settings - Fork 16
130 lines (121 loc) · 4.05 KB
/
test-cache.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
name: Test caching
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
defaults:
run:
shell: bash -el {0}
jobs:
test-download1:
name: Test download cache 1/2
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
environment-file: test/environment.yml
cache-downloads-key: download-key-${{ github.sha }}-${{ github.run_attempt }}
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'"
test-download2:
name: Test download cache 2/2
timeout-minutes: 10
needs: test-download1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
environment-file: test/environment.yml
cache-downloads-key: download-key-${{ github.sha }}-${{ github.run_attempt }}
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'"
test-env1:
name: Test env cache 1/2
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
environment-file: test/environment.yml
cache-environment-key: env-key-${{ github.sha }}-${{ github.run_attempt }}
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'"
test-env2:
name: Test env cache 2/2
timeout-minutes: 10
needs: test-env1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
environment-file: test/environment.yml
cache-environment-key: env-key-${{ github.sha }}-${{ github.run_attempt }}
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'"
test-env-then-download1:
name: Test env then download 1/2
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
environment-file: test/environment.yml
cache-environment-key: env-then-download-env-${{ github.sha }}-${{ github.run_attempt }}
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'"
test-env-then-download2:
name: Test env then download 2/2
timeout-minutes: 10
needs: test-env-then-download1
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
# Since the environment is cached, there will be no downloaded packages in $MAMBA_ROOT_PREFIX/pkgs.
# The caching should not fail because of this.
environment-file: test/environment.yml
cache-environment-key: env-then-download-env-${{ github.sha }}-${{ github.run_attempt }}
cache-downloads-key: env-then-download-download-${{ github.sha }}-${{ github.run_attempt }}
- name: test environment name
run: |
python -c "import os; env = os.path.basename(os.environ['CONDA_PREFIX']); assert env == 'env-name'"
test -d $MAMBA_ROOT_PREFIX
! test -d $MAMBA_ROOT_PREFIX/pkgs