@@ -116,22 +116,37 @@ jobs:
116116 echo "value=$(./facebook-clang-plugins/clang/setup.sh --clang-hash)" >> $GITHUB_OUTPUT
117117
118118 - name : Attempt to get clang from the cache
119- id : cache-clang
120- uses : actions/cache@v5
119+ id : cache-clang-restore
120+ uses : actions/cache/restore@v4
121121 with :
122122 path : facebook-clang-plugins/clang/install
123123 key : clang-${{ runner.os }}-${{ runner.arch }}-${{ steps.clang-hash.outputs.value }}
124124
125125 - name : Record that the clang cache was hit
126- if : steps.cache-clang.outputs.cache-hit == 'true'
126+ if : steps.cache-clang-restore .outputs.cache-hit == 'true'
127127 run : ./facebook-clang-plugins/clang/setup.sh --only-record-install
128128
129129 - name : Build clang on cache misses
130- if : steps.cache-clang.outputs.cache-hit != 'true'
130+ if : steps.cache-clang-restore .outputs.cache-hit != 'true'
131131 run : |
132132 ./facebook-clang-plugins/clang/src/prepare_clang_src.sh
133133 CC=clang CXX=clang++ ./facebook-clang-plugins/clang/setup.sh --ninja --sequential-link
134134
135+ - name : Validate rebuilt clang installation
136+ if : steps.cache-clang-restore.outputs.cache-hit != 'true'
137+ run : |
138+ ./facebook-clang-plugins/clang/setup.sh --only-check-install
139+ ./facebook-clang-plugins/clang/install/bin/clang --version
140+ ./facebook-clang-plugins/clang/install/bin/clang++ --version
141+ ./facebook-clang-plugins/clang/install/bin/llvm-config --version
142+
143+ - name : Save rebuilt clang to the cache
144+ if : steps.cache-clang-restore.outputs.cache-hit != 'true'
145+ uses : actions/cache/save@v4
146+ with :
147+ path : facebook-clang-plugins/clang/install
148+ key : clang-${{ runner.os }}-${{ runner.arch }}-${{ steps.clang-hash.outputs.value }}
149+
135150 - if : runner.os == 'Linux'
136151 run : ./build-infer.sh --yes --user-opam-switch
137152
0 commit comments