name: CI

on:
  create:
    tags:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    name: build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:

    - uses: actions/setup-python@v1
      with:
        python-version: '3.x'

    - uses: actions/checkout@v1
      with:
        submodules: true

    - name: install ninja (ubuntu)
      run: sudo apt-get install ninja-build
      if: matrix.os == 'ubuntu-latest'

    - name: install ninja (macos)
      run: brew install ninja
      if: matrix.os == 'macos-latest'

    - name: mkdir
      run: mkdir -p out

    - name: cmake (ubuntu)
      env:
        CC: gcc-9
        CXX: g++-9
      run: cmake .. -G Ninja
      working-directory: out
      if: matrix.os == 'ubuntu-latest'

    - name: cmake (macos)
      run: cmake .. -G Ninja
      working-directory: out
      if: matrix.os == 'macos-latest'

    - name: cmake (windows)
      run: cmake ..
      working-directory: out
      if: matrix.os == 'windows-latest'

    - name: build
      run: cmake --build out

    - name: unittests
      run: cmake --build out --target test
      if: matrix.os != 'windows-latest'

    - name: unittests (windows)
      run: cmake --build out --target RUN_TESTS
      if: matrix.os == 'windows-latest'

name: CI

on:
  create:
    tags:
  push:
    branches:
      - main
  pull_request:

jobs:
  build:
    name: build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:

    - uses: actions/setup-python@v1
      with:
        python-version: '3.x'

    - uses: actions/checkout@v1
      with:
        submodules: true

    - name: install ninja (ubuntu)
      run: sudo apt-get install ninja-build
      if: matrix.os == 'ubuntu-latest'

    - name: install ninja (macos)
      run: brew install ninja
      if: matrix.os == 'macos-latest'

    - name: mkdir
      run: mkdir -p out

    - name: cmake (ubuntu)
      env:
        CC: gcc-9
        CXX: g++-9
      run: cmake .. -G Ninja
      working-directory: out
      if: matrix.os == 'ubuntu-latest'

    - name: cmake (macos)
      run: cmake .. -G Ninja
      working-directory: out
      if: matrix.os == 'macos-latest'

    - name: cmake (windows)
      run: cmake ..
      working-directory: out
      if: matrix.os == 'windows-latest'

    - name: build
      run: cmake --build out

    - name: unittests
      run: cmake --build out --target test
      if: matrix.os != 'windows-latest'

    - name: unittests (windows)
      run: cmake --build out --target RUN_TESTS
      if: matrix.os == 'windows-latest'

Change GitHub actions to trigger on main branch
Change GitHub actions to trigger on main branch
