Skip to content

Commit 24953a6

Browse files
authored
👷 Cache cmake for min-req CI (#267)
The CMake min-req CI action takes ages to complete which is really annoying if you have to wait for it to finish in addition to wasting compute ressources. Turns out the vast majority of its time is spent building cmake every time, which is clearly not necessary. This change updates the workflow to cache the built cmake version and restore it if needed cutting ~7.5 minutes of the build.
1 parent 02e94ca commit 24953a6

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

.github/workflows/cmake.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,30 @@ jobs:
7373
cmake --build .
7474
7575
min-req:
76-
runs-on: ubuntu-latest
76+
runs-on: ubuntu-20.04
77+
env:
78+
RUN_ON: ubuntu-20.04
79+
CMAKE_URL: https://cmake.org/files/v3.14/cmake-3.14.7.tar.gz
80+
CMAKE_VERSION: 3.14.7
7781
steps:
7882
- uses: actions/checkout@v2
79-
- name: install cmake
80-
run: |
81-
wget https://cmake.org/files/v3.14/cmake-3.14.7.tar.gz
82-
tar -zxf cmake-3.14.7.tar.gz
83-
cd cmake-3.14.7
83+
- name: Cache CMake
84+
id: cache-cmake
85+
uses: actions/cache@v3
86+
with:
87+
path: cmake-${{ env.CMAKE_VERSION }}
88+
key: ubuntu-20.04-${{ github.job }}-cmake-${{ env.CMAKE_VERSION }}
89+
- name: Build cmake
90+
if: steps.cache-cmake.outputs.cache-hit != 'true'
91+
run: |
92+
wget ${{ env.CMAKE_URL }}
93+
tar -zxf cmake-${{ env.CMAKE_VERSION }}.tar.gz
94+
cd cmake-${{ env.CMAKE_VERSION }}
8495
./bootstrap
8596
make -j $(nproc)
97+
- name: Install cmake
98+
run: |
99+
cd cmake-${{ env.CMAKE_VERSION }}
86100
sudo make install
87101
88102
- uses: ./.github/actions/install/gtest

0 commit comments

Comments
 (0)