Skip to content

Commit 504e723

Browse files
committed
👷 Add build caching
1 parent f5e447f commit 504e723

File tree

1 file changed

+51
-18
lines changed

1 file changed

+51
-18
lines changed

‎.github/workflows/test.yml‎

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,31 @@ jobs:
5050
cmake --build .
5151
echo "EMULATOR=$(realpath ./wdcli)" >> $GITHUB_ENV
5252
53+
- name: Get WABT commit ID
54+
working-directory: lib/wabt
55+
run: echo "WABT_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
56+
57+
- name: Cache wabt
58+
uses: actions/cache@v4
59+
id: cache-wabt
60+
with:
61+
key: ${{ runner.os }}-wabt-${{ env.WABT_VERSION }}
62+
path: lib/wabt/build
63+
restore-keys: |
64+
${{ runner.os }}-wabt-
65+
5366
- name: Build WABT # Build latest version
67+
if: steps.cache-wabt.outputs.cache-hit == false
68+
working-directory: lib/wabt
5469
run: |
55-
git clone --recursive https://github.com/TOPLLab/wabt.git
56-
cd wabt
57-
git checkout develop
58-
git submodule update --init
5970
mkdir build; cd build
6071
cmake ..
6172
cmake --build .
6273
6374
- name: Verify wat2wasm
6475
run: |
65-
echo "WABT=$(readlink -f ./wabt/build)" >> $GITHUB_ENV
66-
./wabt/build/wat2wasm --version
76+
echo "WABT=$(readlink -f ./lib/wabt/build)" >> $GITHUB_ENV
77+
./lib/wabt/build/wat2wasm --version
6778
6879
- run: npm install
6980
working-directory: tests/latch/
@@ -94,20 +105,31 @@ jobs:
94105
cmake --build .
95106
echo "EMULATOR=$(realpath ./wdcli)" >> $GITHUB_ENV
96107
108+
- name: Get WABT commit ID
109+
working-directory: lib/wabt
110+
run: echo "WABT_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
111+
112+
- name: Cache wabt
113+
uses: actions/cache@v4
114+
id: cache-wabt
115+
with:
116+
key: ${{ runner.os }}-wabt-${{ env.WABT_VERSION }}
117+
path: lib/wabt/build
118+
restore-keys: |
119+
${{ runner.os }}-wabt-
120+
97121
- name: Build WABT # Build latest version
122+
if: steps.cache-wabt.outputs.cache-hit == false
123+
working-directory: lib/wabt
98124
run: |
99-
git clone --recursive https://github.com/TOPLLab/wabt.git
100-
cd wabt
101-
git checkout develop
102-
git submodule update --init
103125
mkdir build; cd build
104126
cmake ..
105127
cmake --build .
106128
107129
- name: Verify wat2wasm
108130
run: |
109-
echo "WABT=$(readlink -f ./wabt/build)" >> $GITHUB_ENV
110-
./wabt/build/wat2wasm --version
131+
echo "WABT=$(readlink -f ./lib/wabt/build)" >> $GITHUB_ENV
132+
./lib/wabt/build/wat2wasm --version
111133
112134
- run: npm install
113135
working-directory: tests/latch/
@@ -136,20 +158,31 @@ jobs:
136158
cmake --build .
137159
echo "EMULATOR=$(realpath ./wdcli)" >> $GITHUB_ENV
138160
161+
- name: Get WABT commit ID
162+
working-directory: lib/wabt
163+
run: echo "WABT_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
164+
165+
- name: Cache wabt
166+
uses: actions/cache@v4
167+
id: cache-wabt
168+
with:
169+
key: ${{ runner.os }}-wabt-${{ env.WABT_VERSION }}
170+
path: lib/wabt/build
171+
restore-keys: |
172+
${{ runner.os }}-wabt-
173+
139174
- name: Build WABT # Build latest version
175+
if: steps.cache-wabt.outputs.cache-hit == false
176+
working-directory: lib/wabt
140177
run: |
141-
git clone --recursive https://github.com/TOPLLab/wabt.git
142-
cd wabt
143-
git checkout develop
144-
git submodule update --init
145178
mkdir build; cd build
146179
cmake ..
147180
cmake --build .
148181
149182
- name: Verify wat2wasm
150183
run: |
151-
echo "WABT=$(readlink -f ./wabt/build)" >> $GITHUB_ENV
152-
./wabt/build/wat2wasm --version
184+
echo "WABT=$(readlink -f ./lib/wabt/build)" >> $GITHUB_ENV
185+
./lib/wabt/build/wat2wasm --version
153186
154187
- run: npm install
155188
working-directory: tests/latch/

0 commit comments

Comments
 (0)