Skip to content

Commit 72709f8

Browse files
authored
Automatically detect the platform to install (#238)
1 parent cfd0633 commit 72709f8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ runs:
9494
shell: bash
9595
run: |
9696
echo "Warning: The coverage-reporter-platform parameter is not available on macOS. The default version for macOS will be used." >&2
97-
97+
9898
- name: Install coveralls reporter (macOS)
9999
if: runner.os == 'macOS'
100100
shell: bash
101101
run: |
102102
# Enable debugging if 'debug' is true
103103
[ "${{ inputs.debug }}" == "true" ] && set -x
104-
104+
105105
# Try to install coverage-reporter via Homebrew
106106
brew tap coverallsapp/coveralls --quiet
107107
brew install coveralls --quiet
@@ -148,6 +148,7 @@ runs:
148148
# This logic is necessary due to the introduction of multiple platform support starting from v0.6.15.
149149
# It selects the correct filename based on the specified platform and version, while ensuring
150150
# backward compatibility with earlier versions that only supported a generic Linux binary for x86_64.
151+
[ "$COVERAGE_REPORTER_PLATFORM" ] || COVERAGE_REPORTER_PLATFORM="$(uname -m)"
151152
case "$COVERAGE_REPORTER_PLATFORM" in
152153
x86_64|"")
153154
if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then
@@ -229,7 +230,7 @@ runs:
229230
shell: pwsh
230231
run: |
231232
Write-Host "Warning: The coverage-reporter-platform parameter is not available on Windows. The default version for Windows will be used." -ForegroundColor Yellow
232-
233+
233234
- name: Install coveralls reporter (Windows)
234235
if: startsWith(runner.os, 'Windows')
235236
env:
@@ -240,7 +241,7 @@ runs:
240241
if ("${{ inputs.debug }}" -eq "true") {
241242
Set-PSDebug -Trace 1
242243
}
243-
244+
244245
# Try to download the binary and checksum file
245246
New-Item -Path $env:HOME\bin -ItemType directory -Force
246247
Push-Location $env:HOME\bin
@@ -251,7 +252,7 @@ runs:
251252
Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-windows.exe" -OutFile "coveralls.exe"
252253
Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-checksums.txt" -OutFile "sha256sums.txt"
253254
}
254-
255+
255256
# Try to verify the downloaded binary
256257
if ((Get-FileHash coveralls.exe).Hash -ne (Get-Content sha256sums.txt | Select-String 'windows.exe' | ForEach-Object { ($_ -split "\s+")[0] })) {
257258
Write-Host "Checksum verification failed (Windows)."

0 commit comments

Comments
 (0)