Skip to content

Commit 3bfad51

Browse files
committed
update
1 parent 25739b5 commit 3bfad51

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

.github/workflows/mpv.yml

+9
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ jobs:
238238
restore-keys: |
239239
clang_root-${{ env.toolchain_version }}
240240
lookup-only: true
241+
- name: Keep llvm cache alive
242+
if: ${{ inputs.compiler =='clang' }}
243+
uses: actions/cache/restore@v3.3.2
244+
with:
245+
path: mpv-winbuild-cmake/clang_root
246+
key: llvm-${{ env.toolchain_version }}
247+
restore-keys: |
248+
llvm-
249+
lookup-only: true
241250
- name: Restore clang sysroot cache
242251
if: ${{ inputs.compiler =='clang' }}
243252
uses: actions/cache/restore@v3.3.2

.github/workflows/toolchain.yml

+17-8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
required: false
3030
default: false
3131
type: boolean
32+
skip_llvm_build:
33+
description: "Skip building llvm if compiler is clang"
34+
required: false
35+
default: false
36+
type: boolean
3237
trigger_build:
3338
description: "Trigger mpv build action after success build"
3439
required: false
@@ -86,7 +91,8 @@ jobs:
8691
build_llvm:
8792
name: Build LLVM
8893
needs: params
89-
if: ${{ inputs.compiler =='clang' }}
94+
if: ${{ inputs.compiler =='clang' && inputs.skip_llvm_build != true }}
95+
continue-on-error: true
9096
runs-on: ubuntu-latest
9197
container:
9298
image: archlinux/archlinux:base-devel
@@ -163,7 +169,7 @@ jobs:
163169
build:
164170
name: Build Toolchain
165171
needs: [params,build_llvm]
166-
if: ${{ (inputs.compiler =='clang' && success() ) || ( inputs.compiler =='gcc' && always() ) }}
172+
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
167173
runs-on: ubuntu-latest
168174
container:
169175
image: archlinux/archlinux:base-devel
@@ -201,7 +207,7 @@ jobs:
201207
mpv-winbuild-cmake/clang_root
202208
key: llvm-${{ needs.params.outputs.cache_suffix }}
203209
restore-keys: |
204-
llvm-${{ needs.params.outputs.cache_suffix }}
210+
llvm-
205211
206212
- name: Build Toolchain
207213
shell: bash
@@ -248,20 +254,20 @@ jobs:
248254
ninja -C $buildroot/build$bit cargo-clean
249255
250256
- name: Save Toolchain Cache
251-
if: ${{ github.event.inputs.no_save_cache != 'true' }}
257+
if: ${{ inputs.no_save_cache != true }}
252258
uses: actions/cache/save@v3.3.2
253259
with:
254260
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
255261
key: toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}-${{ needs.params.outputs.cache_suffix }}
256262

257263
- name: Save clang_root cache
258-
if: ${{ inputs.compiler =='clang' }}
264+
if: ${{ inputs.compiler =='clang' && inputs.no_save_cache != true }}
259265
uses: actions/cache/save@v3.3.2
260266
with:
261267
path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root
262268
key: clang_root-${{ needs.params.outputs.cache_suffix }}
263269
- name: Save Rust Cache
264-
if: ${{ github.event.inputs.no_save_cache != 'true' }}
270+
if: ${{ inputs.no_save_cache != true }}
265271
uses: actions/cache/save@v3.3.2
266272
with:
267273
path: ${{ github.workspace }}/mpv-winbuild-cmake/install_rustup
@@ -281,7 +287,7 @@ jobs:
281287

282288
trigger:
283289
needs: [build,params]
284-
if: ${{ github.event.inputs.trigger_build != 'false' && always() }}
290+
if: ${{ always() && inputs.trigger_build != false && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
285291
runs-on: ubuntu-latest
286292

287293
steps:
@@ -291,7 +297,7 @@ jobs:
291297
retries: 3
292298
script: |
293299
let build_target=new Set();
294-
const release = "${{ github.event.inputs.release }}" == 'true' ? true : false;
300+
const release = ${{ inputs.release }};
295301
const targets = {"build64-v3":"64bit-v3","build64":"64bit","build32":"32bit"}
296302
const repo="${{github.repository}}".split('/')[1];
297303
const cache_suffix="${{ needs.params.outputs.cache_suffix }}";
@@ -309,6 +315,7 @@ jobs:
309315
for(const [key, value] of Object.entries(targets)){
310316
if (i.key.includes(key)) {
311317
build_target.add(value);
318+
core.info(`Found success ${value} build cache: ${i.key}.`)
312319
break;
313320
}
314321
}
@@ -339,4 +346,6 @@ jobs:
339346
}
340347
})
341348
}
349+
} else {
350+
core.setFailed("Don't find any success build cache");
342351
}

build.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,12 @@ build() {
5757

5858
ninja -C $buildroot/build$bit {libzvbi,libopenmpt}-removeprefix || true
5959
ninja -C $buildroot/build$bit download || true
60-
if [[ ! "$(ls -A $buildroot/build$bit/install/bin)" ]]; then
61-
if [ "$compiler" == "gcc" ]; then
62-
ninja -C $buildroot/build$bit gcc
63-
elif [ "$compiler" == "clang" ]; then
64-
ninja -C $buildroot/build$bit llvm && ninja -C $buildroot/build$bit llvm-clang
65-
fi
60+
if [ "$compiler" == "gcc" ] && [ ! "$(ls -A $buildroot/build$bit/install/bin)" ]; then
61+
ninja -C $buildroot/build$bit gcc
62+
elif [ "$compiler" == "clang" ] && [ ! "$(ls -A $clang_root/bin)" ]; then
63+
ninja -C $buildroot/build$bit llvm && ninja -C $buildroot/build$bit llvm-clang
6664
fi
65+
6766
if [[ ! "$(ls -A $buildroot/install_rustup/.cargo/bin)" ]]; then
6867
ninja -C $buildroot/build$bit rustup-fullclean
6968
ninja -C $buildroot/build$bit rustup

0 commit comments

Comments
 (0)