|
9 | 9 | #@ return names
|
10 | 10 | #@ end
|
11 | 11 |
|
| 12 | +#@ def cache_prefix(name): |
| 13 | +#@ return "${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-"+name+"-${{ matrix.metadata_store }}-${{ matrix.otp_version }}" |
| 14 | +#@ end |
| 15 | + |
12 | 16 | #@ def test_plugin(name, needs, suites):
|
13 | 17 | test-(@= name @):
|
14 | 18 | name: Test (@= name @)
|
|
24 | 28 | - khepri
|
25 | 29 | timeout-minutes: 180
|
26 | 30 | env:
|
27 |
| - SUCCESS_PATH: /home/runner/test-result-cache/(@= name @)/${{ matrix.metadata_store }}/${{ matrix.otp_version }} |
| 31 | + CACHE_PATH: /home/runner/test-result-cache |
28 | 32 | steps:
|
29 | 33 | #@ if name == "rabbit":
|
30 | 34 | - name: INSTALL DOTNET
|
|
46 | 50 | - name: RESTORE TEST RESULT CACHE
|
47 | 51 | uses: actions/cache/restore@v4
|
48 | 52 | with:
|
49 |
| - path: /home/runner/test-result-cache/ |
50 |
| - key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ github.run_attempt }} |
| 53 | + path: ${{ env.CACHE_PATH }} |
| 54 | + key: (@= cache_prefix(name) @)-${{ github.run_number }}-${{ github.run_attempt }} |
51 | 55 | restore-keys: |
|
52 |
| - ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ steps.previous-attempt-outputs.number }} |
53 |
| - ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}- |
54 |
| - ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)- |
| 56 | + (@= cache_prefix(name) @)-${{ github.run_number }}-${{ steps.previous-attempt-outputs.number }} |
| 57 | + (@= cache_prefix(name) @)-${{ github.run_number }}- |
| 58 | + (@= cache_prefix(name) @)- |
55 | 59 | - name: PRINT CACHED RESULTS
|
56 | 60 | run: |
|
57 | 61 | set -x
|
|
64 | 68 | elixir-version: 1.15
|
65 | 69 | - name: PREPARE
|
66 | 70 | run: |
|
67 |
| - mkdir -p ${{ env.SUCCESS_PATH }} |
| 71 | + mkdir -p ${{ env.CACHE_PATH }} |
68 | 72 | - name: DIALYZE
|
69 | 73 | run: |
|
70 |
| - if [[ -f ${{ env.SUCCESS_PATH }}/dialyze ]]; then |
| 74 | + if [[ -f ${{ env.CACHE_PATH }}/dialyze ]]; then |
71 | 75 | echo "dialyze already passed for this key ${{ needs.xref.outputs.hash }}"
|
72 | 76 | else
|
73 | 77 | make -C deps/(@= name @) \
|
74 | 78 | dialyze \
|
75 | 79 | RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
|
76 |
| - touch ${{ env.SUCCESS_PATH }}/dialyze |
| 80 | + touch ${{ env.CACHE_PATH }}/dialyze |
77 | 81 | fi
|
78 | 82 | continue-on-error: #@ name == "rabbitmq_ct_helpers" or name == "trust_store_http"
|
79 | 83 | - name: EUNIT
|
80 | 84 | run: |
|
81 |
| - if [[ -f ${{ env.SUCCESS_PATH }}/eunit ]]; then |
| 85 | + if [[ -f ${{ env.CACHE_PATH }}/eunit ]]; then |
82 | 86 | echo "eunit already passed for this key ${{ needs.xref.outputs.hash }}"
|
83 | 87 | else
|
84 | 88 | make -C deps/(@= name @) \
|
85 | 89 | eunit \
|
86 | 90 | RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
|
87 |
| - touch ${{ env.SUCCESS_PATH }}/eunit |
| 91 | + touch ${{ env.CACHE_PATH }}/eunit |
88 | 92 | fi
|
89 | 93 | #@ for suite in suites:
|
90 | 94 | - name: CT (@= suite @)
|
|
94 | 98 | #@ end
|
95 | 99 | #@ end
|
96 | 100 | run: |
|
97 |
| - if [[ -f ${{ env.SUCCESS_PATH }}/ct-(@= suite @) ]]; then |
| 101 | + if [[ -f ${{ env.CACHE_PATH }}/ct-(@= suite @) ]]; then |
98 | 102 | echo "ct-(@= suite @) already passed for this key ${{ needs.xref.outputs.hash }}"
|
99 | 103 | else
|
100 | 104 | make -C deps/(@= name @) \
|
101 | 105 | ct-(@= suite @) \
|
102 | 106 | RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
|
103 |
| - touch ${{ env.SUCCESS_PATH }}/ct-(@= suite @) |
| 107 | + touch ${{ env.CACHE_PATH }}/ct-(@= suite @) |
104 | 108 | fi
|
105 | 109 | #@ end
|
106 | 110 | - name: SAVE TEST RESULT CACHE
|
107 | 111 | uses: actions/cache/save@v4
|
108 | 112 | with:
|
109 | 113 | path: /home/runner/test-result-cache/
|
110 |
| - key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ github.run_attempt }} |
| 114 | + key: (@= cache_prefix(name) @)-${{ github.run_number }}-${{ github.run_attempt }} |
111 | 115 | - name: UPLOAD TEST ARTIFACTS
|
112 | 116 | if: always()
|
113 | 117 |
|
|
131 | 135 | - khepri
|
132 | 136 | timeout-minutes: 20
|
133 | 137 | env:
|
134 |
| - SUCCESS_PATH: /home/runner/test-result-cache/rabbitmq_cli/${{ matrix.metadata_store }}/${{ matrix.otp_version }} |
| 138 | + CACHE_PATH: /home/runner/test-result-cache |
135 | 139 | steps:
|
136 | 140 | - name: RESTORE BUILT REPO
|
137 | 141 | uses: actions/cache@v4
|
|
147 | 151 | - name: RESTORE TEST RESULT CACHE
|
148 | 152 | uses: actions/cache/restore@v4
|
149 | 153 | with:
|
150 |
| - path: /home/runner/test-result-cache/ |
151 |
| - key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ github.run_attempt }} |
| 154 | + path: ${{ env.CACHE_PATH }} |
| 155 | + key: (@= cache_prefix('rabbitmq_cli') @)-${{ github.run_number }}-${{ github.run_attempt }} |
152 | 156 | restore-keys: |
|
153 |
| - ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ steps.previous-attempt-outputs.number }} |
154 |
| - ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}- |
155 |
| - ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli- |
| 157 | + (@= cache_prefix('rabbitmq_cli') @)-${{ github.run_number }}-${{ steps.previous-attempt-outputs.number }} |
| 158 | + (@= cache_prefix('rabbitmq_cli') @)-${{ github.run_number }}- |
| 159 | + (@= cache_prefix('rabbitmq_cli') @)- |
156 | 160 | - name: PRINT CACHED RESULTS
|
157 | 161 | run: |
|
158 | 162 | set -x
|
|
165 | 169 | elixir-version: 1.15
|
166 | 170 | - name: PREPARE
|
167 | 171 | run: |
|
168 |
| - mkdir -p ${{ env.SUCCESS_PATH }} |
| 172 | + mkdir -p ${{ env.CACHE_PATH }} |
169 | 173 | - name: TEST
|
170 | 174 | id: test
|
171 | 175 | run: |
|
172 |
| - if [[ -f ${{ env.SUCCESS_PATH }}/checks ]]; then |
| 176 | + if [[ -f ${{ env.CACHE_PATH }}/checks ]]; then |
173 | 177 | echo "checks already passed for this key ${{ needs.xref.outputs.hash }}"
|
174 | 178 | else
|
175 | 179 | make -C deps/rabbitmq_cli \
|
176 | 180 | checks \
|
177 | 181 | RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
|
178 |
| - touch ${{ env.SUCCESS_PATH }}/checks |
| 182 | + touch ${{ env.CACHE_PATH }}/checks |
179 | 183 | fi
|
180 | 184 | - name: SAVE TEST RESULT CACHE
|
181 | 185 | uses: actions/cache/save@v4
|
182 | 186 | with:
|
183 | 187 | path: /home/runner/test-result-cache/
|
184 |
| - key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ github.run_attempt }} |
| 188 | + key: (@= cache_prefix('rabbitmq_cli') @)-${{ github.run_number }}-${{ github.run_attempt }} |
185 | 189 | - name: UPLOAD TEST ARTIFACTS
|
186 | 190 | if: always()
|
187 | 191 |
|
|
0 commit comments