Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows ci vcpkg #216

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 78 additions & 11 deletions .github/workflows/reusable-ros-tooling-win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ on:
required: false
default: ''
type: string
windows_dependencies:
description: 'Path to a repos file with additional windows dependencies'
required: false
default: ''
type: string
install_boost:
description: 'Install boost'
required: false
default: false
type: boolean
install_vcpkg:
description: 'Install vcpkg'
required: false
default: false
type: boolean

jobs:
reusable_ros_tooling_source_build:
Expand All @@ -34,17 +49,58 @@ jobs:
# this will be src/{repo-owner}/{repo-name}
repo_path: src/${{ github.repository }}
steps:

- uses: actions/setup-python@v5
# setup-ros has hardcoded python 3.8, as it is the default version acc. to REP-2000 for jazzy
# let's use the same version here for the later action-ros-ci step
with:
python-version: '3.8'
python-version: '3.12'

- uses: ros-tooling/setup-ros@0.7.9
- uses: christophfroehlich/setup-ros@master
with:
required-ros-distributions: ${{ inputs.ros_distro }}
use-ros2-testing: true

- name: vcpkg build
uses: johnwason/vcpkg-action@v6
if: ${{ inputs.install_vcpkg }}
id: vcpkg
with:
# eigen should be installed with setup-ros, but cmake can't find it in the action-ros-ci step
pkgs: fmt eigen3
triplet: x64-windows-release
token: ${{ github.token }}
github-binarycache: true

- name: Make json from vcpkg cmake
if: ${{ inputs.install_vcpkg }}
id: vcpkg-json
run: |
# Split the string on spaces and assign to variables
$variables = "${{ steps.vcpkg.outputs.vcpkg-cmake-config }}" -split ' '
# Replace forward slashes with backslashes (for Windows) and escape them for json
$singlePath = $variables[0] -replace "/", "\"
$doublePath = $singlePath -replace "\\", "\\"
Write-Host "Transformed output: $doublePath"
$var2 = $variables[1]
$var3 = $variables[2]
"toolchain-file=$doublePath" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append
"target-triplet=$var2" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append
"manifest-mode=$var3" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append

- name: Install boost
uses: MarkusJx/[email protected]
if: ${{ inputs.install_boost }}
id: install-boost
with:
# REQUIRED: Specify the required boost version
# A list of supported versions can be found here:
# https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json
boost_version: 1.86.0
# OPTIONAL: Specify a platform version
platform_version: 2019
# OPTIONAL: Specify a toolset
toolset: msvc

- name: Checkout default ref when build is not scheduled
if: ${{ github.event_name != 'schedule' }}
uses: actions/checkout@v4
Expand All @@ -70,25 +126,36 @@ jobs:
"repo_file=${{ env.repo_path }}/${{ steps.package_list_action.outputs.repo_name }}.${{ inputs.ros_distro }}.repos" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append
} else {
Write-Output "No local repos file found"
"repo_file=" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append
}

- uses: actions/setup-python@v5
with:
python-version: '3.8'
if (-not [string]::IsNullOrEmpty("${{ inputs.windows_dependencies }}")) {
Write-Output "Using provided windows dependencies file"
"repo_file_windows=${{ env.repo_path }}/${{ inputs.windows_dependencies }}" | Out-File -FilePath $Env:GITHUB_OUTPUT -Append
} else {
Write-Output "No windows dependencies file provided"
}

- uses: ros-tooling/[email protected]
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
with:
target-ros2-distro: ${{ inputs.ros_distro }}
package-name: ${{ steps.package_list_action.outputs.package_list }}
vcs-repo-file-url: |
${{ steps.check_local_repos.outputs.repo_file }}
${{ steps.check_local_repos.outputs.repo_file_windows }}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon-defaults: |
{
"test": {
"executor": "sequential"
}
"build": {
"cmake-args": [
"${{ steps.vcpkg-json.outputs.toolchain-file }}",
"${{ steps.vcpkg-json.outputs.target-triplet }}",
"${{ steps.vcpkg-json.outputs.manifest-mode }}"
]
},
"test": {
"executor": "sequential"
}
}
id: action-ros

Expand Down
Loading