diff --git a/.github/workflows/reusable-ros-tooling-win-build.yml b/.github/workflows/reusable-ros-tooling-win-build.yml index 22a884f3..8af8498a 100644 --- a/.github/workflows/reusable-ros-tooling-win-build.yml +++ b/.github/workflows/reusable-ros-tooling-win-build.yml @@ -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: @@ -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/install-boost@v2.4.5 + 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 @@ -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/action-ros-ci@0.3.15 + 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