@@ -138,20 +138,48 @@ runs:
138
138
version_message="$COVERAGE_REPORTER_VERSION"
139
139
fi
140
140
141
- # Determine the platform-specific filename
141
+ # Function to compare version numbers
142
+ version_ge() {
143
+ # Compare two version numbers
144
+ [ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]
145
+ }
146
+
147
+ # Determine the platform-specific filename:
148
+ # This logic is necessary due to the introduction of multiple platform support starting from v0.6.15.
149
+ # It selects the correct filename based on the specified platform and version, while ensuring
150
+ # backward compatibility with earlier versions that only supported a generic Linux binary for x86_64.
142
151
case "$COVERAGE_REPORTER_PLATFORM" in
143
152
x86_64|"")
144
- platform_filename="coveralls-linux-x86_64.tar.gz"
153
+ if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then
154
+ platform_filename="coveralls-linux-x86_64.tar.gz"
155
+ else
156
+ platform_filename="coveralls-linux.tar.gz"
157
+ fi
145
158
;;
146
159
aarch64|arm64)
147
- platform_filename="coveralls-linux-aarch64.tar.gz"
160
+ if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then
161
+ platform_filename="coveralls-linux-aarch64.tar.gz"
162
+ else
163
+ echo "Warning: The aarch64/arm64 platform is only supported from version v0.6.15 onwards. Proceeding with v0.6.15." >&2
164
+ asset_path="download/v0.6.15"
165
+ platform_filename="coveralls-linux-aarch64.tar.gz"
166
+ fi
148
167
;;
149
168
*)
150
169
echo "Warning: Unsupported platform: $COVERAGE_REPORTER_PLATFORM. The default x86_64 version ($version_message) will be used." >&2
151
- platform_filename="coveralls-linux-x86_64.tar.gz"
170
+ if version_ge "$COVERAGE_REPORTER_VERSION" "v0.6.15"; then
171
+ platform_filename="coveralls-linux-x86_64.tar.gz"
172
+ else
173
+ platform_filename="coveralls-linux.tar.gz"
174
+ fi
152
175
;;
153
176
esac
154
177
178
+ # Checksum verification:
179
+ # The following code was chosen to replace the more simple `sha256sum -c` because it provides
180
+ # clearer debugging information around our new matrix of supported coverage-reporter versions and platforms.
181
+ # We may drop back to `${platform_filename}" coveralls-checksums.txt | sha256sum -c` when we're more confidently handling these.
182
+
155
183
# Try to download the binary and checksum file
156
184
if ! curl -sLO "https://github.com/coverallsapp/coverage-reporter/releases/${asset_path}/${platform_filename}" ||
157
185
! curl -sLO "https://github.com/coverallsapp/coverage-reporter/releases/${asset_path}/coveralls-checksums.txt"; then
@@ -160,29 +188,22 @@ runs:
160
188
exit 1
161
189
fi
162
190
163
- # Try to verify the downloaded binary
164
- # if ! grep "${platform_filename}" coveralls-checksums.txt | sha256sum -c; then
165
- # echo "Checksum verification failed (Linux)."
166
- # [ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
167
- # exit 1
168
- # fi
169
-
170
- # Print contents of checksum file for debugging
191
+ # DEBUG: Print contents of checksum file for debugging
171
192
echo "Contents of coveralls-checksums.txt:"
172
193
cat coveralls-checksums.txt
173
194
174
- # Extract the expected checksum
195
+ # Extract expected checksum
175
196
expected_checksum=$(grep "${platform_filename}" coveralls-checksums.txt | awk '{print $1}')
176
197
if [ -z "$expected_checksum" ]; then
177
198
echo "Failed to extract checksum for ${platform_filename}"
178
199
[ "${{ inputs.fail-on-error }}" == "false" ] && exit 0
179
200
exit 1
180
201
fi
181
202
182
- # Compute the actual checksum
203
+ # Compute actual checksum
183
204
actual_checksum=$(sha256sum "${platform_filename}" | awk '{print $1}')
184
205
185
- # Compare checksums
206
+ # Perform verification by comparing expected and actual checksums
186
207
if [ "$expected_checksum" != "$actual_checksum" ]; then
187
208
echo "Checksum verification failed (Linux)."
188
209
echo "Expected: $expected_checksum"
0 commit comments