Skip to content

Commit 259f3d9

Browse files
committed
Fix Rtools CI hang
1 parent 1c75cf0 commit 259f3d9

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ jobs:
4141
with:
4242
python-version: '3.x'
4343

44-
- name: Download and install Rtools45
44+
- name: Download and Install Rtools45
4545
if: runner.os == 'Windows'
4646
run: |
4747
$ARCH = if ('${{ matrix.os }}' -eq 'windows-11-arm') { 'aarch64' } else { 'x86_64' }
4848
$RTOOLS = if ('${{ matrix.os }}' -eq 'windows-11-arm') { "rtools45-$ARCH" } else { 'rtools45' }
49-
Invoke-WebRequest -Uri https://github.com/r-hub/rtools45/releases/download/latest/$RTOOLS.exe -OutFile "$RTOOLS.exe"
50-
Start-Process -FilePath "$RTOOLS.exe" -ArgumentList "/install /norestart /verysilent /SUPPRESSMSGBOXES" -NoNewWindow -Wait
49+
50+
# Installation will hang if the toolchain is already installed
51+
if (-Not $(Test-Path -Path "C:/$RTOOLS")) {
52+
Invoke-WebRequest `
53+
-Uri https://github.com/r-hub/rtools45/releases/download/latest/$RTOOLS.exe `
54+
-OutFile "$RTOOLS.exe"
55+
Start-Process -FilePath "$RTOOLS.exe" -ArgumentList "/INSTALL /VERYSILENT /SUPPRESSMSGBOXES" -Wait
56+
}
57+
5158
echo "C:/$RTOOLS/usr/bin;C:/$RTOOLS/$ARCH-w64-mingw32.static.posix/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
5259
echo "$(pwd)/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
5360
@@ -85,13 +92,20 @@ jobs:
8592
with:
8693
python-version: '3.x'
8794

88-
- name: Download and install Rtools45
95+
- name: Download and Install Rtools45
8996
if: runner.os == 'Windows'
9097
run: |
9198
$ARCH = if ('${{ matrix.os }}' -eq 'windows-11-arm') { 'aarch64' } else { 'x86_64' }
9299
$RTOOLS = if ('${{ matrix.os }}' -eq 'windows-11-arm') { "rtools45-$ARCH" } else { 'rtools45' }
93-
Invoke-WebRequest -Uri https://github.com/r-hub/rtools45/releases/download/latest/$RTOOLS.exe -OutFile "$RTOOLS.exe"
94-
Start-Process -FilePath "$RTOOLS.exe" -ArgumentList "/install /norestart /verysilent /SUPPRESSMSGBOXES" -NoNewWindow -Wait
100+
101+
# Installation will hang if the toolchain is already installed
102+
if (-Not $(Test-Path -Path "C:/$RTOOLS")) {
103+
Invoke-WebRequest `
104+
-Uri https://github.com/r-hub/rtools45/releases/download/latest/$RTOOLS.exe `
105+
-OutFile "$RTOOLS.exe"
106+
Start-Process -FilePath "$RTOOLS.exe" -ArgumentList "/INSTALL /VERYSILENT /SUPPRESSMSGBOXES" -Wait
107+
}
108+
95109
echo "C:/$RTOOLS/usr/bin;C:/$RTOOLS/$ARCH-w64-mingw32.static.posix/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
96110
echo "$(pwd)/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
97111

0 commit comments

Comments
 (0)