83
83
# Enable debugging if 'debug' is true
84
84
[ "${{ inputs.debug }}" == "true" ] && set -x
85
85
86
+ # Try to install coverage-reporter via Homebrew
86
87
brew tap coverallsapp/coveralls --quiet
87
88
brew install coveralls --quiet
88
89
@@ -115,15 +116,13 @@ runs:
115
116
mkdir -p ~/bin/
116
117
cd ~/bin/
117
118
119
+ # Determine which version of coverage-reporter to download
118
120
if [ "$COVERAGE_REPORTER_VERSION" == "latest" ]; then
119
121
asset_path="latest/download"
120
122
else
121
123
asset_path="download/${COVERAGE_REPORTER_VERSION}"
122
124
fi
123
125
124
- # Debugging output to verify asset path
125
- echo "Using asset path: $asset_path"
126
-
127
126
# Try to download the binary and checksum file
128
127
if ! curl -sLO "https://github.com/coverallsapp/coverage-reporter/releases/${asset_path}/coveralls-linux.tar.gz" ||
129
128
! curl -sLO "https://github.com/coverallsapp/coverage-reporter/releases/${asset_path}/coveralls-checksums.txt"; then
@@ -132,35 +131,37 @@ runs:
132
131
exit 1
133
132
fi
134
133
135
- # Verify the downloaded binary
134
+ # Try to verify the downloaded binary
136
135
if ! grep coveralls-linux.tar.gz coveralls-checksums.txt | sha256sum --check; then
137
136
echo "Checksum verification failed (Linux)."
138
137
[ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
139
138
exit 1
140
139
fi
141
140
142
- # Extract the tar.gz file
143
141
tar -xzf coveralls-linux.tar.gz
144
142
145
- rm coveralls-checksums.txt
146
- echo ~/bin >> $GITHUB_PATH
147
-
148
143
# Check if the binary exists
149
144
if [ ! -f ~/bin/coveralls ]; then
150
145
echo "Coveralls binary not found after extraction (Linux)."
151
146
exit 1
152
147
fi
153
148
149
+ # Cleanup
150
+ rm coveralls-checksums.txt
151
+ echo ~/bin >> $GITHUB_PATH
152
+
154
153
- name : Install coveralls reporter (Windows)
155
154
if : startsWith(runner.os, 'Windows')
156
155
env :
157
156
COVERAGE_REPORTER_VERSION : ${{ inputs.coverage-reporter-version }}
158
157
shell : pwsh
159
158
run : |
159
+ # Enable debugging if 'debug' is true
160
160
if ("${{ inputs.debug }}" -eq "true") {
161
161
Set-PSDebug -Trace 1
162
162
}
163
163
164
+ # Try to download the binary and checksum file
164
165
New-Item -Path $env:HOME\bin -ItemType directory -Force
165
166
Push-Location $env:HOME\bin
166
167
if($env:COVERAGE_REPORTER_VERSION -eq "latest") {
@@ -171,6 +172,7 @@ runs:
171
172
Invoke-WebRequest -Uri "https://github.com/coverallsapp/coverage-reporter/releases/download/$env:COVERAGE_REPORTER_VERSION/coveralls-checksums.txt" -OutFile "sha256sums.txt"
172
173
}
173
174
175
+ # Try to verify the downloaded binary
174
176
if ((Get-FileHash coveralls.exe).Hash -ne (Get-Content sha256sums.txt | Select-String 'windows.exe' | ForEach-Object { ($_ -split "\s+")[0] })) {
175
177
Write-Host "Checksum verification failed (Windows)."
176
178
exit 1
@@ -182,6 +184,7 @@ runs:
182
184
exit 1
183
185
}
184
186
187
+ # Cleanup
185
188
Remove-Item sha256sums.txt -Force
186
189
echo $env:HOME\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
187
190
0 commit comments