|
| 1 | +name: Fast DDS Gen 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: true |
| 9 | + type: string |
| 10 | + java-version: |
| 11 | + description: 'The Java version to be used' |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + label: |
| 15 | + description: 'ID associated to the workflow' |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + fastddsgen-branch: |
| 19 | + description: 'Fast DDS Gen branch to be used' |
| 20 | + required: true |
| 21 | + type: string |
| 22 | + fastdds-branch: |
| 23 | + description: 'Branch or tag of Fast DDS repository' |
| 24 | + required: false |
| 25 | + type: string |
| 26 | + default: '2.14.x' |
| 27 | + fastcdr-branch: |
| 28 | + description: 'Branch or tag of Fast CDR repository' |
| 29 | + required: false |
| 30 | + type: string |
| 31 | + default: '2.x' |
| 32 | + fastdds-python-branch: |
| 33 | + description: 'Branch or tag of Fast DDS Python repository' |
| 34 | + required: false |
| 35 | + type: string |
| 36 | + default: '1.4.x' |
| 37 | + discovery-server-branch: |
| 38 | + description: 'Branch or tag of Discovery Server repository' |
| 39 | + required: false |
| 40 | + type: string |
| 41 | + default: '1.2.x' |
| 42 | + run-build: |
| 43 | + description: 'Build Fast DDS Gen' |
| 44 | + required: false |
| 45 | + type: boolean |
| 46 | + default: true |
| 47 | + run-tests: |
| 48 | + description: 'Run test suite of Fast DDS Gen' |
| 49 | + required: false |
| 50 | + type: boolean |
| 51 | + default: true |
| 52 | + use-ccache: |
| 53 | + description: 'Use CCache to speed up the build' |
| 54 | + required: false |
| 55 | + type: boolean |
| 56 | + default: false |
| 57 | +env: |
| 58 | + cdr-test-flag: ${{ inputs.fastcdr-branch == '1.1.x' && '-Dcdr_version=v1 -Dblacklist_tests=external,optional' || (inputs.fastcdr-branch == '2.x' && '-Dcdr_version=v2' || '-Dcdr_version=both' )}} |
| 59 | +defaults: |
| 60 | + run: |
| 61 | + shell: bash |
| 62 | + |
| 63 | +jobs: |
| 64 | + ubuntu-build-test: |
| 65 | + runs-on: ${{ inputs.os-version }} |
| 66 | + if: ${{ inputs.run-build == true }} |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + matrix: |
| 70 | + cmake-build-type: |
| 71 | + - 'RelWithDebInfo' |
| 72 | + steps: |
| 73 | + - name: Add ci-pending label if PR |
| 74 | + if: ${{ github.event_name == 'pull_request' }} |
| 75 | + uses: eProsima/eProsima-CI/external/add_labels@v0 |
| 76 | + with: |
| 77 | + labels: ci-pending |
| 78 | + number: ${{ github.event.number }} |
| 79 | + repo: eProsima/Fast-DDS-Gen |
| 80 | + |
| 81 | + - name: Sync eProsima/Fast-DDS-Gen repository |
| 82 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 83 | + with: |
| 84 | + path: ${{ github.workspace }}/src/fastddsgen |
| 85 | + ref: ${{ inputs.fastddsgen-branch }} |
| 86 | + |
| 87 | + - name: Install Fix Python version |
| 88 | + uses: eProsima/eProsima-CI/external/setup-python@v0 |
| 89 | + with: |
| 90 | + python-version: '3.11' |
| 91 | + |
| 92 | + - name: Get minimum supported version of CMake |
| 93 | + uses: eProsima/eProsima-CI/external/get-cmake@v0 |
| 94 | + with: |
| 95 | + cmakeVersion: 3.22.6 |
| 96 | + |
| 97 | + - name: Install apt packages |
| 98 | + uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 |
| 99 | + with: |
| 100 | + packages: libasio-dev libtinyxml2-dev libssl-dev swig ${{ inputs.java-version }} |
| 101 | + |
| 102 | + - name: Configure Java to ${{ inputs.java-version }} |
| 103 | + shell: bash |
| 104 | + run: | |
| 105 | + jv=$(echo ${{ inputs.java-version }} | sed -r 's/.*-([0-9]*)-.*/\1/g'); jvs=$(update-alternatives --list java | grep "$jv" | head -1); sudo update-alternatives --set java "$jvs" |
| 106 | + jv=$(echo ${{ inputs.java-version }} | sed -r 's/.*-([0-9]*)-.*/\1/g'); jvs=$(update-alternatives --list javac | grep "$jv" | head -1); sudo update-alternatives --set javac "$jvs" |
| 107 | +
|
| 108 | + - name: Install colcon |
| 109 | + uses: eProsima/eProsima-CI/multiplatform/install_colcon@v0 |
| 110 | + |
| 111 | + - name: Install Python dependencies |
| 112 | + uses: eProsima/eProsima-CI/multiplatform/install_python_packages@v0 |
| 113 | + with: |
| 114 | + packages: vcstool xmlschema xmltodict==0.13.0 jsondiff==2.0.0 pandas==1.5.2 |
| 115 | + upgrade: false |
| 116 | + |
| 117 | + - name: Setup CCache |
| 118 | + uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 |
| 119 | + if: ${{ inputs.use-ccache == true }} |
| 120 | + with: |
| 121 | + api_token: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + |
| 123 | + - name: Get Fast DDS branch |
| 124 | + id: get_fastdds_branch |
| 125 | + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 |
| 126 | + with: |
| 127 | + remote_repository: eProsima/Fast-DDS |
| 128 | + fallback_branch: ${{ inputs.fastdds-branch }} |
| 129 | + |
| 130 | + - name: Get Fast CDR branch |
| 131 | + id: get_fastcdr_branch |
| 132 | + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 |
| 133 | + with: |
| 134 | + remote_repository: eProsima/Fast-CDR |
| 135 | + fallback_branch: ${{ inputs.fastcdr-branch }} |
| 136 | + |
| 137 | + - name: Get Fast DDS Python branch |
| 138 | + id: get_fastdds_python_branch |
| 139 | + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 |
| 140 | + with: |
| 141 | + remote_repository: eProsima/Fast-DDS-python |
| 142 | + fallback_branch: ${{ inputs.fastdds-python-branch }} |
| 143 | + |
| 144 | + - name: Get Discovery Server branch |
| 145 | + id: get_discovery_server_branch |
| 146 | + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 |
| 147 | + with: |
| 148 | + remote_repository: eProsima/Discovery-Server |
| 149 | + fallback_branch: ${{ inputs.discovery-server-branch }} |
| 150 | + |
| 151 | + - name: Download Fast CDR, Fast DDS Python, and Discovery Server |
| 152 | + run: | |
| 153 | + cd src |
| 154 | + git clone -b ${{ steps.get_fastcdr_branch.outputs.deduced_branch }} https://github.com/eProsima/Fast-CDR.git fastcdr |
| 155 | + git clone -b ${{ steps.get_fastdds_python_branch.outputs.deduced_branch }} https://github.com/eProsima/Fast-DDS-python.git fastdds_python |
| 156 | + git clone -b ${{ steps.get_discovery_server_branch.outputs.deduced_branch }} https://github.com/eProsima/Discovery-Server.git discovery_server |
| 157 | + cd .. |
| 158 | + shell: bash |
| 159 | + |
| 160 | + - name: Download Fast DDS repo |
| 161 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 162 | + with: |
| 163 | + repository: eProsima/Fast-DDS |
| 164 | + path: ${{ github.workspace }}/src/fastrtps |
| 165 | + ref: ${{ steps.get_fastdds_branch.outputs.deduced_branch }} |
| 166 | + |
| 167 | + - name: Fetch Fast DDS dependencies |
| 168 | + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 |
| 169 | + with: |
| 170 | + vcs_repos_file: ${{ github.workspace }}/src/fastrtps/fastrtps.repos |
| 171 | + destination_workspace: src |
| 172 | + skip_existing: 'true' |
| 173 | + |
| 174 | + - name: Build fastddsgen |
| 175 | + run: | |
| 176 | + cd ${{ github.workspace }}/src/fastddsgen |
| 177 | + ./gradlew assemble |
| 178 | + echo "$(pwd)/scripts" >> ${{ github.path }} |
| 179 | +
|
| 180 | + - name: Regenerate IDL files for Fast DDS, Fast DDS Python, and Discovery Server |
| 181 | + run: | |
| 182 | + cd ${{ github.workspace }}/src/fastrtps |
| 183 | + ./utils/scripts/update_generated_code_from_idl.sh |
| 184 | + cd - |
| 185 | +
|
| 186 | + cd ${{ github.workspace }}/src/fastdds_python |
| 187 | + ./utils/scripts/update_generated_code_from_idl.sh |
| 188 | + cd - |
| 189 | +
|
| 190 | + cd ${{ github.workspace }}/src/discovery_server |
| 191 | + ./utils/scripts/update_generated_code_from_idl.sh cdr-both |
| 192 | + cd - |
| 193 | +
|
| 194 | + - name: Fetch Fast DDS Gen CI dependencies |
| 195 | + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 |
| 196 | + if: ${{ inputs.run-tests == true }} |
| 197 | + with: |
| 198 | + vcs_repos_file: ${{ github.workspace }}/src/fastddsgen/.github/workflows/config/test.repos |
| 199 | + destination_workspace: src |
| 200 | + skip_existing: 'true' |
| 201 | + |
| 202 | + - name: Colcon build |
| 203 | + continue-on-error: false |
| 204 | + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 |
| 205 | + with: |
| 206 | + colcon_meta_file: ${{ github.workspace }}/src/fastddsgen/.github/workflows/config/build.meta |
| 207 | + colcon_build_args_default: '--event-handlers=console_direct+' |
| 208 | + cmake_build_type: ${{ matrix.cmake-build-type }} |
| 209 | + workspace: ${{ github.workspace }} |
| 210 | + |
| 211 | + - name: Test fastddsgen |
| 212 | + if: ${{ inputs.run-tests == true }} |
| 213 | + run: | |
| 214 | + source ${{ github.workspace }}/install/local_setup.bash |
| 215 | + cd ${{ github.workspace }}/src/fastddsgen |
| 216 | + ./gradlew test ${{ env.cdr-test-flag }} |
0 commit comments