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