#4 Add code coverage #310
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: ["*"] | |
pull_request: | |
branches: ["main"] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
BUILD_WRAPPER_OUT_DIR: bw_out | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
submodules: "true" | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v3 | |
- name: Install Python requirements | |
run: | | |
pip install -r requirements/package.txt | |
pip install -r requirements/dev.txt | |
- name: Install LRPC Python package | |
run: pip install . | |
- name: Run lotusrpc generator | |
run: | | |
lrpcg --version | |
lrpcg --help | |
- name: Run LRPC client CLI | |
run: | | |
lrpcc --version | |
lrpcc --help | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Run build-wrapper | |
run: | | |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" | |
- name: C++ tests | |
working-directory: ${{github.workspace}}/cmake_build | |
run: ctest -C ${{env.BUILD_TYPE}} --output-junit ../testresults/cpptestresults.xml | |
- name: Python tests | |
run: pytest tests/python -v --junitxml=testresults/pytestresults.xml | |
- name: Publish Test Results | |
if: ${{ github.triggering_actor != 'dependabot[bot]' }} | |
uses: EnricoMi/publish-unit-test-result-action/linux@v2 | |
with: | |
junit_files: "testresults/*.xml" |