Skip to content

Commit 10ecffe

Browse files
authored
Fix Windows installation error handling (#134)
1 parent 877ac20 commit 10ecffe

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
version: ${{ inputs.version && fromJSON(format('["{0}"]', inputs.version)) || fromJSON('["release", "pre-release"]') }}
32+
version: ${{ inputs.version && fromJSON(format('["{0}"]', inputs.version)) || fromJSON('["release", "pre-release", "1.8.25"]') }}
3333
config:
3434
# Default config for standard platforms
3535
- os: macos-latest

setup/action.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ runs:
7777
run: |
7878
# Install quarto
7979
[ ${{ runner.os }} != "Windows" ] && installer=${{ steps.download-quarto.outputs.installer }}
80-
case $RUNNER_OS in
80+
case $RUNNER_OS in
8181
"Linux")
8282
sudo apt -y install ./$installer
8383
;;
@@ -98,10 +98,20 @@ runs:
9898
exit 1
9999
;;
100100
esac
101-
[ ${{ runner.os }} != "Windows" ] && rm $installer
102-
echo "Quarto Installed !"
101+
if [ "${{ runner.os }}" != "Windows" ]; then
102+
rm $installer
103+
fi
103104
shell: bash
104105
working-directory: ${{ runner.temp }}
106+
- name: 'Verify Quarto installation'
107+
run: |
108+
if ! command -v quarto &> /dev/null; then
109+
echo "ERROR: Quarto installation completed but quarto command not found"
110+
exit 1
111+
fi
112+
echo "Quarto Installed !"
113+
quarto --version
114+
shell: bash
105115
- name: 'Install TinyTeX'
106116
env:
107117
QUARTO_PRINT_STACK: true

setup/install-quarto-windows.ps1

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,30 @@
1414
ttps:/go.microsoft.com/fwlink/?LinkID=135170
1515
#>
1616

17-
Invoke-WebRequest -useb get.scoop.sh -outfile 'install.ps1'
18-
.\install.ps1 -RunAsAdmin
19-
Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH
17+
# Exit immediately on errors
18+
$ErrorActionPreference = "Stop"
19+
20+
try {
21+
Invoke-WebRequest -useb get.scoop.sh -outfile 'install.ps1'
22+
.\install.ps1 -RunAsAdmin
23+
if ($LASTEXITCODE -ne 0) {
24+
Write-Error "Scoop installation failed with exit code $LASTEXITCODE"
25+
exit 1
26+
}
27+
$scoopShims = Join-Path (Resolve-Path ~).Path "scoop\shims"
28+
Add-Content -Path $Env:GITHUB_PATH -Value $scoopShims
29+
} catch {
30+
Write-Error "Failed to download or install Scoop: $_"
31+
exit 1
32+
}
2033

2134
$version=$args[0]
2235
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
36+
2337
if ([string]::IsNullOrEmpty($version)) {
2438
scoop install quarto
2539
} elseif ($version -eq 'pre-release') {
26-
Invoke-Expression -Command "scoop install quarto-prerelease"
40+
scoop install quarto-prerelease
2741
} else {
28-
Invoke-Expression -Command "scoop install quarto@$version"
42+
scoop install quarto@$version
2943
}

0 commit comments

Comments
 (0)