|
90 | 90 |
|
91 | 91 | printf 'pv=%s\n' "$PV" | tee -a "$GITHUB_OUTPUT"
|
92 | 92 |
|
| 93 | + # Cache hit here means we can skip most of the rest of this job, since |
| 94 | + # this job is essentially building this cache. |
| 95 | + - name: Use build cache |
| 96 | + id: build-cache |
| 97 | + uses: actions/cache@v3 |
| 98 | + with: |
| 99 | + key: ${{ env.CYGPORT_NAME }}-build-${{ github.sha }} |
| 100 | + path: build-results.tar |
| 101 | + |
93 | 102 | - name: Install Cygwin build requirements
|
| 103 | + if: steps.build-cache.outputs.cache-hit != 'true' |
94 | 104 | uses: cygwin/cygwin-install-action@db475590d56881c6cef7b3f96f6f3dd9532ea1f4
|
95 | 105 | with:
|
96 | 106 | packages: ${{ env.CYGPORT_BUILD_REQUIRES }}
|
@@ -131,64 +141,59 @@ jobs:
|
131 | 141 | path: C:\cygwin\var\log\
|
132 | 142 |
|
133 | 143 | - name: Cygport download
|
| 144 | + if: steps.build-cache.outputs.cache-hit != 'true' |
134 | 145 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
135 | 146 | env:
|
136 | 147 | PATH: C:\cygwin\bin
|
137 | 148 | run: cygport "$CYGPORT_FILE" download
|
138 | 149 |
|
139 | 150 | - name: Cygport prep
|
| 151 | + if: steps.build-cache.outputs.cache-hit != 'true' |
140 | 152 | id: cygport-prep
|
141 | 153 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
142 | 154 | env:
|
143 | 155 | PATH: C:\cygwin\bin
|
144 | 156 | run: cygport "$CYGPORT_FILE" prep
|
145 | 157 |
|
146 | 158 | - name: Cygport compile
|
| 159 | + if: steps.build-cache.outputs.cache-hit != 'true' |
147 | 160 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
148 | 161 | env:
|
149 | 162 | PATH: C:\cygwin\bin
|
150 | 163 | run: cygport "$CYGPORT_FILE" compile
|
151 | 164 |
|
152 | 165 | - name: Cygport test
|
| 166 | + if: steps.build-cache.outputs.cache-hit != 'true' |
153 | 167 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
154 | 168 | env:
|
155 | 169 | PATH: C:\cygwin\bin
|
156 | 170 | run: cygport "$CYGPORT_FILE" test
|
157 | 171 |
|
158 | 172 | - name: Cygport install
|
| 173 | + if: steps.build-cache.outputs.cache-hit != 'true' |
159 | 174 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
160 | 175 | env:
|
161 | 176 | PATH: C:\cygwin\bin
|
162 | 177 | run: cygport "$CYGPORT_FILE" install
|
163 | 178 |
|
164 | 179 | - name: Cygport package
|
| 180 | + if: steps.build-cache.outputs.cache-hit != 'true' |
165 | 181 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
166 | 182 | env:
|
167 | 183 | PATH: C:\cygwin\bin
|
168 | 184 | run: cygport "$CYGPORT_FILE" package
|
169 | 185 |
|
170 | 186 | - name: Tar up build results
|
171 |
| - if: always() |
| 187 | + if: always() && steps.cygport-prep.outcome != 'skipped' |
172 | 188 | shell: C:\cygwin\bin\bash.exe --noprofile --norc -e -o pipefail -o igncr {0}
|
173 | 189 | env:
|
174 | 190 | PATH: C:\cygwin\bin
|
175 | 191 | run: tar -cvf build-results.tar "$CYGPORT_BUILD_DIR"
|
176 | 192 |
|
177 | 193 | - name: Store build results
|
178 |
| - if: always() && steps.cygport-prep.outcome == 'success' |
| 194 | + if: always() && steps.cygport-prep.outcome != 'skipped' |
179 | 195 | uses: actions/upload-artifact@v3
|
180 | 196 | with:
|
181 | 197 | name: build-results
|
182 | 198 | path: build-results.tar
|
183 | 199 | if-no-files-found: error
|
184 |
| - |
185 |
| - # Artifacts are great for letting me download the files, and passing |
186 |
| - # files between jobs in the same action, but not for passing files |
187 |
| - # between actions. Cache the build results so they can be used by a |
188 |
| - # separate release action. |
189 |
| - - name: Cache build results |
190 |
| - if: startsWith(github.ref, 'refs/heads/') |
191 |
| - uses: actions/cache/save@v3 |
192 |
| - with: |
193 |
| - key: ${{ env.CYGPORT_NAME }}-build-${{ github.ref_name }}-${{ github.sha }} |
194 |
| - path: build-results.tar |
|
0 commit comments