|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + force_deployment: |
| 8 | + description: 'Force Conan package deploy' |
| 9 | + required: true |
| 10 | + default: true |
| 11 | + type: boolean |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + build_type: ['Debug', 'Release', 'RelWithDebInfo'] |
| 19 | + config: |
| 20 | + - name: windows2022_msvc2022 |
| 21 | + os: windows-2022 |
| 22 | + compiler: visual_studio |
| 23 | + compiler_version: 17 |
| 24 | + setup_build_env: 'call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' |
| 25 | + activate_venv: 'call ".venv\\Scripts\\activate.bat"' |
| 26 | + |
| 27 | + - name: windows2019_msvc2019 |
| 28 | + os: windows-2019 |
| 29 | + compiler: visual_studio |
| 30 | + compiler_version: 16 |
| 31 | + setup_build_env: 'call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' |
| 32 | + activate_venv: 'call ".venv\\Scripts\\activate.bat"' |
| 33 | + |
| 34 | + - name: macos14_clang15 |
| 35 | + os: macos-14 |
| 36 | + compiler: clang |
| 37 | + compiler_version: 15 |
| 38 | + setup_build_env: "" |
| 39 | + activate_venv: 'source .venv/bin/activate' |
| 40 | + |
| 41 | + - name: ubuntu2204_gcc12 |
| 42 | + os: ubuntu-22.04 |
| 43 | + compiler: gcc |
| 44 | + compiler_version: 12 |
| 45 | + setup_build_env: "" |
| 46 | + activate_venv: 'source .venv/bin/activate' |
| 47 | + |
| 48 | + - name: ubuntu2204_clang15 |
| 49 | + os: ubuntu-22.04 |
| 50 | + compiler: clang |
| 51 | + compiler_version: 15 |
| 52 | + setup_build_env: "" |
| 53 | + activate_venv: 'source .venv/bin/activate' |
| 54 | + |
| 55 | + runs-on: ${{ matrix.config.os }} |
| 56 | + name: CI ${{ matrix.config.name }} ${{ matrix.build_type }} |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout repository |
| 60 | + uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + submodules: true |
| 63 | + |
| 64 | + - name: Set Python version |
| 65 | + uses: actions/setup-python@v5 |
| 66 | + with: |
| 67 | + python-version: '3.12' |
| 68 | + architecture: 'x64' |
| 69 | + |
| 70 | + - name: Setup Virtual Environment |
| 71 | + uses: ./.github/actions/shell |
| 72 | + with: |
| 73 | + commands: | |
| 74 | + python3 -m venv .venv |
| 75 | + ${{ matrix.config.activate_venv }} |
| 76 | + pip3 install -r scripts/requirements.txt |
| 77 | + conan remote add teiacare ${{ secrets.ARTIFACTORY_URL }}/teiacare --insert 0 --force |
| 78 | + conan user ${{ secrets.ARTIFACTORY_USERNAME }} -p ${{ secrets.ARTIFACTORY_PASSWORD }} -r teiacare |
| 79 | + env: |
| 80 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 81 | + |
| 82 | + - name: Setup Conan |
| 83 | + uses: ./.github/actions/shell |
| 84 | + with: |
| 85 | + commands: | |
| 86 | + ${{ matrix.config.activate_venv }} |
| 87 | + python3 scripts/conan/setup.py ${{ matrix.build_type }} ${{ matrix.config.compiler }} ${{ matrix.config.compiler_version }} |
| 88 | + env: |
| 89 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 90 | + |
| 91 | + - name: Build |
| 92 | + uses: ./.github/actions/shell |
| 93 | + with: |
| 94 | + commands: | |
| 95 | + ${{ matrix.config.activate_venv }} |
| 96 | + ${{ matrix.config.setup_build_env }} |
| 97 | + python3 scripts/cmake.py ${{ matrix.build_type }} ${{ matrix.config.compiler }} ${{ matrix.config.compiler_version }} --warnings |
| 98 | + env: |
| 99 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 100 | + |
| 101 | + - name: Unit Tests |
| 102 | + uses: ./.github/actions/shell |
| 103 | + with: |
| 104 | + commands: | |
| 105 | + ${{ matrix.config.activate_venv }} |
| 106 | + ${{ matrix.config.setup_build_env }} |
| 107 | + python3 scripts/cmake.py ${{ matrix.build_type }} ${{ matrix.config.compiler }} ${{ matrix.config.compiler_version }} --warnings --unit_tests |
| 108 | + python3 scripts/tools/run_unit_tests.py ${{ matrix.build_type }} |
| 109 | + env: |
| 110 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 111 | + continue-on-error: true |
| 112 | + timeout-minutes: 5 |
| 113 | + |
| 114 | + - name: Create Conan Package |
| 115 | + uses: ./.github/actions/shell |
| 116 | + with: |
| 117 | + commands: | |
| 118 | + ${{ matrix.config.activate_venv }} |
| 119 | + ${{ matrix.config.setup_build_env }} |
| 120 | + python3 scripts/conan/create.py ${{ matrix.build_type }} ${{ matrix.config.compiler }} ${{ matrix.config.compiler_version }} |
| 121 | + env: |
| 122 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 123 | + |
| 124 | + - name: Publish Conan cache |
| 125 | + uses: actions/upload-artifact@v4 |
| 126 | + with: |
| 127 | + name: ${{ matrix.config.name }}-${{ matrix.build_type }} |
| 128 | + path: .conan |
| 129 | + if-no-files-found: error |
| 130 | + overwrite: true |
| 131 | + include-hidden-files: true |
| 132 | + |
| 133 | + coverage: |
| 134 | + needs: build |
| 135 | + runs-on: ubuntu-22.04 |
| 136 | + name: Code Coverage |
| 137 | + |
| 138 | + env: |
| 139 | + COMPILER: gcc |
| 140 | + COMPILER_VERSION: 12 |
| 141 | + BUILD_TYPE: Debug |
| 142 | + |
| 143 | + steps: |
| 144 | + - name: Checkout repository |
| 145 | + uses: actions/checkout@v4 |
| 146 | + with: |
| 147 | + submodules: true |
| 148 | + |
| 149 | + - name: Set Python version |
| 150 | + uses: actions/setup-python@v5 |
| 151 | + with: |
| 152 | + python-version: '3.12' |
| 153 | + architecture: 'x64' |
| 154 | + |
| 155 | + - name: Setup Virtual Environment |
| 156 | + uses: ./.github/actions/shell |
| 157 | + with: |
| 158 | + commands: | |
| 159 | + python3 -m venv .venv |
| 160 | + ${{ matrix.config.activate_venv }} |
| 161 | + pip3 install -r scripts/requirements.txt |
| 162 | + conan remote add teiacare ${{ secrets.ARTIFACTORY_URL }}/teiacare --insert 0 --force |
| 163 | + conan user ${{ secrets.ARTIFACTORY_USERNAME }} -p ${{ secrets.ARTIFACTORY_PASSWORD }} -r teiacare |
| 164 | + env: |
| 165 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 166 | + |
| 167 | + - name: Setup Conan |
| 168 | + uses: ./.github/actions/shell |
| 169 | + with: |
| 170 | + commands: | |
| 171 | + source .venv/bin/activate |
| 172 | + python3 scripts/conan/setup.py ${{ env.BUILD_TYPE }} ${{ env.COMPILER }} ${{ env.COMPILER_VERSION }} |
| 173 | + env: |
| 174 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 175 | + |
| 176 | + - name: Run Code Coverage |
| 177 | + run: | |
| 178 | + source .venv/bin/activate |
| 179 | + python3 scripts/cmake.py ${{ env.BUILD_TYPE }} ${{ env.COMPILER }} ${{ env.COMPILER_VERSION }} --warnings --coverage |
| 180 | + python3 scripts/tools/run_unit_tests.py ${{ env.BUILD_TYPE }} |
| 181 | + python3 scripts/tools/run_coverage.py ${{ env.COMPILER }} ${{ env.COMPILER_VERSION }} sdk |
| 182 | + timeout-minutes: 5 |
| 183 | + continue-on-error: true |
| 184 | + env: |
| 185 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 186 | + |
| 187 | + - name: Upload Codacy |
| 188 | + run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r results/coverage/cobertura.xml |
| 189 | + env: |
| 190 | + CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}} |
| 191 | + |
| 192 | + deploy: |
| 193 | + needs: build |
| 194 | + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force_deployment == 'true' || github.ref == 'refs/heads/develop' }} |
| 195 | + strategy: |
| 196 | + fail-fast: false |
| 197 | + matrix: |
| 198 | + build_type: ['Debug', 'Release', 'RelWithDebInfo'] |
| 199 | + config: |
| 200 | + - name: windows2022_msvc2022 |
| 201 | + os: windows-2022 |
| 202 | + compiler: visual_studio |
| 203 | + compiler_version: 17 |
| 204 | + setup_build_env: 'call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' |
| 205 | + activate_venv: 'call ".venv\\Scripts\\activate.bat"' |
| 206 | + |
| 207 | + - name: windows2019_msvc2019 |
| 208 | + os: windows-2019 |
| 209 | + compiler: visual_studio |
| 210 | + compiler_version: 16 |
| 211 | + setup_build_env: 'call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' |
| 212 | + activate_venv: 'call ".venv\\Scripts\\activate.bat"' |
| 213 | + |
| 214 | + - name: macos14_clang15 |
| 215 | + os: macos-14 |
| 216 | + compiler: clang |
| 217 | + compiler_version: 15 |
| 218 | + setup_build_env: "" |
| 219 | + activate_venv: 'source .venv/bin/activate' |
| 220 | + |
| 221 | + - name: ubuntu2204_gcc12 |
| 222 | + os: ubuntu-22.04 |
| 223 | + compiler: gcc |
| 224 | + compiler_version: 12 |
| 225 | + setup_build_env: "" |
| 226 | + activate_venv: 'source .venv/bin/activate' |
| 227 | + |
| 228 | + - name: ubuntu2204_clang15 |
| 229 | + os: ubuntu-22.04 |
| 230 | + compiler: clang |
| 231 | + compiler_version: 15 |
| 232 | + setup_build_env: "" |
| 233 | + activate_venv: 'source .venv/bin/activate' |
| 234 | + |
| 235 | + runs-on: ${{ matrix.config.os }} |
| 236 | + name: CD ${{ matrix.config.name }} ${{ matrix.build_type }} |
| 237 | + |
| 238 | + steps: |
| 239 | + - name: Checkout repository |
| 240 | + uses: actions/checkout@v4 |
| 241 | + with: |
| 242 | + submodules: true |
| 243 | + |
| 244 | + - name: Set Python version |
| 245 | + uses: actions/setup-python@v5 |
| 246 | + with: |
| 247 | + python-version: '3.12' |
| 248 | + architecture: 'x64' |
| 249 | + |
| 250 | + - name: Setup Virtual Environment |
| 251 | + uses: ./.github/actions/shell |
| 252 | + with: |
| 253 | + commands: | |
| 254 | + python3 -m venv .venv |
| 255 | + ${{ matrix.config.activate_venv }} |
| 256 | + pip3 install -r scripts/requirements.txt |
| 257 | + conan remote add teiacare ${{ secrets.ARTIFACTORY_URL }}/teiacare --insert 0 --force |
| 258 | + conan user ${{ secrets.ARTIFACTORY_USERNAME }} -p ${{ secrets.ARTIFACTORY_PASSWORD }} -r teiacare |
| 259 | + env: |
| 260 | + CONAN_USER_HOME: ${{ github.workspace }} |
| 261 | + |
| 262 | + - name: Download Conan cache |
| 263 | + uses: actions/download-artifact@v4 |
| 264 | + with: |
| 265 | + name: ${{ matrix.config.name }}-${{ matrix.build_type }} |
| 266 | + path: .conan/ |
| 267 | + |
| 268 | + - name: Upload Conan Package |
| 269 | + uses: ./.github/actions/shell |
| 270 | + with: |
| 271 | + commands: | |
| 272 | + ${{ matrix.config.activate_venv }} |
| 273 | + ${{ matrix.config.setup_build_env }} |
| 274 | + python3 scripts/conan/upload.py teiacare ${{ secrets.ARTIFACTORY_URL }} ${{ secrets.ARTIFACTORY_USERNAME }} ${{ secrets.ARTIFACTORY_PASSWORD }} |
| 275 | + env: |
| 276 | + CONAN_USER_HOME: ${{ github.workspace }} |
0 commit comments