Skip to content

Commit

Permalink
Migrate Discovery Server CI to Github (#90) (#91)
Browse files Browse the repository at this point in the history
* Refs #21230: Migrate Discovery Server CI to Github

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

* Refs #21230: Add RELEASE_SUPPORT.md file

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

* Refs #21230: Add missing flaxy test arg

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

* Refs #21230:  Introduce improvements from similar PR reviews

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

* Refs #21230: Apply rev suggestions

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

* Refs #21230: Add missing CI checks in PR template

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>

---------

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
(cherry picked from commit c323886)

Co-authored-by: Jesús Poderoso <120394830+JesusPoderoso@users.noreply.github.com>
  • Loading branch information
mergify[bot] and JesusPoderoso committed Jul 24, 2024
1 parent d434694 commit af53dd2
Show file tree
Hide file tree
Showing 7 changed files with 385 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- Provide a general summary of your changes in the Title above -->
<!-- It must be meaningful and coherent with the changes -->

<!--
If this PR is still a Work in Progress [WIP], please open it as DRAFT.
Please consider if any label should be added to this PR.
If no code has been changed, please add `skip-ci` label.
If opening the PR as Draft, please consider adding `no-test` label to only build the code but not run CI.
If documentation PR is still pending, please add `doc-pending` label.
-->

## Description

<!--
Describe changes in detail.
This includes depicting the context, use case or current behavior and describe the proposed changes.
If several features/bug fixes are included with these changes, please consider opening separated pull requests.
-->

<!--
In case of bug fixes, please provide the list of supported branches where this fix should be also merged.
Please uncomment following line, adjusting the corresponding target branches for the backport.
-->
<!-- @Mergifyio backport 1.2.x -->

<!-- If an issue is already opened, please uncomment next line with the corresponding issue number. -->
<!-- Fixes #(issue) -->

<!-- In case the changes are built over a previous pull request, please uncomment next line. -->
<!-- This PR depends on #(PR) and must be merged after that one. -->

## Contributor Checklist

<!--
- If any of the elements of the following checklist is not applicable, substitute the checkbox [ ] by _N/A_:
- If any of the elements of the following checklist is not fulfilled on purpose, please provide a reason and substitute the checkbox [ ] with ❌: or __NO__:.
-->

- [ ] Commit messages follow the project guidelines. <!-- External contributors should sign the DCO. Fast DDS developers must also refer to the internal Redmine task. -->
- [ ] The added tests pass locally.
- [ ] Changes are backwards compatible. <!-- Bug fixes should be ABI compatible if possible so a backport to previous affected releases can be made. -->
- [ ] 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.
5 changes: 5 additions & 0 deletions .github/workflows/config/build.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
names:
fastrtps:
cmake-args:
- "-DNO_TLS=ON"
- "-DSECURITY=OFF"
11 changes: 11 additions & 0 deletions .github/workflows/config/test.meta
Original file line number Diff line number Diff line change
@@ -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"
]
5 changes: 5 additions & 0 deletions .github/workflows/config/test.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
googletest-distribution:
type: git
url: https://github.com/google/googletest.git
version: release-1.11.0
237 changes: 237 additions & 0 deletions .github/workflows/reusable-ubuntu-ci.yml
Original file line number Diff line number Diff line change
@@ -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'
70 changes: 70 additions & 0 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 6 additions & 0 deletions RELEASE_SUPPORT.md
Original file line number Diff line number Diff line change
@@ -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).

0 comments on commit af53dd2

Please sign in to comment.