Skip to content

Commit

Permalink
Improve CI workflows in master (#216)
Browse files Browse the repository at this point in the history
* Refs #21286: Add Ubuntu CI

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

* Refs #21286: Add Windows CI

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

* Refs #21286: Add MacOS CI

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

* Refs #21286: Remove previous job

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

* Refs #21286: Update PR template

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

* Refs #21286: Add missing dependency

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

* Refs #21286: Fix colcon test warning

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

* Refs #21286: Add RELEASE_SUPPORT.md

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

* Refs #21286: Apply rev suggestions

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

* Refs #21286: Fix labels

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

* Refs #21286: Try to fix windows CI

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

* Refs #21286: Include GitHub CI badges in readme

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

---------

Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
(cherry picked from commit 203725d)
  • Loading branch information
JesusPoderoso committed Jul 11, 2024
1 parent d0b09bd commit d1031ee
Show file tree
Hide file tree
Showing 10 changed files with 435 additions and 3 deletions.
50 changes: 50 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- 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.
-->

## 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 2.2.x 2.1.x 1.1.x 1.0.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 code follows the style guidelines of this project. <!-- Please refer to the [Quality Declaration](https://github.com/eProsima/Fast-CDR/blob/master/QUALITY.md#linters-and-static-analysis-4v) for more information. -->
- [ ] Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally <!-- Blackbox tests checking the new functionality are required. Changes that add/modify public API must include unit tests covering all possible cases. In case that no tests are provided, please justify why. -->
- [ ] Any new/modified methods have been properly documented using Doxygen. <!-- Even internal classes, and private methods and members should be documented, not only the public API. -->
- [ ] Changes are backport compatible: they do **NOT** break ABI nor change library core behavior. <!-- Bug fixes should be ABI compatible if possible so a backport to previous affected releases can be made. -->
- [ ] Changes are API compatible. <!-- Public API must not be broken within the same major release. -->
- [ ] New feature has been added to the `versions.md` file (if applicable).
- [ ] 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: CI pass and failing tests are unrelated with the changes.
10 changes: 10 additions & 0 deletions .github/workflows/config/build.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
names:
fastcdr:
cmake-args:
- "-DBUILD_TESTING=ON"
googletest-distribution:
cmake-args:
- "-Dgtest_force_shared_crt=ON"
- "-DBUILD_SHARED_LIBS=ON"
- "-DBUILD_GMOCK=ON"

7 changes: 7 additions & 0 deletions .github/workflows/config/test.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
names:
fastcdr:
ctest-args: [
"--repeat", "until-pass:3",
"--timeout", "300",
"--output-junit", "junit/junit.xml"
]
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
59 changes: 59 additions & 0 deletions .github/workflows/mac-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Fast CDR Mac CI

on:
workflow_dispatch:
inputs:
os-version:
description: 'OS version to run the workflow'
required: false
default: 'macos-13'
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
fastcdr-branch:
description: 'Branch or tag of Fast CDR repository'
type: string
required: true
run-tests:
description: 'Run test suite of Fast CDR'
required: false
type: boolean
default: true

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:
mac-ci:
if: ${{ !(github.event_name == 'pull_request') || !contains(github.event.pull_request.labels.*.name, 'conflicts') }}
uses: ./.github/workflows/reusable-ci.yml
with:
# It would be desirable to have a matrix of macos 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 || 'macos-13' }}
label: ${{ format('mac-ci-{0}', inputs.fastcdr-branch || github.ref) }}
colcon-args: ${{ inputs.colcon-args }}
cmake-args: ${{ inputs.cmake-args }}
ctest-args: ${{ inputs.ctest-args }}
fastcdr-branch: ${{ inputs.fastcdr-branch || github.ref }}
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'))) }}
159 changes: 159 additions & 0 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Fast CDR reusable CI workflow

on:
workflow_call:
inputs:
os-version:
description: 'The OS image for the workflow'
required: false
default: 'ubuntu-22.04'
type: string
vs-toolset:
description: 'Windows Visual Studio toolset to use (only Windows)'
required: false
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
fastcdr-branch:
description: 'Branch or tag of Fast CDR repository'
required: true
type: string
run-build:
description: 'Build Fast CDR (CI skipped otherwise)'
required: false
type: boolean
default: true
run-tests:
description: 'Run test suite of Fast CDR'
required: false
type: boolean
default: true
use-ccache:
description: 'Use CCache to speed up the build'
required: false
type: boolean
default: false
env:
toolset: ${{ inputs.vs-toolset && format('-T {0}', inputs.vs-toolset) || '' }}
test-meta: ${{ inputs.os-version == 'windows-2019' && format('{0}/src/fastcdr/.github/workflows/config/build_test.meta', github.workspace) || format('{0}/src/fastcdr/.github/workflows/config/build.meta {0}/src/fastcdr/.github/workflows/config/test.meta', github.workspace) }}
defaults:
run:
shell: bash

jobs:
fastcdr_test:
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/Fast-CDR

- name: Sync eProsima/Fast-CDR repository
uses: eProsima/eProsima-CI/external/checkout@v0
with:
path: src/fastcdr
ref: ${{ inputs.fastcdr-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 Colcon dependencies
uses: eProsima/eProsima-CI/multiplatform/install_colcon@v0

- name: Setup CCache
uses: eProsima/eProsima-CI/external/setup-ccache-action@v0
if: ${{ inputs.use-ccache == true }}
with:
api_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Python dependencies
uses: eProsima/eProsima-CI/multiplatform/install_python_packages@v0
with:
packages: vcstool
upgrade: false

- name: Fetch Fast DDS CI dependencies
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
with:
vcs_repos_file: ${{ github.workspace }}/src/fastcdr/.github/workflows/config/test.repos
destination_workspace: src
skip_existing: 'true'

- name: Colcon build
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
colcon_meta_file: ${{ github.workspace }}/src/fastcdr/.github/workflows/config/build.meta
colcon_build_args: ${{ inputs.colcon-args }}
colcon_build_args_default: --event-handlers=console_direct+
cmake_args: ${{ inputs.cmake-args }}
cmake_args_default: ${{ env.toolset }}
cmake_build_type: ${{ matrix.cmake-build-type }}
workspace: ${{ github.workspace }}

- name: Prepare build test meta file
if: ${{ inputs.run-tests == true && inputs.os-version == 'windows-2019' }}
uses: eProsima/eProsima-CI/windows/merge_yaml_metas@v0
with:
metas: "@('${{ github.workspace }}/src/fastcdr/.github/workflows/config/build.meta', '${{ github.workspace }}/src/fastcdr/.github/workflows/config/test.meta')"
path: '${{ github.workspace }}/src/fastcdr/.github/workflows/config/build_test.meta'

- name: Colcon test
id: test_fastcdr
if: ${{ inputs.run-tests == true }}
uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0
with:
colcon_meta_file: ${{ env.test-meta }}
colcon_test_args_default: --event-handlers=console_direct+
ctest_args: ${{ inputs.ctest-args }}
packages_names: fastcdr
workspace: ${{ github.workspace }}
test_report_artifact: ${{ inputs.label }}

- name: Fast CDR Test summary
uses: eProsima/eProsima-CI/multiplatform/junit_summary@v0
if: ${{ !cancelled() && inputs.run-tests == true }}
with:
junit_reports_dir: ${{ steps.test_fastcdr.outputs.ctest_results_path }}
print_summary: 'True'
show_failed: 'True'
show_disabled: 'False'
show_skipped: 'False'

- name: Archive Test Results
if: always()
uses: eProsima/eProsima-CI/external/upload-artifact@v0
with:
name: test-results-${{ inputs.label }}
path: log/latest_test/fastcdr
65 changes: 65 additions & 0 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Fast CDR Ubuntu CI

on:
workflow_dispatch:
inputs:
os-version:
description: 'OS version to run the workflow'
required: false
default: 'ubuntu-20.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
fastcdr-branch:
description: 'Branch or tag of Fast CDR repository'
type: string
required: true
run-tests:
description: 'Run test suite of Fast CDR'
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-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-20.04' }}
label: ${{ format('ubuntu-ci-{0}', inputs.fastcdr-branch || github.ref) }}
colcon-args: ${{ inputs.colcon-args }}
cmake-args: ${{ inputs.cmake-args }}
ctest-args: ${{ inputs.ctest-args }}
fastcdr-branch: ${{ inputs.fastcdr-branch || github.ref }}
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 }}
Loading

0 comments on commit d1031ee

Please sign in to comment.