Skip to content

Commit

Permalink
Add universal sonar-scanner, that can be used for linux arm64 (will f…
Browse files Browse the repository at this point in the history
…ail tests)
  • Loading branch information
friedbyalice committed Jun 18, 2024
1 parent eac5757 commit 52c4955
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ runs:
SONAR_SCANNER_SHA_LINUX: ${{ steps.sonar-scanner-version.outputs.sonar-scanner-sha-linux }}
SONAR_SCANNER_URL_MACOSX: ${{ steps.sonar-scanner-version.outputs.sonar-scanner-url-macosx }}
SONAR_SCANNER_SHA_MACOSX: ${{ steps.sonar-scanner-version.outputs.sonar-scanner-sha-macosx }}
SONAR_SCANNER_URL_UNIVERSAL: ${{ steps.sonar-scanner-version.outputs.sonar-scanner-url-universal }}
SONAR_SCANNER_SHA_UNIVERSAL: ${{ steps.sonar-scanner-version.outputs.sonar-scanner-sha-universal }}
run: ${GITHUB_ACTION_PATH}/scripts/configure_paths.sh >> $GITHUB_OUTPUT

- name: Cache sonar-scanner installation
Expand Down
15 changes: 9 additions & 6 deletions scripts/configure_paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,34 @@ fi

case ${OS} in
Windows)
SONAR_SCANNER_SUFFIX="windows"
SONAR_SCANNER_SUFFIX="-windows"
BUILD_WRAPPER_SUFFIX="win-x86"
SONAR_SCANNER_NAME="sonar-scanner.bat"
BUILD_WRAPPER_NAME="build-wrapper-win-x86-64.exe"
SONAR_SCANNER_URL="${SONAR_SCANNER_URL_WINDOWS}"
SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_WINDOWS}"
;;
Linux)
SONAR_SCANNER_SUFFIX="linux"
SONAR_SCANNER_NAME="sonar-scanner"
SONAR_SCANNER_URL="${SONAR_SCANNER_URL_LINUX}"
SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_LINUX}"
case ${ARCH} in
X64)
SONAR_SCANNER_SUFFIX="-linux"
SONAR_SCANNER_URL="${SONAR_SCANNER_URL_LINUX}"
SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_LINUX}"
BUILD_WRAPPER_SUFFIX="linux-x86"
BUILD_WRAPPER_NAME="build-wrapper-linux-x86-64"
;;
ARM64)
SONAR_SCANNER_SUFFIX=""
SONAR_SCANNER_URL="${SONAR_SCANNER_URL_UNIVERSAL}"
SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_UNIVERSAL}"
BUILD_WRAPPER_SUFFIX="linux-aarch64"
BUILD_WRAPPER_NAME="build-wrapper-linux-aarch64"
;;
esac
;;
macOS)
SONAR_SCANNER_SUFFIX="macosx"
SONAR_SCANNER_SUFFIX="-macosx"
BUILD_WRAPPER_SUFFIX="macosx-x86"
SONAR_SCANNER_NAME="sonar-scanner"
BUILD_WRAPPER_NAME="build-wrapper-macosx-x86"
Expand All @@ -48,7 +51,7 @@ esac
echo "sonar-scanner-url=${SONAR_SCANNER_URL}"
echo "sonar-scanner-sha=${SONAR_SCANNER_SHA}"

SONAR_SCANNER_DIR="${INSTALL_PATH}/sonar-scanner-${SONAR_SCANNER_VERSION}-${SONAR_SCANNER_SUFFIX}"
SONAR_SCANNER_DIR="${INSTALL_PATH}/sonar-scanner-${SONAR_SCANNER_VERSION}${SONAR_SCANNER_SUFFIX}"
echo "sonar-scanner-dir=${SONAR_SCANNER_DIR}"
echo "sonar-scanner-bin=${SONAR_SCANNER_DIR}/bin/${SONAR_SCANNER_NAME}"

Expand Down
8 changes: 6 additions & 2 deletions scripts/fetch_latest_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ check_status "Failed to fetch latest sonar-scanner version from GitHub API"

echo "sonar-scanner-version=${SONAR_SCANNER_VERSION}"

for OS in windows linux macosx; do
SONAR_SCANNER_URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-${OS}.zip"
for OS in windows linux macosx universal; do
if [[ ${OS} == "universal" ]]; then
SONAR_SCANNER_URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip"
else
SONAR_SCANNER_URL="https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-${OS}.zip"
fi
SONAR_SCANNER_SHA=$(curl -sSL "${SONAR_SCANNER_URL}.sha256")
check_status "Failed to download ${OS} sonar-scanner checksum from '${SONAR_SCANNER_URL}'"

Expand Down
2 changes: 2 additions & 0 deletions sonar-scanner-version
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ sonar-scanner-url-linux=https://binaries.sonarsource.com/Distribution/sonar-scan
sonar-scanner-sha-linux=f4c08ec679eeae34a7a1a5df87ee546c287f4683d1dd86afa0aae50e808e0002
sonar-scanner-url-macosx=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.0.0.4432-macosx.zip
sonar-scanner-sha-macosx=1a492fe70cbb5587ee90344c03a3d18f259dfc9d00a9e1bef946277e89148987
sonar-scanner-url-universal=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.0.0.4432.zip
sonar-scanner-sha-universal=965a18c438a213aa2167b51c793116987bc2a9df9ad245c8e02d3ab3e54022e7

0 comments on commit 52c4955

Please sign in to comment.