Add python modules tests [19658] #740
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
windows-build-test: | |
runs-on: windows-2019 | |
env: | |
CXXFLAGS: /MP | |
OPENSSL64_ROOT: "C:/Program Files/OpenSSL-Win64" | |
steps: | |
- name: install OpenSSL | |
shell: pwsh | |
run: | | |
choco install openssl -yr --no-progress | |
"System32;SysWoW64" -split ";" | Join-Path -Path $env:windir -ChildPath {$_} ` | |
| ls -Include libssl-*.dll | rm | |
- name: Install python build dependencies | |
shell: pwsh | |
run: > | |
pip install -U colcon-common-extensions colcon-mixin vcstool; | |
- name: Install python tests dependencies | |
shell: pwsh | |
run: | | |
cd (ni -Type Directory -Path "$Env:TMP\$(New-Guid)") | |
$cr = "`n" | |
'cmake_minimum_required(VERSION 3.5)' + $cr + | |
'project(dummy VERSION 1.0.0 LANGUAGES CXX)' + $cr + | |
'find_package (Python3 COMPONENTS Interpreter Development REQUIRED)' + $cr + | |
'message(STATUS "cmake detected python=>>>>>${Python3_EXECUTABLE}<<<<<<")' | | |
Out-File CMakeLists.txt | |
(cmake .) *>&1 | % { | |
if($_ -Match "cmake detected python=>>>>>(?<exec>.*)<<<<<<") | |
{ | |
$python_exec = $Matches.exec | |
return | |
} | |
} | |
& $python_exec -m pip install -U pytest pywin32 | |
- uses: actions/checkout@v2 | |
with: | |
path: src/fastdds_python | |
- name: Fetch repositories | |
shell: pwsh | |
run: | | |
vcs import src --skip-existing --input src/fastdds_python/fastdds_python.repos | |
- name: Build workspace | |
shell: pwsh | |
run: | | |
$installpath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" | |
$modulepath = "$installpath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | |
Import-Module $modulepath | |
Enter-VsDevShell -SetDefaultWindowTitle -InstallPath $installpath ` | |
-DevCmdArguments '/arch=x64 /host_arch=x64'; | |
$cargs = @("--event-handlers=console_direct+", ` | |
"--metas", "./src/fastdds_python/.github/workflows/test.meta") | |
colcon build --executor parallel $cargs | |
- name: Run tests | |
shell: pwsh | |
run: | | |
colcon test --packages-select fastdds_python --event-handlers=console_direct+ ` | |
--return-code-on-test-failure --ctest-args --timeout 60 | |
- name: Upload Logs | |
uses: actions/upload-artifact@v1 | |
with: | |
name: colcon-logs-windows | |
path: log/ | |
if: always() | |
ubuntu-build-test: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: src/fastdds_python | |
- name: Install apt dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y \ | |
python3 \ | |
python3-pip \ | |
swig \ | |
libpython3-dev | |
- name: Install python dependencies | |
run: | | |
sudo pip3 install -U \ | |
vcstool \ | |
colcon-common-extensions | |
- name: Fetch repositories | |
run: | | |
vcs import --skip-existing src < src/fastdds_python/fastdds_python.repos | |
- name: Build workspace | |
run: > | |
colcon build --event-handlers=console_direct+ --metas ./src/fastdds_python/.github/workflows/test.meta | |
- name: Run tests | |
run: | | |
source install/setup.bash && \ | |
colcon test \ | |
--packages-select fastdds_python \ | |
--event-handlers=console_direct+ \ | |
--return-code-on-test-failure \ | |
--ctest-args \ | |
--output-on-failure \ | |
--timeout 60 | |
- name: Upload Logs | |
uses: actions/upload-artifact@v1 | |
with: | |
name: colcon-logs-ubuntu | |
path: log/ | |
if: always() |