build.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. name: Github PR
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. workflow_dispatch:
  8. permissions: read-all
  9. jobs:
  10. cmake-build:
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. os: [ubuntu-latest, windows-latest, macos-latest]
  15. build: [static, shared]
  16. generator: ["Default Generator", "MinGW Makefiles"]
  17. exclude:
  18. - os: macos-latest
  19. build: shared
  20. - os: macos-latest
  21. generator: "MinGW Makefiles"
  22. - os: ubuntu-latest
  23. generator: "MinGW Makefiles"
  24. env:
  25. YAML_BUILD_SHARED_LIBS: ${{ matrix.build == 'shared' && 'ON' || 'OFF' }}
  26. YAML_CPP_BUILD_TESTS: 'ON'
  27. CMAKE_GENERATOR: >-
  28. ${{format(matrix.generator != 'Default Generator' && '-G "{0}"' || '', matrix.generator)}}
  29. runs-on: ${{ matrix.os }}
  30. steps:
  31. - uses: actions/checkout@v2
  32. - name: Get number of CPU cores
  33. uses: SimenB/github-actions-cpu-cores@v1
  34. - name: Build
  35. shell: bash
  36. run: |
  37. cmake ${{ env.CMAKE_GENERATOR }} -S "${{ github.workspace }}" -B build -DYAML_BUILD_SHARED_LIBS=${{ env.YAML_BUILD_SHARED_LIBS }}
  38. cd build && cmake --build . --parallel ${{ steps.cpu-cores.outputs.count }}
  39. - name: Build Tests
  40. shell: bash
  41. run: |
  42. cmake ${{ env.CMAKE_GENERATOR }} -S "${{ github.workspace }}" -B build -DYAML_BUILD_SHARED_LIBS=${{ env.YAML_BUILD_SHARED_LIBS }} -DYAML_CPP_BUILD_TESTS=${{ env.YAML_CPP_BUILD_TESTS }}
  43. cd build && cmake --build . --parallel ${{ steps.cpu-cores.outputs.count }}
  44. - name: Run Tests
  45. shell: bash
  46. run: |
  47. cd build && ctest -C Debug --output-on-failure --verbose
  48. bazel-build:
  49. strategy:
  50. matrix:
  51. os: [ubuntu-latest, windows-latest, macos-latest]
  52. runs-on: ${{ matrix.os }}
  53. steps:
  54. - uses: actions/checkout@v2
  55. - name: Build
  56. shell: bash
  57. run: |
  58. cd "${{ github.workspace }}"
  59. bazel build :all
  60. - name: Test
  61. shell: bash
  62. run: |
  63. cd "${{ github.workspace }}"
  64. bazel test test