diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4416095..66a9873 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,6 +118,8 @@ jobs: SONAR_SCANNER_SHA_LINUX: 'DOWNLOAD-SHA-LINUX' SONAR_SCANNER_URL_MACOSX: 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-vX.Y.Z.MMMM-macosx.zip' SONAR_SCANNER_SHA_MACOSX: 'DOWNLOAD-SHA-MACOSX' + SONAR_SCANNER_URL_UNIVERSAL: 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-vX.Y.Z.MMMM.zip' + SONAR_SCANNER_SHA_UNIVERSAL: 'DOWNLOAD-SHA' steps: - uses: actions/checkout@v3 with: @@ -143,7 +145,7 @@ jobs: grep "build-wrapper-dir=install-directory/build-wrapper-win-x86" output grep "build-wrapper-bin=install-directory/build-wrapper-win-x86/build-wrapper-win-x86-64.exe" output - - name: Linux + - name: Linux_X64 shell: bash env: OS: 'Linux' @@ -163,6 +165,26 @@ jobs: grep "build-wrapper-dir=install-directory/build-wrapper-linux-x86" output grep "build-wrapper-bin=install-directory/build-wrapper-linux-x86/build-wrapper-linux-x86-64" output + - name: Linux_ARM64 + shell: bash + env: + OS: 'Linux' + ARCH: 'ARM64' + run: | + ./scripts/configure_paths.sh > output + grep -v "::error::" output + + echo "- Check sonar-scanner:" + grep "sonar-scanner-url=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-vX.Y.Z.MMMM.zip" output + grep "sonar-scanner-sha=DOWNLOAD-SHA" output + grep "sonar-scanner-dir=install-directory/sonar-scanner-vX.Y.Z.MMMM" output + grep "sonar-scanner-bin=install-directory/sonar-scanner-vX.Y.Z.MMMM/bin/sonar-scanner" output + + echo "- Check build-wrapper:" + grep "build-wrapper-url=http://sonar-host.com/static/cpp/build-wrapper-linux-aarch64.zip" output + grep "build-wrapper-dir=install-directory/build-wrapper-linux-aarch64" output + grep "build-wrapper-bin=install-directory/build-wrapper-linux-aarch64/build-wrapper-linux-aarch64" output + - name: macOSX_X64 shell: bash env: @@ -352,14 +374,14 @@ jobs: - name: sonar-scanner is installed and in PATH run: | - sonar-scanner --help | grep "INFO: usage: sonar-scanner " + sonar-scanner --help | grep "usage: sonar-scanner " - name: sonar-scanner-binary output is correct shell: bash env: BINARY: ${{ steps.run-action.outputs.sonar-scanner-binary }} run: | - "$BINARY" --help | grep "INFO: usage: sonar-scanner " + "$BINARY" --help | grep "usage: sonar-scanner " # build-wrapper does not have --help or equivalent option. # Pass to few arguments and ignore error code diff --git a/action.yml b/action.yml index e660c4f..d07ce6e 100644 --- a/action.yml +++ b/action.yml @@ -30,6 +30,14 @@ runs: shell: bash run: brew install coreutils + # installing jre is required because the non self-contained sonar-scanner-cli is used on Linux ARM64 + - name: Install JRE for linux arm64 + uses: actions/setup-java@v4 + if: runner.os == 'Linux' && runner.arch == 'ARM64' + with: + distribution: 'temurin' + java-version: '17' + - name: Verify and create installation path shell: bash env: @@ -56,6 +64,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 diff --git a/scripts/configure_paths.sh b/scripts/configure_paths.sh index 9e06ddb..83d0be4 100755 --- a/scripts/configure_paths.sh +++ b/scripts/configure_paths.sh @@ -1,13 +1,13 @@ #!/bin/bash -if [[ ${ARCH} != "X64" && ! ( ${OS} == "macOS" && ${ARCH} == "ARM64" ) ]]; then +if [[ ${ARCH} != "X64" && ! (${ARCH} == "ARM64" && (${OS} == "macOS" || ${OS} == "Linux")) ]]; then echo "::error::Architecture '${ARCH}' is unsupported by build-wrapper" exit 1 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" @@ -15,15 +15,26 @@ case ${OS} in SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_WINDOWS}" ;; Linux) - SONAR_SCANNER_SUFFIX="linux" - BUILD_WRAPPER_SUFFIX="linux-x86" + case ${ARCH} in + X64) + SONAR_SCANNER_SUFFIX="-linux" + BUILD_WRAPPER_SUFFIX="linux-x86" + BUILD_WRAPPER_NAME="build-wrapper-linux-x86-64" + SONAR_SCANNER_URL="${SONAR_SCANNER_URL_LINUX}" + SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_LINUX}" + ;; + ARM64) + SONAR_SCANNER_SUFFIX="" + BUILD_WRAPPER_SUFFIX="linux-aarch64" + BUILD_WRAPPER_NAME="build-wrapper-linux-aarch64" + SONAR_SCANNER_URL="${SONAR_SCANNER_URL_UNIVERSAL}" + SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_UNIVERSAL}" + ;; + esac SONAR_SCANNER_NAME="sonar-scanner" - BUILD_WRAPPER_NAME="build-wrapper-linux-x86-64" - SONAR_SCANNER_URL="${SONAR_SCANNER_URL_LINUX}" - SONAR_SCANNER_SHA="${SONAR_SCANNER_SHA_LINUX}" ;; 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" @@ -40,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}" diff --git a/scripts/fetch_latest_version.sh b/scripts/fetch_latest_version.sh index 6177555..fa34973 100755 --- a/scripts/fetch_latest_version.sh +++ b/scripts/fetch_latest_version.sh @@ -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}'" diff --git a/sonar-scanner-version b/sonar-scanner-version index ccddcb0..d8ce38d 100644 --- a/sonar-scanner-version +++ b/sonar-scanner-version @@ -1,7 +1,9 @@ -sonar-scanner-version=5.0.1.3006 -sonar-scanner-url-windows=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-windows.zip -sonar-scanner-sha-windows=bf8b7b30bd5614aaf244fe5aed3e9f7246b080b8ae3534693533fe3aac9c5594 -sonar-scanner-url-linux=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip -sonar-scanner-sha-linux=350dbdb517c10fcb3ce70425db95c415b313cad7296c407d416d88f3d50121f8 -sonar-scanner-url-macosx=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-macosx.zip -sonar-scanner-sha-macosx=ba129044005494f039b41afaad2d949881604e69c6ebe814f4e218c7904a9d2d +sonar-scanner-version=6.0.0.4432 +sonar-scanner-url-windows=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.0.0.4432-windows.zip +sonar-scanner-sha-windows=4773dbafd2ce335c0ccaefd3606742bf59658987b5e3c6aa99e51d7ef57a8f33 +sonar-scanner-url-linux=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.0.0.4432-linux.zip +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