Skip to content

Commit a6891a3

Browse files
committed
Refs #21228: Refactor Windows CI
Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
1 parent 3d2b440 commit a6891a3

2 files changed

Lines changed: 352 additions & 0 deletions

File tree

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
name: Fast DDS Python Windows CI reusable workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os-version:
7+
description: 'The OS image for the workflow'
8+
required: false
9+
default: 'windows-2019'
10+
type: string
11+
vs-toolset:
12+
description: 'The VS toolset to use for the build'
13+
required: false
14+
default: 'v142'
15+
type: string
16+
label:
17+
description: 'ID associated to the workflow'
18+
required: true
19+
type: string
20+
colcon-args:
21+
description: 'Extra arguments for colcon cli'
22+
required: false
23+
type: string
24+
cmake-args:
25+
description: 'Extra arguments for cmake cli'
26+
required: false
27+
type: string
28+
ctest-args:
29+
description: 'Extra arguments for ctest cli'
30+
required: false
31+
type: string
32+
fastdds-python-branch:
33+
description: 'Branch or tag of Fast DDS Python repository'
34+
required: true
35+
type: string
36+
fastdds-branch:
37+
description: 'Branch or tag of Fast DDS repository'
38+
required: true
39+
type: string
40+
run-build:
41+
description: 'Build Fast DDS Python (CI skipped otherwise)'
42+
required: false
43+
type: boolean
44+
default: true
45+
run-tests:
46+
description: 'Run test suite of Fast DDS python'
47+
required: false
48+
type: boolean
49+
default: true
50+
env:
51+
colcon-build-default-cmake-args: '-DTHIRDPARTY_Asio=FORCE -DTHIRDPARTY_TinyXML2=FORCE -DTHIRDPARTY_fastcdr=OFF -DTHIRDPARTY_UPDATE=ON -DEPROSIMA_EXTRA_CMAKE_CXX_FLAGS="/MP /WX"'
52+
defaults:
53+
run:
54+
shell: pwsh
55+
56+
jobs:
57+
fastdds_python_build:
58+
runs-on: ${{ inputs.os-version }}
59+
if: ${{ inputs.run-build == true }}
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
cmake-build-type:
64+
- 'RelWithDebInfo'
65+
66+
steps:
67+
- name: Add ci-pending label if PR
68+
if: ${{ github.event_name == 'pull_request' }}
69+
uses: eProsima/eProsima-CI/external/add_labels@v0
70+
with:
71+
labels: ci-pending
72+
number: ${{ github.event.number }}
73+
repo: eProsima/Fast-DDS-Python
74+
75+
- name: Sync eProsima/Fast-DDS-Python repository
76+
uses: eProsima/eProsima-CI/external/checkout@v0
77+
with:
78+
path: src/fastdds_python
79+
ref: ${{ inputs.fastdds-python-branch }}
80+
81+
- name: Install Fix Python version
82+
uses: eProsima/eProsima-CI/external/setup-python@v0
83+
with:
84+
python-version: '3.11'
85+
86+
- name: Get minimum supported version of CMake
87+
uses: eProsima/eProsima-CI/external/get-cmake@v0
88+
with:
89+
cmakeVersion: '3.22.6'
90+
91+
- name: Install OpenSSL
92+
uses: eProsima/eprosima-CI/windows/install_openssl@v0
93+
with:
94+
version: '3.1.1'
95+
96+
- name: Update OpenSSL environment variables
97+
run: |
98+
# Update the environment
99+
if (Test-Path -Path $Env:ProgramW6432\OpenSSL)
100+
{
101+
"OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM
102+
}
103+
elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win)
104+
{
105+
"OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM
106+
}
107+
elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win64)
108+
{
109+
"OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win64" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM
110+
}
111+
else
112+
{
113+
Write-Error -Message "Cannot find OpenSSL installation."
114+
exit 1
115+
}
116+
- name: Install colcon
117+
uses: eProsima/eProsima-CI/windows/install_colcon@v0
118+
119+
- name: Install Python dependencies
120+
uses: eProsima/eProsima-CI/windows/install_python_packages@v0
121+
with:
122+
packages: vcstool xmlschema pywin32
123+
124+
- name: Install swig
125+
shell: pwsh
126+
run: choco install swig --allow-downgrade --version=4.0.2.04082020
127+
128+
# Although this is a ubuntu action becuase it uses bash, it is compatible with windows
129+
- name: Get Fast DDS branch
130+
id: get_fastdds_branch
131+
uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0
132+
with:
133+
remote_repository: eProsima/Fast-DDS
134+
fallback_branch: ${{ inputs.fastdds-branch }}
135+
136+
- name: Download Fast DDS repo
137+
uses: eProsima/eProsima-CI/external/checkout@v0
138+
with:
139+
repository: eProsima/Fast-DDS
140+
path: src/fastdds
141+
ref: ${{ steps.get_fastdds_branch.outputs.deduced_branch }}
142+
143+
- name: Fetch Fast DDS Python dependencies
144+
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
145+
with:
146+
vcs_repos_file: ${{ github.workspace }}/src/fastdds_python/fastdds_python.repos
147+
destination_workspace: src
148+
skip_existing: 'true'
149+
150+
- name: Colcon build
151+
continue-on-error: false
152+
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
153+
with:
154+
colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/build.meta
155+
colcon_build_args: ${{ inputs.colcon-args }}
156+
colcon_build_args_default: --event-handlers console_direct+ desktop_notification-
157+
cmake_args: ${{ inputs.cmake-args }}
158+
cmake_args_default: '-T ${{ inputs.vs-toolset }} ${{ env.colcon-build-default-cmake-args }}'
159+
cmake_build_type: ${{ matrix.cmake-build-type }}
160+
workspace: ${{ github.workspace }}
161+
162+
- name: Upload build artifacts
163+
uses: eProsima/eProsima-CI/external/upload-artifact@v0
164+
with:
165+
name: fastdds_python_build_${{ inputs.label }}
166+
path: ${{ github.workspace }}
167+
168+
169+
fastdds_python_test:
170+
needs: fastdds_python_build
171+
runs-on: ${{ inputs.os-version }}
172+
if: ${{ inputs.run-tests == true }}
173+
strategy:
174+
fail-fast: false
175+
matrix:
176+
cmake-build-type:
177+
- 'RelWithDebInfo'
178+
steps:
179+
- name: Download python build artifacts
180+
uses: eProsima/eProsima-CI/external/download-artifact@v0
181+
with:
182+
name: fastdds_python_build_${{ inputs.label }}
183+
path: ${{ github.workspace }}
184+
185+
- name: Install Fix Python version
186+
uses: eProsima/eProsima-CI/external/setup-python@v0
187+
with:
188+
python-version: '3.11'
189+
190+
- name: Get minimum supported version of CMake
191+
uses: eProsima/eProsima-CI/external/get-cmake@v0
192+
with:
193+
cmakeVersion: '3.22.6'
194+
195+
- name: Install OpenSSL
196+
uses: eProsima/eprosima-CI/windows/install_openssl@v0
197+
with:
198+
version: '3.1.1'
199+
200+
- name: Update OpenSSL environment variables
201+
run: |
202+
# Update the environment
203+
if (Test-Path -Path $Env:ProgramW6432\OpenSSL)
204+
{
205+
"OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM
206+
}
207+
elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win)
208+
{
209+
"OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM
210+
}
211+
elseif (Test-Path -Path $Env:ProgramW6432\OpenSSL-Win64)
212+
{
213+
"OPENSSL64_ROOT=$Env:ProgramW6432\OpenSSL-Win64" | Out-File $Env:GITHUB_ENV -Append -Encoding OEM
214+
}
215+
else
216+
{
217+
Write-Error -Message "Cannot find OpenSSL installation."
218+
exit 1
219+
}
220+
- name: Install colcon
221+
uses: eProsima/eProsima-CI/windows/install_colcon@v0
222+
223+
- name: Install Python dependencies
224+
uses: eProsima/eProsima-CI/windows/install_python_packages@v0
225+
with:
226+
packages: vcstool xmlschema pywin32 pytest
227+
228+
- name: Install swig
229+
shell: pwsh
230+
run: choco install swig --allow-downgrade --version=4.0.2.04082020
231+
232+
233+
- name: Prepare build meta file
234+
run: |
235+
$build_meta_file = '${{ github.workspace }}\src\fastdds_python\.github\workflows\config\build.meta'
236+
$test_meta_file = '${{ github.workspace }}\src\fastdds_python\.github\workflows\config\test.meta'
237+
$build_test_meta_file = '${{ github.workspace }}\src\fastdds_python\.github\workflows\config\build_test.meta'
238+
# Read the content of the build meta file
239+
$build_meta_content = Get-Content -Path $build_meta_file
240+
# Read the content of the test meta file, starting from line 4 (skipping "name" line [1], cmake project name line [2] and "cmake-args" line [3])
241+
$test_meta_content = Get-Content -Path $test_meta_file | Select-Object -Skip 3
242+
# Combine the content of the build meta file and the test meta file
243+
$combined_content = $build_meta_content + $test_meta_content
244+
# Write the combined content to the build test meta file
245+
$combined_content | Out-File -FilePath $build_test_meta_file -Encoding UTF8
246+
- name: Colcon build
247+
continue-on-error: false
248+
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
249+
with:
250+
colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/build_test.meta
251+
colcon_build_args: ${{ inputs.colcon-args }}
252+
colcon_build_args_default: --event-handlers console_direct+ desktop_notification-
253+
cmake_args: ${{ inputs.cmake-args }}
254+
cmake_args_default: '-T ${{ inputs.vs-toolset }} ${{ env.colcon-build-default-cmake-args }}'
255+
cmake_build_type: ${{ matrix.cmake-build-type }}
256+
workspace: ${{ github.workspace }}
257+
258+
- name: Colcon test
259+
id: python_test
260+
uses: eProsima/eProsima-CI/multiplatform/colcon_test@v0
261+
with:
262+
colcon_meta_file: ${{ github.workspace }}/src/fastdds_python/.github/workflows/config/test.meta
263+
colcon_test_args: ${{ inputs.colcon-args }}
264+
colcon_test_args_default: --event-handlers=console_direct+ desktop_notification-
265+
ctest_args: ${{ inputs.ctest-args }}
266+
packages_names: fastdds_python
267+
workspace: ${{ github.workspace }}
268+
workspace_dependencies: ''
269+
test_report_artifact: ${{ format('test_report_{0}_{1}_{2}', inputs.label, github.job, join(matrix.*, '_')) }}
270+
271+
- name: Test summary
272+
uses: eProsima/eProsima-CI/multiplatform/junit_summary@v0
273+
if: ${{ !cancelled() }}
274+
with:
275+
junit_reports_dir: "${{ steps.python_test.outputs.ctest_results_path }}"
276+
print_summary: 'True'
277+
show_failed: 'True'
278+
show_disabled: 'False'
279+
show_skipped: 'False'

.github/workflows/windows-ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Fast DDS Python Windows CI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
os-version:
7+
description: 'OS version to run the workflow'
8+
required: false
9+
default: 'windows-2019'
10+
type: string
11+
vs-toolset:
12+
description: 'The VS toolset to use for the build'
13+
required: false
14+
default: 'v142'
15+
type: string
16+
label:
17+
description: 'ID associated to the workflow'
18+
required: true
19+
type: string
20+
colcon-args:
21+
description: 'Extra arguments for colcon cli'
22+
required: false
23+
type: string
24+
cmake-args:
25+
description: 'Extra arguments for cmake cli'
26+
required: false
27+
type: string
28+
ctest-args:
29+
description: 'Extra arguments for ctest cli'
30+
required: false
31+
type: string
32+
fastdds-python-branch:
33+
description: 'Branch or tag of Fast DDS Python repository'
34+
required: true
35+
type: string
36+
fastdds-branch:
37+
description: 'Branch or tag of Fast DDS repository'
38+
type: string
39+
required: true
40+
run-tests:
41+
description: 'Run test suite of Fast DDS python'
42+
required: false
43+
type: boolean
44+
default: true
45+
46+
pull_request:
47+
types:
48+
- review_requested
49+
paths-ignore:
50+
- '**.md'
51+
- '**.txt'
52+
- '!**/CMakeLists.txt'
53+
54+
concurrency:
55+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
56+
cancel-in-progress: true
57+
58+
jobs:
59+
windows-ci:
60+
uses: ./.github/workflows/reusable-windows-ci.yml
61+
with:
62+
# It would be desirable to have a matrix of windows OS for this job, but due to the issue opened in this ticket:
63+
# https://github.com/orgs/community/discussions/128118 , it has been set as a single OS job.
64+
os-version: ${{ inputs.os-version || 'windows-2019' }}
65+
vs-toolset: ${{ inputs.vs-toolset || 'v142' }}
66+
label: ${{ inputs.label || 'windows-ci' }}
67+
colcon-args: ${{ inputs.colcon-args }}
68+
cmake-args: ${{ inputs.cmake-args }}
69+
ctest-args: ${{ inputs.ctest-args }}
70+
fastdds-python-branch: ${{ inputs.fastdds-python-branch || github.ref || '1.2.x' }}
71+
fastdds-branch: ${{ inputs.fastdds-branch || '2.10.x' }}
72+
run-build: ${{ !(github.event_name == 'pull_request') && true || (!contains(github.event.pull_request.labels.*.name, 'skip-ci') && !contains(github.event.pull_request.labels.*.name, 'conflicts')) && true || false }}
73+
run-tests: ${{ ((inputs.run-tests == true) && true) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'no-test')) && true || false }}

0 commit comments

Comments
 (0)