|
| 1 | +name: downstream-ci |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + custom_version_build: |
| 7 | + description: 'Fast DDS build version from eProsima-CI.' |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + default: 'v3' |
| 11 | + options: |
| 12 | + - custom |
| 13 | + - v2 |
| 14 | + - v3 |
| 15 | + dependencies_artifact_postfix: |
| 16 | + description: 'Postfix to download a specific dependencies artifact from eProsima-CI.' |
| 17 | + required: true |
| 18 | + default: '_nightly' |
| 19 | + downstream_ref: |
| 20 | + description: 'Branch or tag to checkout on every downstream tool.' |
| 21 | + required: true |
| 22 | + default: 'main' |
| 23 | + pull_request: |
| 24 | + push: |
| 25 | + branches: |
| 26 | + - main |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: downstream-ci-${{ github.workflow }}-${{ github.ref }} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +jobs: |
| 33 | + |
| 34 | + downstream-tests: |
| 35 | + name: ${{ matrix.tool.name }}-${{ matrix.os }}-${{ matrix.cmake_build_type }} |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + os: |
| 41 | + - ubuntu-22.04 |
| 42 | + - ubuntu-24.04 |
| 43 | + - windows-2022 |
| 44 | + cmake_build_type: |
| 45 | + - Release |
| 46 | + - Debug |
| 47 | + tool: |
| 48 | + - name: ddsrouter |
| 49 | + repository: eProsima/DDS-Router |
| 50 | + packages: 'ddsrouter_core ddsrouter_yaml ddsrouter_tool' |
| 51 | + - name: ddsrecordreplay |
| 52 | + repository: eProsima/DDS-Record-Replay |
| 53 | + packages: 'ddsrecorder_participants ddsrecorder_yaml ddsrecorder_tool ddsreplayer_tool' |
| 54 | + - name: fastddsspy |
| 55 | + repository: eProsima/Fast-DDS-Spy |
| 56 | + packages: 'fastddsspy_participants fastddsspy_yaml fastddsspy_tool' |
| 57 | + - name: ddsenabler |
| 58 | + repository: eProsima/DDS-Enabler |
| 59 | + packages: 'ddsenabler ddsenabler_yaml ddsenabler_participants' |
| 60 | + |
| 61 | + steps: |
| 62 | + |
| 63 | + # Checkout DDS Pipe at the ref that triggered this workflow (the PR / branch under test) |
| 64 | + - name: Checkout DDS Pipe (under test) |
| 65 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 66 | + with: |
| 67 | + path: src/ddspipe |
| 68 | + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref_name }} |
| 69 | + |
| 70 | + # For DDS Pipe PRs, try the same branch name in each downstream repository and |
| 71 | + # fall back to main when that branch does not exist |
| 72 | + - name: Resolve downstream ref |
| 73 | + id: resolve_downstream_ref |
| 74 | + uses: actions/github-script@v7 |
| 75 | + env: |
| 76 | + TOOL_REPOSITORY: ${{ matrix.tool.repository }} |
| 77 | + WORKFLOW_DISPATCH_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.downstream_ref || '' }} |
| 78 | + FALLBACK_REF: main |
| 79 | + with: |
| 80 | + script: | |
| 81 | + const [owner, repo] = process.env.TOOL_REPOSITORY.split('/'); |
| 82 | + const eventName = context.eventName; |
| 83 | + const fallbackRef = process.env.FALLBACK_REF; |
| 84 | +
|
| 85 | + if (eventName === 'workflow_dispatch') { |
| 86 | + const ref = process.env.WORKFLOW_DISPATCH_REF || fallbackRef; |
| 87 | + core.info(`Using manually requested downstream ref '${ref}' for ${owner}/${repo}`); |
| 88 | + core.setOutput('ref', ref); |
| 89 | + return; |
| 90 | + } |
| 91 | +
|
| 92 | + if (eventName !== 'pull_request') { |
| 93 | + const ref = context.ref.replace('refs/heads/', ''); |
| 94 | + core.info(`Using workflow branch '${ref}' for ${owner}/${repo}`); |
| 95 | + core.setOutput('ref', ref); |
| 96 | + return; |
| 97 | + } |
| 98 | +
|
| 99 | + const relatedRef = context.payload.pull_request.head.ref; |
| 100 | +
|
| 101 | + try { |
| 102 | + await github.rest.repos.getBranch({ |
| 103 | + owner, |
| 104 | + repo, |
| 105 | + branch: relatedRef, |
| 106 | + }); |
| 107 | +
|
| 108 | + core.info(`Using related downstream ref '${relatedRef}' for ${owner}/${repo}`); |
| 109 | + core.setOutput('ref', relatedRef); |
| 110 | + } catch (error) { |
| 111 | + if (error.status !== 404) { |
| 112 | + throw error; |
| 113 | + } |
| 114 | +
|
| 115 | + core.info( |
| 116 | + `Branch '${relatedRef}' not found in ${owner}/${repo}; falling back to '${fallbackRef}'` |
| 117 | + ); |
| 118 | + core.setOutput('ref', fallbackRef); |
| 119 | + } |
| 120 | +
|
| 121 | + # Checkout the downstream tool that consumes DDS Pipe |
| 122 | + - name: Checkout downstream tool |
| 123 | + uses: eProsima/eProsima-CI/external/checkout@v0 |
| 124 | + with: |
| 125 | + repository: ${{ matrix.tool.repository }} |
| 126 | + path: src/${{ matrix.tool.name }} |
| 127 | + ref: ${{ steps.resolve_downstream_ref.outputs.ref }} |
| 128 | + |
| 129 | + - name: Install Fast DDS dependencies |
| 130 | + uses: eProsima/eProsima-CI/multiplatform/install_fastdds_dependencies@v0 |
| 131 | + with: |
| 132 | + cmake_build_type: ${{ matrix.cmake_build_type }} |
| 133 | + |
| 134 | + - name: Install yaml cpp dependency |
| 135 | + uses: eProsima/eProsima-CI/multiplatform/install_yamlcpp@v0 |
| 136 | + with: |
| 137 | + cmake_build_type: ${{ matrix.cmake_build_type }} |
| 138 | + |
| 139 | + # DDS Record Replay needs lz4 and zstd for MCAP compression (installed via |
| 140 | + # apt on Linux and vcpkg on Windows). No other downstream tool requires them. |
| 141 | + - name: Install MCAP dependencies (lz4, zstd) |
| 142 | + if: matrix.tool.name == 'ddsrecordreplay' |
| 143 | + uses: ./src/ddsrecordreplay/.github/actions/install_mcap_dependencies |
| 144 | + with: |
| 145 | + cmake_build_type: ${{ matrix.cmake_build_type }} |
| 146 | + |
| 147 | + # On Windows the mcap action installs lz4/zstd through vcpkg; expose that |
| 148 | + # prefix so CMake's find_package(lz4)/find_package(zstd) can locate them. |
| 149 | + - name: Expose vcpkg packages to CMake (Windows) |
| 150 | + if: matrix.tool.name == 'ddsrecordreplay' && runner.os == 'Windows' |
| 151 | + shell: pwsh |
| 152 | + run: | |
| 153 | + "CMAKE_PREFIX_PATH=$env:vcpkg_install_path;$env:CMAKE_PREFIX_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append |
| 154 | +
|
| 155 | + # Prebuilt Fast DDS + dev-utils. DDS Pipe itself is built from source (checked out above), |
| 156 | + # so this run reflects the DDS Pipe changes, not the nightly artifact |
| 157 | + - name: Download Fast DDS + dev-utils artifact |
| 158 | + uses: eProsima/eProsima-CI/multiplatform/download_dependency@v0 |
| 159 | + with: |
| 160 | + artifact_name: build_dev_utils_${{ inputs.custom_version_build || 'v3' }}_${{ matrix.os }}_${{ matrix.cmake_build_type }}${{ inputs.dependencies_artifact_postfix || '_nightly' }} |
| 161 | + workflow_source: build_dev_utils.yml |
| 162 | + workflow_source_repository: eProsima/eProsima-CI |
| 163 | + target_workspace: ${{ github.workspace }}/install |
| 164 | + secret_token: ${{ secrets.GITHUB_TOKEN }} |
| 165 | + workflow_conclusion: completed |
| 166 | + |
| 167 | + # Build DDS Pipe (from source) as a dependency of the downstream tool, but only |
| 168 | + # execute the downstream tool test suites in this workflow |
| 169 | + - name: Compile and run downstream tests |
| 170 | + id: compile_and_test |
| 171 | + uses: eProsima/eProsima-CI/multiplatform/colcon_build_test@v0 |
| 172 | + with: |
| 173 | + packages_names: ${{ matrix.tool.packages }} |
| 174 | + workspace_dependencies: install |
| 175 | + cmake_args: -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} |
| 176 | + ctest_args: --label-exclude "xfail" |
| 177 | + colcon_meta_file: src/ddspipe/.github/workflows/configurations/${{ runner.os }}/colcon.meta |
| 178 | + test_report_artifact: test_report_downstream_${{ matrix.tool.name }}_${{ matrix.os }}_${{ matrix.cmake_build_type }} |
| 179 | + |
| 180 | + - name: Test Report |
| 181 | + uses: eProsima/eProsima-CI/external/test-reporter@v0 |
| 182 | + if: success() || failure() |
| 183 | + with: |
| 184 | + name: "Downstream: ${{ matrix.tool.name }} | ${{ matrix.os }} | ${{ matrix.cmake_build_type }}" |
| 185 | + path: "${{ steps.compile_and_test.outputs.ctest_results_path }}*.xml" |
| 186 | + working-directory: 'src/ddspipe' |
| 187 | + path-replace-backslashes: ${{ runner.os == 'Windows' && 'true' || 'false' }} |
| 188 | + list-tests: 'failed' |
| 189 | + list-suites: 'failed' |
0 commit comments