|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - 'feature/**' |
| 8 | + - 'release/**' |
| 9 | + - 'hotfix/**' |
| 10 | + tags: |
| 11 | + - 'v*' |
| 12 | + branches-ignore: |
| 13 | + - master |
| 14 | + schedule: |
| 15 | + - cron: '0 1 * * 0' # Run at 1 AM on Sunday |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + build_type: ['Debug', 'Release', 'RelWithDebInfo'] |
| 23 | + include: |
| 24 | + - name: windows2022_msvc2022 |
| 25 | + os: windows-2022 |
| 26 | + compiler: visual_studio |
| 27 | + compiler_version: 17 |
| 28 | + setup_build_env: 'call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"' |
| 29 | + activate_venv: 'call ".venv\Scripts\activate.bat"' |
| 30 | + |
| 31 | + - name: windows2019_msvc2019 |
| 32 | + os: windows-2019 |
| 33 | + compiler: visual_studio |
| 34 | + compiler_version: 16 |
| 35 | + setup_build_env: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"' |
| 36 | + activate_venv: 'call ".venv\Scripts\activate.bat"' |
| 37 | + |
| 38 | + - name: macos14_clang15 |
| 39 | + os: macos-14 |
| 40 | + compiler: clang |
| 41 | + compiler_version: 15 |
| 42 | + setup_build_env: 'echo ${{ matrix.compiler }} ${{ matrix.compiler_version }}' |
| 43 | + activate_venv: 'source .venv/bin/activate' |
| 44 | + |
| 45 | + - name: ubuntu2204_gcc12 |
| 46 | + os: ubuntu-22.04 |
| 47 | + compiler: gcc |
| 48 | + compiler_version: 12 |
| 49 | + setup_build_env: 'echo ${{ matrix.compiler }} ${{ matrix.compiler_version }}' |
| 50 | + activate_venv: 'source .venv/bin/activate' |
| 51 | + |
| 52 | + - name: ubuntu2204_clang15 |
| 53 | + os: ubuntu-22.04 |
| 54 | + compiler: clang |
| 55 | + compiler_version: 15 |
| 56 | + setup_build_env: 'echo ${{ matrix.compiler }} ${{ matrix.compiler_version }}' |
| 57 | + activate_venv: 'source .venv/bin/activate' |
| 58 | + |
| 59 | + runs-on: ${{ matrix.os }} |
| 60 | + name: ${{ matrix.name }} ${{ matrix.build_type }} |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Checkout repository |
| 64 | + uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + submodules: true |
| 67 | + |
| 68 | + - name: Set up Python 3.10 |
| 69 | + uses: actions/setup-python@v5 |
| 70 | + with: |
| 71 | + python-version: '3.10' |
| 72 | + architecture: 'x64' |
| 73 | + |
| 74 | + - name: Cache Virtual Environment |
| 75 | + uses: actions/cache@v4 |
| 76 | + id: cache-venv |
| 77 | + with: |
| 78 | + path: .venv |
| 79 | + key: ${{ runner.os }}-${{ matrix.name }}-venv-${{ hashFiles('scripts/requirements.txt') }} |
| 80 | + |
| 81 | + - name: Cache Conan |
| 82 | + uses: actions/cache@v4 |
| 83 | + with: |
| 84 | + path: .conan |
| 85 | + key: ${{ runner.os }}-${{ matrix.name }}-conan-${{ hashFiles('inference_client/conanfile.txt') }} |
| 86 | + |
| 87 | + - name: Setup Virtual Environment |
| 88 | + if: steps.cache-venv.outputs.cache-hit != 'true' |
| 89 | + run: | |
| 90 | + python3 -m venv .venv |
| 91 | + ${{ matrix.activate_venv }} |
| 92 | + pip3 install -r scripts/requirements.txt |
| 93 | +
|
| 94 | + - name: Setup Conan |
| 95 | + run: | |
| 96 | + ${{ matrix.activate_venv }} |
| 97 | + python3 scripts/conan/setup.py ${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }} |
| 98 | +
|
| 99 | + - name: Build |
| 100 | + run: | |
| 101 | + ${{ matrix.activate_venv }} |
| 102 | + ${{ matrix.setup_build_env }} |
| 103 | + python3 scripts/cmake.py ${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }} --warnings |
| 104 | + env: |
| 105 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 106 | + |
| 107 | + - name: Unit Tests |
| 108 | + run: | |
| 109 | + ${{ matrix.activate_venv }} |
| 110 | + ${{ matrix.setup_build_env }} |
| 111 | + python3 scripts/cmake.py ${{ matrix.build_type }} ${{ matrix.compiler }} ${{ matrix.compiler_version }} --warnings --coverage |
| 112 | + python3 scripts/tools/run_unit_tests.py ${{ matrix.build_type }} |
| 113 | + env: |
| 114 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 115 | + continue-on-error: true |
| 116 | + timeout-minutes: 5 |
| 117 | + |
| 118 | + - name: Publish Unit Tests Results |
| 119 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 120 | + if: always() |
| 121 | + with: |
| 122 | + files: results/unit_tests/unit_tests.xml |
| 123 | + fail_on: 'test failures' |
| 124 | + check_name: "Unit Tests Results - ${{ matrix.name }} ${{ matrix.build_type }}" |
| 125 | + |
| 126 | + - name: Code Coverage |
| 127 | + if: runner.os == 'Linux' |
| 128 | + run: | |
| 129 | + ${{ matrix.activate_venv }} |
| 130 | + ${{ matrix.setup_build_env }} |
| 131 | + python3 scripts/tools/run_coverage.py inference_client ${{ matrix.compiler }} ${{ matrix.compiler_version }} |
| 132 | + env: |
| 133 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 134 | + timeout-minutes: 5 |
| 135 | + |
| 136 | + - name: Upload coverage reports to Codecov |
| 137 | + if: runner.os == 'Linux' |
| 138 | + uses: codecov/codecov-action@v4 |
| 139 | + with: |
| 140 | + file: results/coverage/cobertura.xml |
| 141 | + fail_ci_if_error: false |
0 commit comments