Skip to content

Commit 740deba

Browse files
committed
test cache
1 parent 5eee543 commit 740deba

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,37 @@ on:
1616
required: true
1717

1818
jobs:
19+
cache:
20+
outputs:
21+
cache-key: ${{steps.setup.outputs.cache-key}}
22+
runs-on: windows-2022
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
ref: ${{env.TAG_NAME}}
27+
28+
- name: Setup Env
29+
shell: bash
30+
id: setup
31+
run: |
32+
echo "installationPath=$(vswhere -all -legacy -property installationPath)">>$GITHUB_OUTPUT
33+
KEY=$(git ls-tree -r ${{env.TAG_NAME}}|grep ^160000|sort -d|md5sum|cut -d' ' -f1)
34+
echo "cache-key=$KEY" >>$GITHUB_OUTPUT
35+
36+
- name: Restore cached submodules
37+
id: cache-submodules-restore
38+
uses: actions/cache@v4
39+
with:
40+
path: .git/modules
41+
key: ${{ runner.os }}-${{steps.setup.outputs.cache-key}}-submodules
42+
43+
- name: Pull submodules
44+
shell: bash
45+
run: |
46+
git submodule update --init --recursive --depth 1
47+
1948
build:
49+
needs: cache
2050
strategy:
2151
matrix:
2252
arch: [x86, amd64, arm, arm64]
@@ -39,15 +69,16 @@ jobs:
3969
id: setup
4070
run: |
4171
echo "installationPath=$(vswhere -all -legacy -property installationPath)">>$GITHUB_OUTPUT
42-
KEY=$(git ls-tree -r ${{env.TAG_NAME}}|grep ^160000|sort -d|md5sum|cut -d' ' -f1)
43-
echo "cache-key=$KEY" >>$GITHUB_OUTPUT
72+
# KEY=$(git ls-tree -r ${{env.TAG_NAME}}|grep ^160000|sort -d|md5sum|cut -d' ' -f1)
73+
# echo "cache-key=$KEY" >>$GITHUB_OUTPUT
4474
4575
- name: Restore cached submodules
4676
id: cache-submodules-restore
4777
uses: actions/cache@v4
4878
with:
4979
path: .git/modules
50-
key: ${{ runner.os }}-${{steps.setup.outputs.cache-key}}-submodules
80+
# key: ${{ runner.os }}-${{steps.setup.outputs.cache-key}}-submodules
81+
key: ${{ needs.cache.outputs.cache-key }}
5182

5283
- name: Pull submodules
5384
shell: bash

0 commit comments

Comments
 (0)