cmake.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: CMake
  2. on: [push, pull_request]
  3. env:
  4. # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  5. BUILD_TYPE: Release
  6. jobs:
  7. build:
  8. if: github.repository_owner == 'raspberrypi'
  9. runs-on: [self-hosted, Linux, X64]
  10. steps:
  11. - name: Clean workspace
  12. run: |
  13. echo "Cleaning up previous run"
  14. rm -rf "${{ github.workspace }}"
  15. mkdir -p "${{ github.workspace }}"
  16. - name: Checkout repo
  17. uses: actions/checkout@v2
  18. - name: Checkout submodules
  19. run: git submodule update --init
  20. - name: Create Build Environment
  21. # Some projects don't allow in-source building, so create a separate build directory
  22. # We'll use this as our working directory for all subsequent commands
  23. run: cmake -E make_directory ${{github.workspace}}/build
  24. - name: Configure CMake
  25. # Use a bash shell so we can use the same syntax for environment variable
  26. # access regardless of the host operating system
  27. shell: bash
  28. working-directory: ${{github.workspace}}/build
  29. # Note the current convention is to use the -S and -B options here to specify source
  30. # and build directories, but this is only available with CMake 3.13 and higher.
  31. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
  32. run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
  33. - name: Get core count
  34. id: core_count
  35. run : cat /proc/cpuinfo | grep processor | wc -l
  36. - name: Build
  37. working-directory: ${{github.workspace}}/build
  38. shell: bash
  39. # Execute the build. You can specify a specific target with "--target <NAME>"
  40. run: cmake --build . --config $BUILD_TYPE --parallel ${{steps.core_count.outputs.output}}