GitHub Actions upload CMakeConfigureLog.yaml
When CMake fails on the configure or generate steps in a CI workflow, having CMakeConfigureLog.yaml uploaded a as a file can help debug the issue. Add this step to the GitHub Actions workflow YAML file:
- name: Configure CMake
run: cmake -B build
# other steps ...
- name: upload CMakeConfigureLog.yaml
if: failure() && hashFiles('build/CMakeFiles/CMakeConfigureLog.yaml') != ''
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ env.CC }}-CMakeConfigureLog.yaml
path: build/CMakeFiles/CMakeConfigureLog.yaml
retention-days: 5
The “retention-days” parameter is optional. Ensure the “name” parameter is unique to avoid conflicts with other jobs in the workflow. Here we assume that the OS and C compiler are unique between jobs.