name: Build macOS

on: [ push ]

jobs:
  build_gcc8:
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v2

      - name: cmake
        run: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -S ./source

      - name: build
        run: cmake --build ./

  build_gcc9:
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v2

      - name: cmake
        run: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9 -S ./source

      - name: build
        run: cmake --build ./

  build_clang10:
    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v2

      - name: cmake
        run: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -S ./source

      - name: build
        run: cmake --build ./


name: Build macOS

on: [ push ]

jobs:
  build:
    name: ${{ matrix.compiler_name }}
    runs-on: macos-latest

    strategy:
      matrix:
        compiler_name: [build_gcc8, build_gcc9, build_clang]
        include:
          - compiler_name: build_gcc8
            c_compiler: gcc-8
            cxx_compiler: g++-8

          - compiler_name: build_gcc9
            c_compiler: gcc-9
            cxx_compiler: g++-9

          - compiler_name: build_clang
            c_compiler: clang
            cxx_compiler: clang++

    steps:
      - uses: actions/checkout@v2

      - name: cmake
        run: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -S ./source

      - name: build
        run: cmake --build ./

Use matrix to reduce code duplication in Build macOS
[CI] Use matrix to reduce code duplication in Build macOS
