From 61ae162136e5dd47d8249d9d14daad2e320a0ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Poderoso?= <120394830+JesusPoderoso@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:08:07 +0200 Subject: [PATCH] Migrate Discovery Server CI to Github (#90) * Refs #21230: Migrate Discovery Server CI to Github Signed-off-by: JesusPoderoso * Refs #21230: Add RELEASE_SUPPORT.md file Signed-off-by: JesusPoderoso * Refs #21230: Add missing flaxy test arg Signed-off-by: JesusPoderoso * Refs #21230: Introduce improvements from similar PR reviews Signed-off-by: JesusPoderoso * Refs #21230: Apply rev suggestions Signed-off-by: JesusPoderoso * Refs #21230: Add missing CI checks in PR template Signed-off-by: JesusPoderoso --------- Signed-off-by: JesusPoderoso (cherry picked from commit c32388609c023717d1aff0eb58db8c27aee0d387) --- .github/pull_request_template.md | 51 +++++ .github/workflows/config/build.meta | 5 + .github/workflows/config/test.meta | 11 ++ .github/workflows/config/test.repos | 5 + .github/workflows/reusable-ubuntu-ci.yml | 237 +++++++++++++++++++++++ .github/workflows/ubuntu-ci.yml | 70 +++++++ RELEASE_SUPPORT.md | 6 + 7 files changed, 385 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/config/build.meta create mode 100644 .github/workflows/config/test.meta create mode 100644 .github/workflows/config/test.repos create mode 100644 .github/workflows/reusable-ubuntu-ci.yml create mode 100644 .github/workflows/ubuntu-ci.yml create mode 100644 RELEASE_SUPPORT.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..4e34f6e5 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,51 @@ + + + + + +## Description + + + + + + + + + + + + +## Contributor Checklist + + + +- [ ] Commit messages follow the project guidelines. +- [ ] The added tests pass locally. +- [ ] Changes are backwards compatible. +- [ ] New feature has been documented/Current behavior is correctly described in the documentation. +- [ ] Applicable backports have been included in the description. + +## Reviewer Checklist + +- [ ] The PR has a milestone assigned. +- [ ] The title and description correctly express the PR's purpose. +- [ ] Check contributor checklist is correct. +- [ ] Check CI results: changes do not issue any warning. +- [ ] Check CI results: failing tests are unrelated with the changes. diff --git a/.github/workflows/config/build.meta b/.github/workflows/config/build.meta new file mode 100644 index 00000000..20c8b5e5 --- /dev/null +++ b/.github/workflows/config/build.meta @@ -0,0 +1,5 @@ +names: + fastrtps: + cmake-args: + - "-DNO_TLS=ON" + - "-DSECURITY=OFF" diff --git a/.github/workflows/config/test.meta b/.github/workflows/config/test.meta new file mode 100644 index 00000000..89f8955e --- /dev/null +++ b/.github/workflows/config/test.meta @@ -0,0 +1,11 @@ +names: + fastrtps: + cmake-args: + - "-DCOMPILE_TOOLS=ON" + - "-DINSTALL_TOOLS=ON" + discovery-server: + ctest-args: [ + "--repeat", "until-pass:3", + "--timeout", "300", + "--label-exclude", "xfail" + ] diff --git a/.github/workflows/config/test.repos b/.github/workflows/config/test.repos new file mode 100644 index 00000000..5052ee82 --- /dev/null +++ b/.github/workflows/config/test.repos @@ -0,0 +1,5 @@ +repositories: + googletest-distribution: + type: git + url: https://github.com/google/googletest.git + version: release-1.11.0 diff --git a/.github/workflows/reusable-ubuntu-ci.yml b/.github/workflows/reusable-ubuntu-ci.yml new file mode 100644 index 00000000..2a6c6e93 --- /dev/null +++ b/.github/workflows/reusable-ubuntu-ci.yml @@ -0,0 +1,237 @@ +name: Fast DDS Discovery Server Ubuntu CI reusable workflow + +on: + workflow_call: + inputs: + os-version: + description: 'The OS image for the workflow' + required: false + default: 'ubuntu-22.04' + type: string + label: + description: 'ID associated to the workflow' + required: true + type: string + colcon-args: + description: 'Extra arguments for colcon cli' + required: false + type: string + cmake-args: + description: 'Extra arguments for cmake cli' + required: false + type: string + ctest-args: + description: 'Extra arguments for ctest cli' + required: false + type: string + discovery-server-branch: + description: 'Branch or tag of Discovery Server repository' + required: true + type: string + fastdds-branch: + description: 'Branch or tag of Fast DDS repository' + required: true + type: string + run-build: + description: 'Build Fast DDS Discovery Server (CI skipped otherwise)' + required: false + type: boolean + default: true + run-tests: + description: 'Run test suite of Fast DDS Discovery Server' + required: false + type: boolean + default: true + use-ccache: + description: 'Use CCache to speed up the build' + required: false + type: boolean + default: false +env: + colcon-build-default-cmake-args: '-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-value -Woverloaded-virtual"' +defaults: + run: + shell: bash + +jobs: + discovery_server_build: + runs-on: ${{ inputs.os-version }} + if: ${{ inputs.run-build == true }} + strategy: + fail-fast: false + matrix: + cmake-build-type: + - 'RelWithDebInfo' + steps: + - name: Add ci-pending label if PR + if: ${{ github.event_name == 'pull_request' }} + uses: eProsima/eProsima-CI/external/add_labels@v0 + with: + labels: ci-pending + number: ${{ github.event.number }} + repo: eProsima/Discovery-Server + + - name: Sync eProsima/Discovery-Server repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src/discovery_server + ref: ${{ inputs.discovery-server-branch }} + + - name: Install Fix Python version + uses: eProsima/eProsima-CI/external/setup-python@v0 + with: + python-version: '3.11' + + - name: Get minimum supported version of CMake + uses: eProsima/eProsima-CI/external/get-cmake@v0 + with: + cmakeVersion: '3.22.6' + + - name: Install apt dependencies + uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 + with: + packages: libasio-dev libtinyxml2-dev libssl-dev + update: false + upgrade: false + + - name: Install colcon + uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 + + - name: Install Python dependencies + uses: eProsima/eProsima-CI/multiplatform/install_python_packages@v0 + with: + packages: vcstool xmlschema xmltodict==0.13.0 jsondiff==2.0.0 pandas==1.5.2 + upgrade: false + + - name: Setup CCache + uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 + if: ${{ inputs.use-ccache == true }} + with: + api_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get Fast DDS branch + id: get_fastdds_branch + uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 + with: + remote_repository: eProsima/Fast-DDS + fallback_branch: ${{ inputs.fastdds-branch }} + + - name: Download Fast DDS repo + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + repository: eProsima/Fast-DDS + path: src/fastrtps + ref: ${{ steps.get_fastdds_branch.outputs.deduced_branch }} + + - name: Fetch Fast DDS dependencies + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 + with: + vcs_repos_file: ${{ github.workspace }}/src/fastrtps/fastrtps.repos + destination_workspace: src + skip_existing: 'true' + + - name: Colcon build + continue-on-error: false + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 + with: + colcon_meta_file: ${{ github.workspace }}/src/discovery_server/.github/workflows/config/build.meta + colcon_build_args: ${{ inputs.colcon-args }} + cmake_args: ${{ inputs.cmake-args }} + cmake_args_default: ${{ env.colcon-build-default-cmake-args }} + cmake_build_type: ${{ matrix.cmake-build-type }} + workspace: ${{ github.workspace }} + + - name: Upload build artifacts + uses: eProsima/eProsima-CI/external/upload-artifact@v0 + with: + name: discovery_server_build_${{ inputs.label }} + path: ${{ github.workspace }} + + discovery_server_tests: + needs: discovery_server_build + runs-on: ${{ inputs.os-version }} + strategy: + fail-fast: false + matrix: + cmake-build-type: + - 'RelWithDebInfo' + steps: + - name: Download build artifacts + uses: eProsima/eProsima-CI/external/download-artifact@v0 + with: + name: discovery_server_build_${{ inputs.label }} + path: ${{ github.workspace }} + + - name: Install Fix Python version + uses: eProsima/eProsima-CI/external/setup-python@v0 + with: + python-version: '3.11' + + - name: Get minimum supported version of CMake + uses: eProsima/eProsima-CI/external/get-cmake@v0 + with: + cmakeVersion: '3.22.6' + + - name: Install apt dependencies + uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 + with: + packages: libasio-dev libtinyxml2-dev libssl-dev + update: false + upgrade: false + + - name: Install colcon + uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 + + - name: Install Python dependencies + uses: eProsima/eProsima-CI/multiplatform/install_python_packages@v0 + with: + packages: vcstool xmlschema xmltodict==0.13.0 jsondiff==2.0.0 pandas==1.5.2 + upgrade: false + + - name: Setup CCache + uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 + if: ${{ inputs.use-ccache == true }} + with: + api_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Fetch Fast DDS CI dependencies + uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 + with: + vcs_repos_file: ${{ github.workspace }}/src/discovery_server/.github/workflows/config/test.repos + destination_workspace: src + skip_existing: 'true' + + - name: Colcon build + continue-on-error: false + uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0 + with: + colcon_meta_file: ${{ github.workspace }}/src/discovery_server/.github/workflows/config/build.meta ${{ github.workspace }}/src/discovery_server/.github/workflows/config/test.meta + colcon_build_args: ${{ inputs.colcon-args }} + cmake_args: ${{ inputs.cmake-args }} + cmake_args_default: ${{ env.colcon-build-default-cmake-args }} + cmake_build_type: ${{ matrix.cmake-build-type }} + workspace: ${{ github.workspace }} + + - name: Colcon test + id: discovery_server_test + if: ${{ inputs.run-tests == true }} + uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0 + with: + colcon_meta_file: ${{ github.workspace }}/src/discovery_server/.github/workflows/config/test.meta + colcon_test_args: ${{ inputs.colcon-args }} + colcon_test_args_default: --event-handlers=console_direct+ + ctest_args: ${{ inputs.ctest-args }} + packages_names: discovery-server + workspace: ${{ github.workspace }} + workspace_dependencies: '' + test_report_artifact: ${{ format('test_report_{0}_{1}_{2}', inputs.label, github.job, join(matrix.*, '_')) }} + + - name: Test summary + uses: eProsima/eProsima-CI/multiplatform/junit_summary@v0 + if: ${{ !cancelled() && inputs.run-tests == true }} + with: + junit_reports_dir: "${{ steps.discovery_server_test.outputs.ctest_results_path }}" + print_summary: 'True' + show_failed: 'True' + show_disabled: 'False' + show_skipped: 'False' diff --git a/.github/workflows/ubuntu-ci.yml b/.github/workflows/ubuntu-ci.yml new file mode 100644 index 00000000..c4690613 --- /dev/null +++ b/.github/workflows/ubuntu-ci.yml @@ -0,0 +1,70 @@ +name: Fast DDS Discovery Server Ubuntu CI + +on: + workflow_dispatch: + inputs: + os-version: + description: 'OS version to run the workflow' + required: false + default: 'ubuntu-22.04' + type: string + colcon-args: + description: 'Extra arguments for colcon cli' + required: false + type: string + cmake-args: + description: 'Extra arguments for cmake cli' + required: false + type: string + ctest-args: + description: 'Extra arguments for ctest cli' + required: false + type: string + discovery-server-branch: + description: 'Branch or tag of Discovery Server repository' + type: string + required: true + fastdds-branch: + description: 'Branch or tag of Fast DDS repository' + type: string + required: true + run-tests: + description: 'Run test suite of Fast DDS Discovery Server' + required: false + type: boolean + default: true + use-ccache: + description: 'Use CCache to speed up the build' + required: false + type: boolean + default: false + + pull_request: + types: + - review_requested + paths-ignore: + - '**.md' + - '**.txt' + - '!**/CMakeLists.txt' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + ubuntu-ci: + if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'conflicts') }} + uses: ./.github/workflows/reusable-ubuntu-ci.yml + with: + # It would be desirable to have a matrix of ubuntu OS for this job, but due to the issue opened in this ticket: + # https://github.com/orgs/community/discussions/128118 , it has been set as a single OS job. + os-version: ${{ inputs.os-version || 'ubuntu-22.04' }} + label: 'ubuntu-ci' + colcon-args: ${{ inputs.colcon-args }} + cmake-args: ${{ inputs.cmake-args }} + ctest-args: ${{ inputs.ctest-args || '-LE xfail' }} + discovery-server-branch: ${{ inputs.discovery-server-branch || github.ref }} + fastdds-branch: ${{ inputs.fastdds-branch || '2.x' }} + run-build: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} + run-tests: ${{ (inputs.run-tests == true) || ((github.event_name == 'pull_request') && (!contains(github.event.pull_request.labels.*.name, 'no-test'))) }} + use-ccache: ${{ inputs.use-ccache || false }} diff --git a/RELEASE_SUPPORT.md b/RELEASE_SUPPORT.md new file mode 100644 index 00000000..50fe3f69 --- /dev/null +++ b/RELEASE_SUPPORT.md @@ -0,0 +1,6 @@ +# Release support + + +Please, refer to the [master branch](https://github.com/eProsima/Discovery-Server/blob/master/RELEASE_SUPPORT.md) for the latest version of this document. + +For detailed information about the lifecycle of the different *Fast DDS* versions (and their corresponding counterpart in this repository), please refer to the [release support section of the Fast DDS repository](https://github.com/eProsima/Fast-DDS/blob/master/RELEASE_SUPPORT.md).