|
| 1 | +name: Fast DDS Python Ubuntu 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: 'ubuntu-22.04' |
| 10 | + type: string |
| 11 | + label: |
| 12 | + description: 'ID associated to the workflow' |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + colcon-args: |
| 16 | + description: 'Extra arguments for colcon cli' |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + cmake-args: |
| 20 | + description: 'Extra arguments for cmake cli' |
| 21 | + required: false |
| 22 | + type: string |
| 23 | + ctest-args: |
| 24 | + description: 'Extra arguments for ctest cli' |
| 25 | + required: false |
| 26 | + type: string |
| 27 | + fastdds-python-branch: |
| 28 | + description: 'Branch or tag of Fast DDS Python repository' |
| 29 | + required: true |
| 30 | + type: string |
| 31 | + fastdds-branch: |
| 32 | + description: 'Branch or tag of Fast DDS repository' |
| 33 | + required: true |
| 34 | + type: string |
| 35 | + run-build: |
| 36 | + description: 'Build Fast DDS Python (CI skipped otherwise)' |
| 37 | + required: false |
| 38 | + type: boolean |
| 39 | + default: true |
| 40 | + run-tests: |
| 41 | + description: 'Run test suite of Fast DDS python' |
| 42 | + required: false |
| 43 | + type: boolean |
| 44 | + default: true |
| 45 | + |
| 46 | +env: |
| 47 | + colcon-build-default-cmake-args: '-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual"' |
| 48 | +defaults: |
| 49 | + run: |
| 50 | + shell: bash |
| 51 | + |
| 52 | +jobs: |
| 53 | + fastdds_python_build: |
| 54 | + runs-on: ${{ inputs.os-version }} |
| 55 | + if: ${{ inputs.run-build == true }} |
| 56 | + strategy: |
| 57 | + fail-fast: false |
| 58 | + matrix: |
| 59 | + cmake-build-type: |
| 60 | + - 'RelWithDebInfo' |
| 61 | + steps: |
| 62 | + - name: Add ci-pending label if PR |
| 63 | + if: ${{ github.event_name == 'pull_request' }} |
| 64 | + uses: eProsima/eProsima-CI/external/add_labels@v0 |
| 65 | + with: |
| 66 | + labels: ci-pending |
| 67 | + number: ${{ github.event.number }} |
| 68 | + repo: eProsima/Fast-DDS-Python |
| 69 | + |
| 70 | + - name: Sync eProsima/Fast-DDS-Python repository |
| 71 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 72 | + with: |
| 73 | + path: src/fastdds_python |
| 74 | + ref: ${{ inputs.fastdds-python-branch }} |
| 75 | + |
| 76 | + - name: Install Fix Python version |
| 77 | + uses: eProsima/eProsima-CI/external/setup-python@v0 |
| 78 | + with: |
| 79 | + python-version: '3.11' |
| 80 | + |
| 81 | + - name: Get minimum supported version of CMake |
| 82 | + uses: eProsima/eProsima-CI/external/get-cmake@v0 |
| 83 | + with: |
| 84 | + cmakeVersion: '3.22.6' |
| 85 | + |
| 86 | + - name: Install apt dependencies |
| 87 | + uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 |
| 88 | + with: |
| 89 | + packages: libasio-dev libtinyxml2-dev libssl-dev swig |
| 90 | + update: false |
| 91 | + upgrade: false |
| 92 | + |
| 93 | + - name: Install colcon |
| 94 | + uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 |
| 95 | + |
| 96 | + - name: Install Python dependencies |
| 97 | + uses: eProsima/eProsima-CI/multiplatform/install_python_packages@v0 |
| 98 | + with: |
| 99 | + packages: vcstool xmlschema |
| 100 | + upgrade: false |
| 101 | + |
| 102 | + - name: Get Fast DDS branch |
| 103 | + id: get_fastdds_branch |
| 104 | + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 |
| 105 | + with: |
| 106 | + remote_repository: eProsima/Fast-DDS |
| 107 | + fallback_branch: ${{ inputs.fastdds-branch }} |
| 108 | + |
| 109 | + - name: Download Fast DDS repo |
| 110 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 111 | + with: |
| 112 | + repository: eProsima/Fast-DDS |
| 113 | + path: src/fastdds |
| 114 | + ref: ${{ steps.get_fastdds_branch.outputs.deduced_branch }} |
| 115 | + |
| 116 | + - name: Fetch Fast DDS Python dependencies |
| 117 | + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 |
| 118 | + with: |
| 119 | + vcs_repos_file: ${{ github.workspace }}/src/fastdds_python/fastdds_python.repos |
| 120 | + destination_workspace: src |
| 121 | + skip_existing: 'true' |
| 122 | + |
| 123 | + |
| 124 | + - name: Colcon build |
| 125 | + continue-on-error: false |
| 126 | + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 |
| 127 | + with: |
| 128 | + colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/build.meta |
| 129 | + colcon_build_args: ${{ inputs.colcon-args }} |
| 130 | + cmake_args: ${{ inputs.cmake-args }} |
| 131 | + cmake_args_default: ${{ env.colcon-build-default-cmake-args }} |
| 132 | + cmake_build_type: ${{ matrix.cmake-build-type }} |
| 133 | + workspace: ${{ github.workspace }} |
| 134 | + |
| 135 | + - name: Upload build artifacts |
| 136 | + uses: eProsima/eProsima-CI/external/upload-artifact@v0 |
| 137 | + with: |
| 138 | + name: fastdds_python_build_${{ inputs.label }} |
| 139 | + path: ${{ github.workspace }} |
| 140 | + |
| 141 | + fastdds_python_test: |
| 142 | + needs: fastdds_python_build |
| 143 | + runs-on: ${{ inputs.os-version }} |
| 144 | + if: ${{ inputs.run-tests == true }} |
| 145 | + strategy: |
| 146 | + fail-fast: false |
| 147 | + matrix: |
| 148 | + cmake-build-type: |
| 149 | + - 'RelWithDebInfo' |
| 150 | + steps: |
| 151 | + - name: Download python build artifacts |
| 152 | + uses: eProsima/eProsima-CI/external/download-artifact@v0 |
| 153 | + with: |
| 154 | + name: fastdds_python_build_${{ inputs.label }} |
| 155 | + path: ${{ github.workspace }} |
| 156 | + |
| 157 | + - name: Install Fix Python version |
| 158 | + uses: eProsima/eProsima-CI/external/setup-python@v0 |
| 159 | + with: |
| 160 | + python-version: '3.11' |
| 161 | + |
| 162 | + - name: Get minimum supported version of CMake |
| 163 | + uses: eProsima/eProsima-CI/external/get-cmake@v0 |
| 164 | + with: |
| 165 | + cmakeVersion: '3.22.6' |
| 166 | + |
| 167 | + - name: Install apt packages |
| 168 | + uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 |
| 169 | + with: |
| 170 | + packages: libasio-dev libtinyxml2-dev libssl-dev swig |
| 171 | + |
| 172 | + - name: Install colcon |
| 173 | + uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 |
| 174 | + |
| 175 | + - name: Install Python dependencies |
| 176 | + uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0 |
| 177 | + with: |
| 178 | + packages: vcstool xmlschema |
| 179 | + |
| 180 | + - name: Fetch Fast DDS Python CI dependencies |
| 181 | + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 |
| 182 | + with: |
| 183 | + vcs_repos_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/test.repos |
| 184 | + destination_workspace: src |
| 185 | + skip_existing: 'true' |
| 186 | + |
| 187 | + - name: Colcon build |
| 188 | + continue-on-error: false |
| 189 | + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 |
| 190 | + with: |
| 191 | + colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/build.meta ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/test.meta |
| 192 | + colcon_build_args: ${{ inputs.colcon-args }} |
| 193 | + cmake_args: ${{ inputs.cmake-args }} |
| 194 | + cmake_args_default: '' |
| 195 | + cmake_build_type: ${{ matrix.cmake-build-type }} |
| 196 | + workspace: ${{ github.workspace }} |
| 197 | + |
| 198 | + - name: Colcon test |
| 199 | + id: python_test |
| 200 | + uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0 |
| 201 | + with: |
| 202 | + colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/test.meta |
| 203 | + colcon_test_args: ${{ inputs.colcon-args }} |
| 204 | + colcon_test_args_default: --event-handlers=console_direct+ |
| 205 | + ctest_args: ${{ inputs.ctest-args }} |
| 206 | + packages_names: fastdds_python |
| 207 | + workspace: ${{ github.workspace }} |
| 208 | + workspace_dependencies: '' |
| 209 | + test_report_artifact: ${{ format('test_report_{0}_{1}_{2}', inputs.label, github.job, join(matrix.*, '_')) }} |
| 210 | + |
| 211 | + - name: Fast DDS Python test summary |
| 212 | + uses: eProsima/eProsima-CI/multiplatform/junit_summary@v0 |
| 213 | + if: ${{ !cancelled() }} |
| 214 | + with: |
| 215 | + junit_reports_dir: "${{ steps.python_test.outputs.ctest_results_path }}" |
| 216 | + print_summary: 'True' |
| 217 | + show_failed: 'True' |
| 218 | + show_disabled: 'False' |
| 219 | + show_skipped: 'False' |
0 commit comments