|
| 1 | +name: Fast DDS Python Windows CI reusable workflow |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + os-version: |
| 7 | + description: 'The OS image for the workflow' |
| 8 | + required: false |
| 9 | + default: 'windows-2019' |
| 10 | + type: string |
| 11 | + vs-toolset: |
| 12 | + description: 'The VS toolset to use for the build' |
| 13 | + required: false |
| 14 | + default: 'v142' |
| 15 | + type: string |
| 16 | + label: |
| 17 | + description: 'ID associated to the workflow' |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + colcon-args: |
| 21 | + description: 'Extra arguments for colcon cli' |
| 22 | + required: false |
| 23 | + type: string |
| 24 | + cmake-args: |
| 25 | + description: 'Extra arguments for cmake cli' |
| 26 | + required: false |
| 27 | + type: string |
| 28 | + ctest-args: |
| 29 | + description: 'Extra arguments for ctest cli' |
| 30 | + required: false |
| 31 | + type: string |
| 32 | + fastdds-python-branch: |
| 33 | + description: 'Branch or tag of Fast DDS Python repository' |
| 34 | + required: true |
| 35 | + type: string |
| 36 | + fastdds-branch: |
| 37 | + description: 'Branch or tag of Fast DDS repository' |
| 38 | + required: true |
| 39 | + type: string |
| 40 | + run-build: |
| 41 | + description: 'Build Fast DDS Python (CI skipped otherwise)' |
| 42 | + required: false |
| 43 | + type: boolean |
| 44 | + default: true |
| 45 | + run-tests: |
| 46 | + description: 'Run test suite of Fast DDS python' |
| 47 | + required: false |
| 48 | + type: boolean |
| 49 | + default: true |
| 50 | +env: |
| 51 | + colcon-build-default-cmake-args: '-DTHIRDPARTY_Asio=FORCE -DTHIRDPARTY_TinyXML2=FORCE -DTHIRDPARTY_fastcdr=OFF -DTHIRDPARTY_UPDATE=ON -DEPROSIMA_EXTRA_CMAKE_CXX_FLAGS="/MP /WX"' |
| 52 | +defaults: |
| 53 | + run: |
| 54 | + shell: pwsh |
| 55 | + |
| 56 | +jobs: |
| 57 | + fastdds_python_build: |
| 58 | + runs-on: ${{ inputs.os-version }} |
| 59 | + if: ${{ inputs.run-build == true }} |
| 60 | + strategy: |
| 61 | + fail-fast: false |
| 62 | + matrix: |
| 63 | + cmake-build-type: |
| 64 | + - 'RelWithDebInfo' |
| 65 | + |
| 66 | + steps: |
| 67 | + - name: Add ci-pending label if PR |
| 68 | + if: ${{ github.event_name == 'pull_request' }} |
| 69 | + uses: eProsima/eProsima-CI/external/add_labels@v0 |
| 70 | + with: |
| 71 | + labels: ci-pending |
| 72 | + number: ${{ github.event.number }} |
| 73 | + repo: eProsima/Fast-DDS-Python |
| 74 | + |
| 75 | + - name: Sync eProsima/Fast-DDS-Python repository |
| 76 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 77 | + with: |
| 78 | + path: src/fastdds_python |
| 79 | + ref: ${{ inputs.fastdds-python-branch }} |
| 80 | + |
| 81 | + - name: Install Fix Python version |
| 82 | + uses: eProsima/eProsima-CI/external/setup-python@v0 |
| 83 | + with: |
| 84 | + python-version: '3.11' |
| 85 | + |
| 86 | + - name: Get minimum supported version of CMake |
| 87 | + uses: eProsima/eProsima-CI/external/get-cmake@v0 |
| 88 | + with: |
| 89 | + cmakeVersion: '3.22.6' |
| 90 | + |
| 91 | + - name: Install OpenSSL |
| 92 | + uses: eProsima/eprosima-CI/windows/install_openssl@v0 |
| 93 | + with: |
| 94 | + version: '3.1.1' |
| 95 | + |
| 96 | + - name: Update OpenSSL environment variables |
| 97 | + run: | |
| 98 | + # Update the environment |
| 99 | + if (Test-Path -Path $Env:ProgramW6432\OpenSSL) |
| 100 | + { |
| 101 | + "OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM |
| 102 | + } |
| 103 | + elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win) |
| 104 | + { |
| 105 | + "OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM |
| 106 | + } |
| 107 | + elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win64) |
| 108 | + { |
| 109 | + "OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win64" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM |
| 110 | + } |
| 111 | + else |
| 112 | + { |
| 113 | + Write-Error -Message "Cannot find OpenSSL installation." |
| 114 | + exit 1 |
| 115 | + } |
| 116 | +
|
| 117 | + - name: Install colcon |
| 118 | + uses: eProsima/eProsima-CI/windows/install_colcon@v0 |
| 119 | + |
| 120 | + - name: Install Python dependencies |
| 121 | + uses: eProsima/eProsima-CI/windows/install_python_packages@v0 |
| 122 | + with: |
| 123 | + packages: vcstool xmlschema pywin32 |
| 124 | + |
| 125 | + - name: Install swig |
| 126 | + shell: pwsh |
| 127 | + run: choco install swig --allow-downgrade --version=4.0.2.04082020 |
| 128 | + |
| 129 | + # Although this is a ubuntu action becuase it uses bash, it is compatible with windows |
| 130 | + - name: Get Fast DDS branch |
| 131 | + id: get_fastdds_branch |
| 132 | + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 |
| 133 | + with: |
| 134 | + remote_repository: eProsima/Fast-DDS |
| 135 | + fallback_branch: ${{ inputs.fastdds-branch }} |
| 136 | + |
| 137 | + - name: Download Fast DDS repo |
| 138 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 139 | + with: |
| 140 | + repository: eProsima/Fast-DDS |
| 141 | + path: src/fastdds |
| 142 | + ref: ${{ steps.get_fastdds_branch.outputs.deduced_branch }} |
| 143 | + |
| 144 | + - name: Fetch Fast DDS Python dependencies |
| 145 | + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 |
| 146 | + with: |
| 147 | + vcs_repos_file: ${{ github.workspace }}/src/fastdds_python/fastdds_python.repos |
| 148 | + destination_workspace: src |
| 149 | + skip_existing: 'true' |
| 150 | + |
| 151 | + - name: Colcon build |
| 152 | + continue-on-error: false |
| 153 | + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 |
| 154 | + with: |
| 155 | + colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/build.meta |
| 156 | + colcon_build_args: ${{ inputs.colcon-args }} |
| 157 | + colcon_build_args_default: --event-handlers console_direct+ desktop_notification- |
| 158 | + cmake_args: ${{ inputs.cmake-args }} |
| 159 | + cmake_args_default: '-T ${{ inputs.vs-toolset }} ${{ env.colcon-build-default-cmake-args }}' |
| 160 | + cmake_build_type: ${{ matrix.cmake-build-type }} |
| 161 | + workspace: ${{ github.workspace }} |
| 162 | + |
| 163 | + - name: Upload build artifacts |
| 164 | + uses: eProsima/eProsima-CI/external/upload-artifact@v0 |
| 165 | + with: |
| 166 | + name: fastdds_python_build_${{ inputs.label }} |
| 167 | + path: ${{ github.workspace }} |
| 168 | + |
| 169 | + |
| 170 | + fastdds_python_test: |
| 171 | + needs: fastdds_python_build |
| 172 | + runs-on: ${{ inputs.os-version }} |
| 173 | + if: ${{ inputs.run-tests == true }} |
| 174 | + strategy: |
| 175 | + fail-fast: false |
| 176 | + matrix: |
| 177 | + cmake-build-type: |
| 178 | + - 'RelWithDebInfo' |
| 179 | + steps: |
| 180 | + - name: Download python build artifacts |
| 181 | + uses: eProsima/eProsima-CI/external/download-artifact@v0 |
| 182 | + with: |
| 183 | + name: fastdds_python_build_${{ inputs.label }} |
| 184 | + path: ${{ github.workspace }} |
| 185 | + |
| 186 | + - name: Install Fix Python version |
| 187 | + uses: eProsima/eProsima-CI/external/setup-python@v0 |
| 188 | + with: |
| 189 | + python-version: '3.11' |
| 190 | + |
| 191 | + - name: Get minimum supported version of CMake |
| 192 | + uses: eProsima/eProsima-CI/external/get-cmake@v0 |
| 193 | + with: |
| 194 | + cmakeVersion: '3.22.6' |
| 195 | + |
| 196 | + - name: Install OpenSSL |
| 197 | + uses: eProsima/eprosima-CI/windows/install_openssl@v0 |
| 198 | + with: |
| 199 | + version: '3.1.1' |
| 200 | + |
| 201 | + - name: Update OpenSSL environment variables |
| 202 | + run: | |
| 203 | + # Update the environment |
| 204 | + if (Test-Path -Path $Env:ProgramW6432\OpenSSL) |
| 205 | + { |
| 206 | + "OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM |
| 207 | + } |
| 208 | + elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win) |
| 209 | + { |
| 210 | + "OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM |
| 211 | + } |
| 212 | + elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win64) |
| 213 | + { |
| 214 | + "OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win64" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM |
| 215 | + } |
| 216 | + else |
| 217 | + { |
| 218 | + Write-Error -Message "Cannot find OpenSSL installation." |
| 219 | + exit 1 |
| 220 | + } |
| 221 | +
|
| 222 | + - name: Install colcon |
| 223 | + uses: eProsima/eProsima-CI/windows/install_colcon@v0 |
| 224 | + |
| 225 | + - name: Install Python dependencies |
| 226 | + uses: eProsima/eProsima-CI/windows/install_python_packages@v0 |
| 227 | + with: |
| 228 | + packages: vcstool xmlschema pywin32 pytest |
| 229 | + |
| 230 | + - name: Install swig |
| 231 | + shell: pwsh |
| 232 | + run: choco install swig --allow-downgrade --version=4.0.2.04082020 |
| 233 | + |
| 234 | + |
| 235 | + - name: Prepare build meta file |
| 236 | + run: | |
| 237 | + $build_meta_file = '${{ github.workspace }}\src\fastdds_python\.github\workflows\config\build.meta' |
| 238 | + $test_meta_file = '${{ github.workspace }}\src\fastdds_python\.github\workflows\config\test.meta' |
| 239 | + $build_test_meta_file = '${{ github.workspace }}\src\fastdds_python\.github\workflows\config\build_test.meta' |
| 240 | +
|
| 241 | + # Read the content of the build meta file |
| 242 | + $build_meta_content = Get-Content -Path $build_meta_file |
| 243 | +
|
| 244 | + # Read the content of the test meta file, starting from line 4 (skipping "name" line [1], cmake project name line [2] and "cmake-args" line [3]) |
| 245 | + $test_meta_content = Get-Content -Path $test_meta_file | Select-Object -Skip 3 |
| 246 | +
|
| 247 | + # Combine the content of the build meta file and the test meta file |
| 248 | + $combined_content = $build_meta_content + $test_meta_content |
| 249 | +
|
| 250 | + # Write the combined content to the build test meta file |
| 251 | + $combined_content | Out-File -FilePath $build_test_meta_file -Encoding UTF8 |
| 252 | +
|
| 253 | + - name: Colcon build |
| 254 | + continue-on-error: false |
| 255 | + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 |
| 256 | + with: |
| 257 | + colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/build_test.meta |
| 258 | + colcon_build_args: ${{ inputs.colcon-args }} |
| 259 | + colcon_build_args_default: --event-handlers console_direct+ desktop_notification- |
| 260 | + cmake_args: ${{ inputs.cmake-args }} |
| 261 | + cmake_args_default: '-T ${{ inputs.vs-toolset }} ${{ env.colcon-build-default-cmake-args }}' |
| 262 | + cmake_build_type: ${{ matrix.cmake-build-type }} |
| 263 | + workspace: ${{ github.workspace }} |
| 264 | + |
| 265 | + - name: Colcon test |
| 266 | + id: python_test |
| 267 | + uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0 |
| 268 | + with: |
| 269 | + colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/test.meta |
| 270 | + colcon_test_args: ${{ inputs.colcon-args }} |
| 271 | + colcon_test_args_default: --event-handlers=console_direct+ desktop_notification- |
| 272 | + ctest_args: ${{ inputs.ctest-args }} |
| 273 | + packages_names: fastdds_python |
| 274 | + workspace: ${{ github.workspace }} |
| 275 | + workspace_dependencies: '' |
| 276 | + test_report_artifact: ${{ format('test_report_{0}_{1}_{2}', inputs.label, github.job, join(matrix.*, '_')) }} |
| 277 | + |
| 278 | + - name: Test summary |
| 279 | + uses: eProsima/eProsima-CI/multiplatform/junit_summary@v0 |
| 280 | + if: ${{ !cancelled() }} |
| 281 | + with: |
| 282 | + junit_reports_dir: "${{ steps.python_test.outputs.ctest_results_path }}" |
| 283 | + print_summary: 'True' |
| 284 | + show_failed: 'True' |
| 285 | + show_disabled: 'False' |
| 286 | + show_skipped: 'False' |
0 commit comments