"Build Tests" is strictly a superset of "Build". in addition to the library, the former builds the tests also. both these steps share the same set of command line arguments. by removing "Build" step, we don't lose anything regarding the test coverage and information for further investigation if the build fails. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Github PR
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
workflow_dispatch:
|
|
permissions: read-all
|
|
jobs:
|
|
cmake-build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
cxx_standard: [11, 17, 20]
|
|
build: [static, shared]
|
|
generator: ["Default Generator", "MinGW Makefiles"]
|
|
exclude:
|
|
- os: macos-latest
|
|
build: shared
|
|
- os: macos-latest
|
|
generator: "MinGW Makefiles"
|
|
- os: ubuntu-latest
|
|
generator: "MinGW Makefiles"
|
|
env:
|
|
YAML_BUILD_SHARED_LIBS: ${{ matrix.build == 'shared' && 'ON' || 'OFF' }}
|
|
CMAKE_GENERATOR: >-
|
|
${{format(matrix.generator != 'Default Generator' && '-G "{0}"' || '', matrix.generator)}}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Get number of CPU cores
|
|
uses: SimenB/github-actions-cpu-cores@v1
|
|
|
|
- name: Build Tests
|
|
shell: bash
|
|
run: |
|
|
cmake ${{ env.CMAKE_GENERATOR }} -S "${{ github.workspace }}" -B build -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} -DYAML_BUILD_SHARED_LIBS=${{ env.YAML_BUILD_SHARED_LIBS }} -DYAML_CPP_BUILD_TESTS=ON
|
|
cd build && cmake --build . --parallel ${{ steps.cpu-cores.outputs.count }}
|
|
|
|
- name: Run Tests
|
|
shell: bash
|
|
run: |
|
|
cd build && ctest -C Debug --output-on-failure --verbose
|
|
|
|
bazel-build:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
cd "${{ github.workspace }}"
|
|
bazel build :all
|
|
|
|
- name: Test
|
|
shell: bash
|
|
run: |
|
|
cd "${{ github.workspace }}"
|
|
bazel test test
|
|
|