@@ -17,7 +17,19 @@ inputs:
1717runs :
1818 using : composite
1919 steps :
20+ # ## Restore cache ###
21+
22+ - name : 💾 Restore build directory cache
23+ uses : actions/cache/restore@v4
24+ id : cache-build-dir
25+ with :
26+ path : " ${{ github.workspace }}/.tmp-botan/custom-build-dir"
27+ key : botan-build-dir-${{ runner.os }}-Botan-${{ inputs.botan-version }}
28+
29+ # ## Init ###
30+
2031 - name : 📥 Checkout Botan repository
32+ if : ${{ steps.cache-build-dir.outputs.cache-hit != 'true' }}
2133 uses : actions/checkout@v5
2234 with :
2335 repository : randombit/botan
@@ -28,12 +40,13 @@ runs:
2840 # of the setup-botan action went from 10-20 minutes to ~1-2 minute at the time
2941 # of writing this comment.
3042 - name : 💾 Cache using ccache/sccache
43+ if : ${{ steps.cache-build-dir.outputs.cache-hit != 'true' }}
3144 uses :
hendrikmuhs/[email protected] 3245 with :
3346 create-symlink : true
3447 # Use sccache on Windows, otherwise use ccache
3548 variant : ${{ runner.os == 'Windows' && 'sccache' || 'ccache' }}
36- key : setup- botan-${{ runner.os }}-Botan-${{ inputs.botan-version }}
49+ key : botan-ccache -${{ runner.os }}-Botan-${{ inputs.botan-version }}
3750 evict-old-files : ' job'
3851 max-size : 50M
3952
@@ -44,23 +57,24 @@ runs:
4457 # 'inputs.run-tests', then the tests are built as well.
4558
4659 - name : " 🛠️ [Unix]: Build Botan"
47- if : ${{ runner.os == 'Linux' || runner.os == 'MacOS' }}
60+ if : ${{ steps.cache-build-dir.outputs.cache-hit != 'true' && ( runner.os == 'Linux' || runner.os == 'MacOS') }}
4861 shell : sh
4962 working-directory : ./tmp-botan
5063 run : |
5164 python3 ./configure.py \
5265 --compiler-cache=ccache \
5366 --build-targets=static,shared,cli${{ inputs.run-tests == 'true' && ',tests' || '' }} \
54- --without-documentation
55- make
67+ --without-documentation \
68+ --with-build-dir=./custom-build-dir
69+ make -f ./custom-build-dir/Makefile
5670
5771 # Note: on Windows we assume the caller of the action is using MSYS2 with the
5872 # MINGW64 environment. We could make the action more general purpose, but then
5973 # we should make a few things configurable, like the shell and install
6074 # directory. For now, assuming MSYS2/MINGW64 is the most straightforward thing
6175 # to do.
6276 - name : " 🛠️ [Windows]: Build Botan"
63- if : ${{ runner.os == 'Windows' }}
77+ if : ${{ steps.cache-build-dir.outputs.cache-hit != 'true' && runner.os == 'Windows' }}
6478 shell : C:/msys64/usr/bin/bash.exe -e '{0}'
6579 working-directory : ./tmp-botan
6680 run : |
6983 --build-targets=static,shared,cli${{ inputs.run-tests == 'true' && ',tests' || '' }} \
7084 --without-documentation \
7185 --prefix="C:\msys64\mingw64"
72- make
86+ make -f ./custom-build-dir/Makefile
87+
88+ # ## Save cache ###
89+
90+ - name : 💾 Save build directory cache
91+ uses : actions/cache/save@v4
92+ if : ${{ !env.ACT && steps.cache-build-dir.outputs.cache-hit != 'true' }}
93+ with :
94+ path : " ${{ github.workspace }}/.tmp-botan/custom-build-dir"
95+ key : ${{ steps.cache-stylish-haskell.outputs.cache-primary-key }}
7396
7497 # ## Run tests ###
7598
78101 shell : sh
79102 working-directory : ./tmp-botan
80103 run : |
81- make check
104+ make -f ./custom-build-dir/Makefile check
82105
83106 # TODO: on Windows, 'make check' will fail to start running the tests because
84107 # of wrong backwards/forward slashes in paths and calling the test executable
97120 shell : C:/msys64/usr/bin/bash.exe -e '{0}'
98121 working-directory : ./tmp-botan
99122 run : |
100- make check
123+ make -f ./custom-build-dir/Makefile check
101124
102125 # ## Install ###
103126 #
@@ -116,7 +139,7 @@ runs:
116139 shell : sh
117140 working-directory : ./tmp-botan
118141 run : |
119- sudo make install
142+ sudo make -f ./custom-build-dir/Makefile install
120143
121144 # check install directories
122145 ls -la /usr/local/bin
@@ -132,7 +155,7 @@ runs:
132155 shell : C:/msys64/usr/bin/bash.exe -e '{0}'
133156 working-directory : ./tmp-botan
134157 run : |
135- make install
158+ make -f ./custom-build-dir/Makefile install
136159
137160 # check install directories
138161 ls -la C:/msys64/mingw64/bin
0 commit comments