Update build.yml for Azure Pipelines #22
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: Coverage | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
build: | |
runs-on: ${{ matrix.agent }} | |
name: '${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }}' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- agent: ubuntu-22.04 | |
compiler: gcc | |
compiler_version: '12' | |
activate_virtual_env: 'source .venv/bin/activate' | |
build_type: 'Debug' | |
- agent: ubuntu-22.04 | |
compiler: gcc | |
compiler_version: '12' | |
activate_virtual_env: 'source .venv/bin/activate' | |
build_type: 'Release' | |
- agent: ubuntu-22.04 | |
compiler: clang | |
compiler_version: '15' | |
activate_virtual_env: 'source .venv/bin/activate' | |
build_type: 'Debug' | |
- agent: ubuntu-22.04 | |
compiler: clang | |
compiler_version: '15' | |
activate_virtual_env: 'source .venv/bin/activate' | |
build_type: 'Release' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
- name: Cache Virtual Environment | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ matrix.build_type }}-${{ hashFiles('scripts/requirements.txt') }} | |
- name: Cache Conan | |
uses: actions/cache@v3 | |
with: | |
path: .conan | |
key: conan-${{ runner.os }}-${{ matrix.build_type }}-${{ hashFiles('inference_client/conanfile.txt', 'inference_client/tests/conanfile.txt') }} | |
- name: Setup Virtual Environment | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip install -r scripts/requirements.txt | |
- name: Setup Conan | |
run: | | |
source .venv/bin/activate | |
python3 scripts/conan/setup.py ${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }} -d inference_client inference_client/tests | |
- name: Run Code Coverage | |
run: | | |
source .venv/bin/activate | |
python3 scripts/cmake.py ${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }} --warnings --coverage | |
python3 scripts/tools/run_unit_tests.py ${{ matrix.build_type }} | |
python3 scripts/tools/run_coverage.py ${{ matrix.compiler }} ${{ matrix.compiler_version }} | |
timeout-minutes: 5 | |
continue-on-error: true | |
env: | |
CONAN_USER_HOME: ${{ github.workspace }} | |
- name: Upload Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: './results/coverage/cobertura.xml' | |
name: TeiaCareInferenceClient | |
slug: TeiaCare/TeiaCareInferenceClient | |
token: ${{secrets.CODECOV_TOKEN}} | |
flags: '${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }}' | |
- name: Upload Codacy | |
if: ${{ matrix.build_type == 'Release' && matrix.compiler == 'gcc' }} | |
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r results/coverage/cobertura.xml | |
env: | |
CODACY_PROJECT_TOKEN: ${{secrets.CODACY_TOKEN}} |