Added solution for determining the parity of a binary integral value. #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CMake | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| env: | |
| # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
| BUILD_TYPE: RelWithDebInfo | |
| # Conan cache environment variables | |
| CONAN_SYSREQUIRES_MODE: enabled | |
| CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" | |
| CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" | |
| # Use a bash shell so we can use the same syntax for environment variable | |
| # access regardless of the host operating system | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: ['ubuntu-latest', 'windows-latest', 'macos-latest'] | |
| include: | |
| - os: ubuntu-latest | |
| ENABLE_COVERAGE: ON | |
| - os: windows-latest | |
| # Windows works differently | |
| ENABLE_COVERAGE: OFF | |
| - os: macos-latest | |
| ENABLE_COVERAGE: ON | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Cache | |
| uses: actions/cache@v2 | |
| env: | |
| cache-name: cache-conan-modules | |
| with: | |
| path: | | |
| ${{ env.CONAN_USER_HOME }} | |
| ~/.cache/pip | |
| key: ${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('CMakeLists.txt') }}-${{ hashFiles('cmake/Conan.cmake') }} | |
| - name: Install conan | |
| run: | | |
| pip3 install wheel setuptools gcovr | |
| pip3 install conan --upgrade | |
| - name: Install / Configure dependencies | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Linux" ]; then | |
| echo "Ubuntu - Fix Conan Path" | |
| sudo update-alternatives --install /usr/bin/conan conan /home/runner/.local/bin/conan 10 | |
| sudo update-alternatives --config conan | |
| elif [ "$RUNNER_OS" == "Windows" ]; then | |
| echo "Using chocolatey to install OpenCppCoverage" | |
| choco install opencppcoverage | |
| # Add to Path | |
| echo "C:/Program Files/OpenCppCoverage" >> $GITHUB_PATH | |
| fi; | |
| - name: Configure CMake | |
| run: | | |
| cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DENABLE_COVERAGE:BOOL=${{ matrix.ENABLE_COVERAGE }} | |
| - name: Build | |
| # Execute the build. You can specify a specific target with "--target <NAME>" | |
| run: cmake --build ./build --config $BUILD_TYPE | |
| - name: Unix - Test and coverage | |
| if: runner.os != 'Windows' | |
| working-directory: ./build | |
| # Execute tests defined by the CMake configuration. | |
| # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
| run: | | |
| ctest -C $BUILD_TYPE | |
| gcovr -j $(nproc) --delete --root ../ --print-summary --xml-pretty --xml coverage.xml . | |
| - name: Windows - Test and coverage | |
| if: runner.os == 'Windows' | |
| working-directory: ./build | |
| run: | | |
| OpenCppCoverage.exe --sources cpp_starter_project --export_type cobertura:coverage.xml --cover_children -- ctest -C $BUILD_TYPE | |
| - name: Publish to codecov | |
| uses: codecov/codecov-action@v2 | |
| with: | |
| flags: ${{ runner.os }} | |
| name: ${{ runner.os }}-coverage | |
| files: ./build/coverage.xml |