Merge pull request #35 from DigitalDiners/Luke #128
This file contains 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: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Set database credentials as environment variables | |
- name: Set database credentials as environment variables | |
run: | | |
echo "DB_IP=${{ secrets.DB_IP }}" >> $GITHUB_ENV | |
echo "DB_USER=${{ secrets.DB_USER }}" >> $GITHUB_ENV | |
echo "DB_PASS=${{ secrets.DB_PASS }}" >> $GITHUB_ENV | |
# NOTE: If a boost version matching all requirements cannot be found, | |
# this build step will fail | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
run: ctest -C build --verbose | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Set database credentials as environment variables | |
- name: Set database credentials as environment variables | |
run: | | |
echo "DB_IP=${{ secrets.DB_IP }}" >> $GITHUB_ENV | |
echo "DB_USER=${{ secrets.DB_USER }}" >> $GITHUB_ENV | |
echo "DB_PASS=${{ secrets.DB_PASS }}" >> $GITHUB_ENV | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
run: ctest -C build --verbose | |
code-coverage: | |
# Exectute code coverage generation and upload to CodeCov. | |
# Issues with running the test executables resulted in using this step on linux. | |
runs-on: ubuntu-latest # Use a Linux runner | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install C++ compiler and dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y g++ | |
- name: Install gcovr | |
run: sudo apt-get install -y gcovr | |
- name: Compile and run tests | |
working-directory: ${{github.workspace}}/tests | |
run: | | |
ls -R | |
g++ --coverage test.cpp -o coverage1 | |
g++ --coverage plannerTests.cpp -o coverage2 | |
g++ --coverage recipeTests.cpp -o coverage3 | |
g++ --coverage reviewTests.cpp -o coverage4 | |
./coverage1 | |
./coverage2 | |
./coverage3 | |
./coverage4 | |
ls -R | |
gcovr -r ../ --xml --exclude catch_amalgamated.cpp --exclude catch_amalgamated.hpp -o coverage.xml | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v2 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
files: ${{github.workspace}}/tests/coverage.xml | |