diff --git a/.github/actions/project_dependencies/action.yml b/.github/actions/project_dependencies/action.yml index e47de4fd..50a47d54 100644 --- a/.github/actions/project_dependencies/action.yml +++ b/.github/actions/project_dependencies/action.yml @@ -11,6 +11,13 @@ inputs: description: Specify cmake_build_type option to download specific artifact required: true + custom_version_build: + description: > + Use the custom version build from eProsima-CI. + If set to false, the workflow will run the tests for Fast DDS v2 and v3. + required: true + default: 'custom' + dependencies_artifact_postfix: description: Specify artifact postfix in case it wants to use a manual one required: false @@ -48,7 +55,7 @@ runs: - name: Download dependencies artifact uses: eProsima/eProsima-CI/multiplatform/download_dependency@v0 with: - artifact_name: built_ddspipe_${{ inputs.os }}_${{ inputs.cmake_build_type }}${{ inputs.dependencies_artifact_postfix }} + artifact_name: built_ddspipe_${{ inputs.custom_version_build }}_${{ inputs.os }}_${{ inputs.cmake_build_type }}${{ inputs.dependencies_artifact_postfix }} workflow_source: build_ddspipe.yml workflow_source_repository: eProsima/eProsima-CI target_workspace: ${{ inputs.target_workspace }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..5bff5b40 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,26 @@ +# Nightly test workflow for Fast DDS Spy +name: nightly + +on: + schedule: + - cron: '0 5 * * *' + +jobs: + + reusable_tests_v2: + name: reusable_tests_v2 + uses: ./.github/workflows/reusable-workflow.yml + with: + custom_version_build: 'v2' + dependencies_artifact_postfix: '_nightly' + secrets: inherit + + # Uncomment this block to run the tests for Fast DDS v3 when Fast DDS Spy is updated + # Also specify here (and above) the workflow version/branch to use (@v0, @main, etc.) + # reusable_tests_v3: + # name: reusable_tests_v3 + # uses: ./.github/workflows/reusable-workflow.yml + # with: + # custom_version_build: 'v3' + # dependencies_artifact_postfix: '_nightly' + # secrets: inherit diff --git a/.github/workflows/reusable-workflow.yml b/.github/workflows/reusable-workflow.yml new file mode 100644 index 00000000..173138d9 --- /dev/null +++ b/.github/workflows/reusable-workflow.yml @@ -0,0 +1,285 @@ +# Reusable workflow to run the following jobs: +# +# - multiplatform-tests +# - [ ubuntu-22.04 | ubuntu-20.04 | windows-2019 | windows-2022 ] +# - [ Debug | Release ] +# - execute tests in different versions of ubuntu with different build types +# +# - asan +# - ubuntu-22.04 +# - execute tests with ASAN flag +# +# - tsan +# - ubuntu-22.04 +# - execute tests with TSAN flag +# +# - clang +# - ubuntu-22.04 +# - execute clang-tidy check +# +# - coverage +# - ubuntu-22.04 +# - execute test with coverage flag and upload results +# +# - flaky +# - ubuntu-22.04 +# - execute flaky tests +# +# - uncrustify +# - ubuntu-22.04 +# - test uncrustify +# +# - python-linter +# - ubuntu-22.04 +# - test python linter +# + +name: reusable-workflow + +on: + + workflow_call: + inputs: + + custom_version_build: + description: > + Version of Fast DDS build from eProsima-CI. + required: true + type: string + + dependencies_artifact_postfix: + description: 'Postfix name to add to artifact name to download dependencies. This is use to download a specific artifact version from eProsima-CI.' + required: true + default: '_nightly' + type: string + +env: + code_packages_names: 'fastddsspy_participants fastddsspy_yaml fastddsspy_tool' + docs_packages_names: 'fastddsspy_docs' + +jobs: + + +##################################################################### +# MULTIPLATFORM TEST + + multiplatform-tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + cmake_build_type: + - Release + - Debug + os: + - ubuntu-20.04 + - ubuntu-22.04 + - windows-2019 + - windows-2022 + + steps: + + - name: Sync repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src + + - name: Download dependencies and install requirements + uses: ./src/.github/actions/project_dependencies + with: + os: ${{ matrix.os }} + cmake_build_type: ${{ matrix.cmake_build_type }} + custom_version_build: ${{ inputs.custom_version_build }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Compile and run tests + uses: eProsima/eProsima-CI/multiplatform/colcon_build_test@v0 + with: + packages_names: ${{ env.code_packages_names }} + cmake_args: -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} + workspace_dependencies: './install' + ctest_args: --label-exclude "xfail" + colcon_meta_file: ./src/.github/workflows/configurations/${{ runner.os }}/colcon.meta + + +##################################################################### +# ASAN + + asan: + runs-on: ubuntu-22.04 + steps: + + - name: Sync repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src + + - name: Download dependencies and install requirements + uses: ./src/.github/actions/project_dependencies + with: + os: ubuntu-22.04 + cmake_build_type: Release + custom_version_build: ${{ inputs.custom_version_build }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Compile and run tests + uses: eProsima/eProsima-CI/multiplatform/asan_build_test@v0 + with: + packages_names: ${{ env.code_packages_names }} + workspace_dependencies: './install' + + +##################################################################### +# TSAN + + tsan: + runs-on: ubuntu-22.04 + steps: + + - name: Sync repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src + + - name: Download dependencies and install requirements + uses: ./src/.github/actions/project_dependencies + with: + os: ubuntu-22.04 + cmake_build_type: Release + custom_version_build: ${{ inputs.custom_version_build }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Compile and run tests + uses: eProsima/eProsima-CI/multiplatform/tsan_build_test@v0 + with: + packages_names: ${{ env.code_packages_names }} + workspace_dependencies: './install' + + +##################################################################### +# CLANG + + clang: + runs-on: ubuntu-22.04 + steps: + + - name: Sync repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src + + - name: Download dependencies and install requirements + uses: ./src/.github/actions/project_dependencies + with: + os: ubuntu-22.04 + cmake_build_type: Release + custom_version_build: ${{ inputs.custom_version_build }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Compile and run tests + uses: eProsima/eProsima-CI/multiplatform/clang_build_test@v0 + with: + packages_names: ${{ env.code_packages_names }} + workspace_dependencies: './install' + + +##################################################################### +# COVERAGE + + coverage: + runs-on: ubuntu-22.04 + environment: + name: codecov + steps: + + - name: Sync repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src + + - name: Download dependencies and install requirements + uses: ./src/.github/actions/project_dependencies + with: + os: ubuntu-22.04 + cmake_build_type: Release + custom_version_build: ${{ inputs.custom_version_build }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Compile and run tests + uses: eProsima/eProsima-CI/ubuntu/coverage_build_test_upload@v0 + with: + packages_names: ${{ env.code_packages_names }} + workspace_dependencies: './install' + codecov_token: ${{ secrets.CODECOV_TOKEN }} + codecov_fix_file_path: ./src/codecov.yml + + +##################################################################### +# FLAKY + + flaky: + runs-on: ubuntu-22.04 + steps: + + - name: Sync repository + uses: eProsima/eProsima-CI/external/checkout@v0 + with: + path: src + + - name: Download dependencies and install requirements + uses: ./src/.github/actions/project_dependencies + with: + os: ubuntu-22.04 + cmake_build_type: Release + custom_version_build: ${{ inputs.custom_version_build }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Compile and run tests + uses: eProsima/eProsima-CI/multiplatform/colcon_build_test@main + with: + packages_names: ${{ env.code_packages_names }} + workspace_dependencies: './install' + ctest_args: --label-regex "xfail" + + +##################################################################### +# DOCUMENTATION TEST + + docs: + runs-on: ubuntu-22.04 + steps: + - name: Build and test documentation + uses: eProsima/eProsima-CI/ubuntu/sphinx_docs@main + with: + checkout_path: "src/fastddsspy" + path_to_requirements: "src/fastddsspy/docs/requirements.txt" + docs_subpackage_name: ${{ env.docs_packages_names }} + secret_token: ${{ secrets.GITHUB_TOKEN }} + + +##################################################################### +# UNCRUSTIFY + + uncrustify: + runs-on: ubuntu-22.04 + steps: + + - name: Uncrustify + uses: eProsima/eProsima-CI/ubuntu/uncrustify@v0 + + +##################################################################### +# PYTHON LINTER + + python-linter: + runs-on: ubuntu-22.04 + steps: + + - name: Python Linter + uses: eProsima/eProsima-CI/ubuntu/python_linter@v0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 751f4b74..ec72cf67 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,61 +1,26 @@ -# Main CI -# This is executed: -# - every PullRequest (new or update) -# - every merge in main -# - every night (05:00) -# -# These jobs that require to install eprosima libraries uses the artifact generated for eprosima-CI nightly -# so they do not have to compile the whole project. This saves huge amount of time. -# -# JOBS: -# -# - multiplatform-tests -# - [ ubuntu-22.04 | ubuntu-20.04 | windows-2019 | windows-2022 ] -# - [ Debug | Release ] -# - execute tests in different versions of ubuntu with different build types -# -# - asan -# - ubuntu-22.04 -# - execute tests with ASAN flag -# -# - tsan -# - ubuntu-22.04 -# - execute tests with TSAN flag -# -# - clang -# - ubuntu-22.04 -# - execute clang-tidy check -# -# - coverage -# - ubuntu-22.04 -# - execute test with coverage flag and upload results -# -# - flaky -# - ubuntu-22.04 -# - execute flaky tests -# -# - uncrustify -# - ubuntu-22.04 -# - test uncrustify -# -# - python-linter -# - ubuntu-22.04 -# - test python linter -# -# TODO: when merge CI in eprosima-CI repository, the jparisu fork must change for eProsima in actions. -# -# TODO: Add Windows CI -# - +# Tests to run with workflow-dispatch, pull-request and push events name: test on: - workflow_dispatch: inputs: + custom_version_build: + description: > + Use the custom version build from eProsima-CI. + If set to false, the workflow will run the tests for Fast DDS v2 and v3. + required: true + type: choice + default: 'custom' + options: + - custom + - v2 + - v3 + dependencies_artifact_postfix: - description: 'Postfix name to add to artifact name to download dependencies. This is use to download a specific artifact version from eProsima-CI.' + description: > + Postfix name to add to artifact name to download dependencies. + This is use to download a specific artifact version from eProsima-CI. required: true default: '_nightly' @@ -63,230 +28,13 @@ on: push: branches: - main - schedule: - - cron: '0 5 * * *' - -env: - code_packages_names: 'fastddsspy_participants fastddsspy_yaml fastddsspy_tool' - docs_packages_names: 'fastddsspy_docs' - default_dependencies_artifact_postfix: '_nightly' jobs: - -##################################################################### -# UBUNTU TEST - - multiplatform-tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - cmake_build_type: - - Release - - Debug - os: - - ubuntu-20.04 - - ubuntu-22.04 - - windows-2019 - - windows-2022 - - steps: - - - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - path: src - - - name: Download dependencies and install requirements - uses: ./src/.github/actions/project_dependencies - with: - os: ${{ matrix.os }} - cmake_build_type: ${{ matrix.cmake_build_type }} - dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/colcon_build_test@v0 - with: - packages_names: ${{ env.code_packages_names }} - cmake_args: -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} - workspace_dependencies: './install' - ctest_args: --label-exclude "xfail" - colcon_meta_file: ./src/.github/workflows/configurations/${{ runner.os }}/colcon.meta - - -##################################################################### -# ASAN - - asan: - runs-on: ubuntu-22.04 - steps: - - - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - path: src - - - name: Download dependencies and install requirements - uses: ./src/.github/actions/project_dependencies - with: - os: ubuntu-22.04 - cmake_build_type: Release - dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/asan_build_test@v0 - with: - packages_names: ${{ env.code_packages_names }} - workspace_dependencies: './install' - - -##################################################################### -# TSAN - - tsan: - runs-on: ubuntu-22.04 - steps: - - - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - path: src - - - name: Download dependencies and install requirements - uses: ./src/.github/actions/project_dependencies - with: - os: ubuntu-22.04 - cmake_build_type: Release - dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/tsan_build_test@v0 - with: - packages_names: ${{ env.code_packages_names }} - workspace_dependencies: './install' - - -##################################################################### -# CLANG - - clang: - runs-on: ubuntu-22.04 - steps: - - - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - path: src - - - name: Download dependencies and install requirements - uses: ./src/.github/actions/project_dependencies - with: - os: ubuntu-22.04 - cmake_build_type: Release - dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/clang_build_test@v0 - with: - packages_names: ${{ env.code_packages_names }} - workspace_dependencies: './install' - - -##################################################################### -# COVERAGE - - coverage: - runs-on: ubuntu-22.04 - environment: - name: codecov - steps: - - - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - path: src - - - name: Download dependencies and install requirements - uses: ./src/.github/actions/project_dependencies - with: - os: ubuntu-22.04 - cmake_build_type: Release - dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile and run tests - uses: eProsima/eProsima-CI/ubuntu/coverage_build_test_upload@v0 - with: - packages_names: ${{ env.code_packages_names }} - workspace_dependencies: './install' - codecov_token: ${{ secrets.CODECOV_TOKEN }} - codecov_fix_file_path: ./src/codecov.yml - - -##################################################################### -# FLAKY - - flaky: - runs-on: ubuntu-22.04 - steps: - - - name: Sync repository - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - path: src - - - name: Download dependencies and install requirements - uses: ./src/.github/actions/project_dependencies - with: - os: ubuntu-22.04 - cmake_build_type: Release - dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Compile and run tests - uses: eProsima/eProsima-CI/multiplatform/colcon_build_test_flaky@v0 - with: - packages_names: ${{ env.code_packages_names }} - workspace_dependencies: './install' - - -##################################################################### -# DOCUMENTATION TEST - - docs: - runs-on: ubuntu-22.04 - steps: - - name: Build and test documentation - uses: eProsima/eProsima-CI/ubuntu/sphinx_docs@main - with: - checkout_path: "${{ github.workspace }}/src/fastddsspy" - path_to_requirements: "${{ github.workspace }}/src/fastddsspy/docs/requirements.txt" - docs_subpackage_name: ${{ env.docs_packages_names }} - secret_token: ${{ secrets.GITHUB_TOKEN }} - - -##################################################################### -# UNCRUSTIFY - - uncrustify: - runs-on: ubuntu-22.04 - steps: - - - name: Uncrustify - uses: eProsima/eProsima-CI/ubuntu/uncrustify@v0 - - -##################################################################### -# PYTHON LINTER - - python-linter: - runs-on: ubuntu-22.04 - steps: - - - name: Python Linter - uses: eProsima/eProsima-CI/ubuntu/python_linter@v0 + reusable_tests: + name: reusable_tests + uses: ./.github/workflows/reusable-workflow.yml + with: + custom_version_build: ${{ inputs.custom_version_build || 'v2' }} + dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix || '_nightly' }} + secrets: inherit