@@ -101,9 +101,6 @@ jobs:
101101 # this will be src/{repo-owner}/{repo-name}
102102 repo_path : src/${{ github.repository }}
103103
104- # INPUTS ...
105- # Space-separated list of additional pixi dependencies
106- pixi_dependencies : " rosinstall_generator typeguard jinja2 libboost-devel compilers"
107104 # Path to a repos file with additional windows dependencies
108105 windows_dependencies : " "
109106 # Space-separated list of packages to skip from
@@ -132,59 +129,35 @@ jobs:
132129 uses : actions/checkout@v7
133130 with :
134131 path : ${{ env.repo_path }}
135- - name : Bootstrap pixi and patch manifest file
136- # https://docs.ros.org/en/rolling/Installation/Windows-Install-Binary.html
137- run : |
138- $manifest = "pixi.toml"
139- irm https://raw.githubusercontent.com/ros2/ros2/refs/heads/rolling/pixi.toml -OutFile $manifest
140-
141- # patch pixi.toml to add extra dependencies
142- $deps = "${{ env.pixi_dependencies }}"
143- Write-Host "env.pixi_dependencies = $deps"
144- if (-not [string]::IsNullOrWhiteSpace($deps)) {
145- Write-Host "Extra dependencies specified: $deps"
146-
147- # Read file into a string array
148- [string[]]$content = Get-Content $manifest
149-
150- # Find [dependencies] section
151- $depIndex = $content.IndexOf("[dependencies]")
152-
153- # If section not found, append it
154- if ($depIndex -eq -1) {
155- Add-Content $manifest "`n[dependencies]"
156- $content = Get-Content $manifest
157- $depIndex = $content.IndexOf("[dependencies]")
158- }
159-
160- # Convert array to a List[string] explicitly
161- $contentList = New-Object 'System.Collections.Generic.List[string]'
162- $contentList.AddRange([string[]]$content)
163-
164- # Insert each dependency after the [dependencies] section
165- $insertIndex = $depIndex + 1
166-
167- foreach ($dep in $deps.Split(" ")) {
168- # Only insert if not already present
169- if (-not ($contentList -match "^\s*$dep\s*=")) {
170- $contentList.Insert($insertIndex, "$dep = `"*`"")
171- $insertIndex++
172- }
173- }
174-
175- # Save updated manifest
176- $contentList | Set-Content $manifest
177- } else {
178- Write-Host "No additional dependencies specified."
179- }
180-
181132 - name : Install pixi
182133 uses : prefix-dev/setup-pixi@v0.11.3
183- # Cache pixi environment only on default branch to save disk space
184134 with :
185- cache : ${{ steps.cache.outputs.cache-hit == 'true' }} # only use cache if pixi.lock is present
186- cache-write : ${{ steps.cache.outputs.cache-hit == 'true' && github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} # only write cache on push to default branch to save disk space, caches from PRs can't be accessed anyways; only allowed if pixi.lock is present
135+ cache : false
187136 locked : false
137+ run-install : false
138+
139+ - name : Generate Pixi manifest from package.xml
140+ run : |
141+ Push-Location ${{ env.repo_path }}
142+ pixi exec --spec pixi-ros==0.7.0 pixi-ros init --distro ${{ matrix.distro }} --platform linux-64 --platform win-64
143+ Pop-Location
144+
145+ $generatedManifest = Join-Path "${{ env.repo_path }}" "pixi.toml"
146+ [string[]]$content = Get-Content $generatedManifest
147+ $activationIndex = $content.IndexOf("[activation]")
148+ if ($activationIndex -ge 0) {
149+ $content = $content[0..($activationIndex - 1)]
150+ $content | Set-Content $generatedManifest
151+ }
152+ pixi add --manifest-path $generatedManifest --no-install rosinstall_generator
153+ pixi add --manifest-path $generatedManifest --no-install --pypi vcstool
154+ pixi add --manifest-path $generatedManifest --no-install "setuptools<82"
155+
156+ Copy-Item $generatedManifest "pixi.toml"
157+ Copy-Item (Join-Path "${{ env.repo_path }}" "pixi.lock") "pixi.lock"
158+
159+ - name : Install Pixi dependencies
160+ run : pixi install
188161
189162 - name : Cache pixi.lock
190163 uses : actions/cache/save@v6
@@ -204,18 +177,19 @@ jobs:
204177 - name : Install ROS
205178 # Download and extract ROS 2 package
206179 # https://docs.ros.org/en/rolling/Installation/Windows-Install-Binary.html
180+ shell : cmd
207181 run : |
208- Invoke-Expression ((& pixi shell-hook -s powershell) -join "`n")
182+ call pixi shell-hook -s cmd > pixi_env.bat
183+ call pixi_env.bat
184+ if errorlevel 1 exit /b 1
209185
210- New-Item -ItemType Directory -Force -Path ${{ env.ros_underlay_path }}
211- Set-Location -Path ${{ env.ros_underlay_path }}
212- $url = "https://github.com/ros2/ros2/releases/download/release-rolling-nightlies/ros2-rolling-nightly-windows-amd64.zip"
213- $output = "ros2-package-windows-AMD64.zip"
214- Invoke-WebRequest -Uri $url -OutFile $output
215- Expand-Archive -Path $output -DestinationPath ros2_${{ matrix.distro }}
216- Remove-Item $output
217- Set-Location -Path ros2_${{ matrix.distro }}\ros2-windows
186+ if not exist "${{ env.ros_underlay_path }}" mkdir "${{ env.ros_underlay_path }}"
187+ cd /d "${{ env.ros_underlay_path }}"
188+ powershell -NoProfile -Command "$ErrorActionPreference = 'Stop'; Invoke-WebRequest -Uri 'https://github.com/ros2/ros2/releases/download/release-rolling-nightlies/ros2-rolling-nightly-windows-amd64.zip' -OutFile 'ros2-package-windows-AMD64.zip'; Expand-Archive -Path 'ros2-package-windows-AMD64.zip' -DestinationPath 'ros2_${{ matrix.distro }}'; Remove-Item 'ros2-package-windows-AMD64.zip'"
189+ if errorlevel 1 exit /b 1
190+ cd /d "ros2_${{ matrix.distro }}\ros2-windows"
218191 python preinstall_setup_windows.py
192+ if errorlevel 1 exit /b 1
219193
220194 - name : Get package list
221195 id : package_list_action
@@ -225,34 +199,40 @@ jobs:
225199 manifest-path : pixi.toml
226200
227201 - name : Clone dependencies
202+ shell : cmd
228203 run : |
229- Invoke-Expression ((& pixi shell-hook -s powershell) -join "`n")
230- ${{ env.ros_underlay_path }}\ros2_${{ matrix.distro }}\ros2-windows\setup.ps1
204+ setlocal EnableDelayedExpansion
205+ call pixi shell-hook -s cmd > pixi_env.bat
206+ call pixi_env.bat
207+ if errorlevel 1 exit /b 1
208+ call ${{ env.ros_underlay_path }}\ros2_${{ matrix.distro }}\ros2-windows\setup.bat
209+ if errorlevel 1 exit /b 1
231210
232- # Workaround .. --from-path: 'src/ros/diagnostics' is not an existing directory
233- mkdir -p ${{ env.upstream_workspace }}/ ${{ env.repo_path }}
211+ rem Workaround .. --from-path: 'src/ros/diagnostics' is not an existing directory
212+ if not exist " ${{ env.upstream_workspace }}\ ${{ env.repo_path }}" mkdir "${{ env.upstream_workspace }}\${{ env.repo_path }}"
234213
235- # check for repos files, and pass them to vcstool
236- # mkdir -p ${{ env.upstream_workspace }}/src
237- $repo_file = "${{ env.repo_path }}\${{ steps.package_list_action.outputs.repo_name }}.${{ matrix.distro }}.repos"
238- if (Test-Path "$repo_file") {
239- Write-Output "Local repos file found"
240- vcs import --input $repo_file ${{ env.upstream_workspace }}/src
241- }
242- if (![string]::IsNullOrWhiteSpace("${{ env.windows_dependencies }}")) {
243- $repo_file_win = "${{ env.repo_path }}\${{ env.windows_dependencies }}"
244- if (Test-Path "$repo_file_win") {
245- Write-Output "Windows repos file found"
246- vcs import --input $repo_file_win ${{ env.upstream_workspace }}/src
247- }
248- }
214+ rem Check for repos files and pass them to vcstool
215+ set "repo_file=${{ env.repo_path }}\${{ steps.package_list_action.outputs.repo_name }}.${{ matrix.distro }}.repos"
216+ if exist "!repo_file!" (
217+ echo Local repos file found
218+ vcs import --input "!repo_file!" "${{ env.upstream_workspace }}\src"
219+ if errorlevel 1 exit /b 1
220+ )
221+ if not "${{ env.windows_dependencies }}"=="" if exist "${{ env.repo_path }}\${{ env.windows_dependencies }}" (
222+ echo Windows repos file found
223+ vcs import --input "${{ env.repo_path }}\${{ env.windows_dependencies }}" "${{ env.upstream_workspace }}\src"
224+ if errorlevel 1 exit /b 1
225+ )
249226
250- # use rosinstall_generator to get all dependencies which are not yet installed
251- $underlay_ws_pkgs=$(ros2 pkg list)
252- Write-Host "underlay_ws_pkgs = $underlay_ws_pkgs"
253- rosinstall_generator --rosdistro ${{ matrix.distro }} --deps --deps-only --format repos --exclude $underlay_ws_pkgs ${{ env.skip_dependencies }} --from-path ${{ env.upstream_workspace }} ${{ env.repo_path }} > deps.repos
254- # rosinstall_generator skips excludes with are from a different repo (gbp instead of development repo)
255- vcs import --skip-existing --input deps.repos ${{ env.upstream_workspace }}/src
227+ rem Use rosinstall_generator to get dependencies not already installed
228+ set "underlay_ws_pkgs="
229+ for /f "delims=" %%p in ('ros2 pkg list') do set "underlay_ws_pkgs=!underlay_ws_pkgs! %%p"
230+ echo underlay_ws_pkgs = !underlay_ws_pkgs!
231+ rosinstall_generator --rosdistro ${{ matrix.distro }} --deps --deps-only --format repos --exclude !underlay_ws_pkgs! ${{ env.skip_dependencies }} --from-path ${{ env.upstream_workspace }} ${{ env.repo_path }} > deps.repos
232+ if errorlevel 1 exit /b 1
233+ rem rosinstall_generator skips excludes from a different repository
234+ vcs import --skip-existing --input deps.repos "${{ env.upstream_workspace }}\src"
235+ if errorlevel 1 exit /b 1
256236
257237 - name : Upload repos file
258238 uses : actions/upload-artifact@v7
0 commit comments