name: CI on: push: branches: - main pull_request: branches: - main jobs: ci: name: ${{ matrix.os }}-${{ matrix.compiler }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest compiler: gcc - os: ubuntu-latest compiler: clang - os: windows-latest compiler: cl - os: windows-latest compiler: clang-cl - os: windows-latest compiler: clang - os: windows-latest compiler: gcc - os: macos-latest compiler: gcc - os: macos-latest compiler: clang steps: - uses: actions/checkout@v1 - name: Install (Ubuntu) if: runner.os == 'Linux' run: | sudo apt-get install -y --no-install-recommends ninja-build clang-tidy if [ "${{ matrix.compiler }}" = "gcc" ]; then echo CC=gcc >> $GITHUB_ENV echo CXX=g++ >> $GITHUB_ENV else echo CC=clang >> $GITHUB_ENV echo CXX=clang++ >> $GITHUB_ENV fi - name: Install (macOS) if: runner.os == 'macOS' run: | brew install ninja sudo ln -s /usr/local/opt/llvm/bin/clang-tidy /usr/local/bin/clang-tidy if [ "${{ matrix.compiler }}" = "gcc" ]; then echo CC=gcc >> $GITHUB_ENV echo CXX=g++ >> $GITHUB_ENV else echo CC=clang >> $GITHUB_ENV echo CXX=clang++ >> $GITHUB_ENV fi - name: Install (Windows) if: runner.os == 'Windows' run: | Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') scoop install ninja llvm --global if ("${{ matrix.compiler }}" -eq "gcc") { echo CC=gcc | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 echo CXX=g++ | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 } elseif ("${{ matrix.compiler }}" -eq "clang") { echo CC=clang | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 echo CXX=clang++ | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 } else { echo CC=${{ matrix.compiler }} | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 echo CXX=${{ matrix.compiler }} | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 } # We add the output directories to the PATH to make sure the tests and # examples can find the reproc and reproc++ DLL's. $env:PATH += ";$pwd\build\reproc\lib" $env:PATH += ";$pwd\build\reproc++\lib" # Make all PATH additions made by scoop and ourselves global. echo "PATH=$env:PATH" | Add-Content -Path $env:GITHUB_ENV -Encoding utf8 if ("${{ matrix.compiler }}".endswith("cl")) { & .github\workflows\vsenv.ps1 -arch x64 -hostArch x64 } # We build reproc as a shared library to verify all the necessary symbols # are exported. # YAML folded multiline strings ('>') require the same indentation for all # lines in order to turn newlines into spaces. - name: Configure run: > cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DREPROC++=ON -DREPROC_TEST=ON -DREPROC_EXAMPLES=ON -DREPROC_WARNINGS=ON -DREPROC_WARNINGS_AS_ERRORS=ON -DREPROC_TIDY=ON -DREPROC_SANITIZERS=ON - name: Build run: cmake --build build - name: Test run: cmake --build build --target test env: CTEST_OUTPUT_ON_FAILURE: ON