diff --git a/.github/workflows/scanBuild.yml b/.github/workflows/scanBuild.yml index f39506214..b0dd51435 100644 --- a/.github/workflows/scanBuild.yml +++ b/.github/workflows/scanBuild.yml @@ -3,21 +3,26 @@ name: SonarCloud scan # Specify when the Action should be triggered: when a pull request is opened against the 'devel' or 'master' branch on: + push: + branches: [devel, master] pull_request: branches: [devel, master] jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: + # Prepare the enviroment for Sonar scanner - name: Prepare Sonar scanner - run: | - wget -nv https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.0.2311-linux.zip - unzip -q sonar-scanner-cli-4.6.0.2311-linux.zip - echo "${PWD}/sonar-scanner-4.6.0.2311-linux/bin/" >> $GITHUB_PATH working-directory: ${{ env.BUILD_DIR }} - - name: SonarCloud Scan run: | - sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=i2pc -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=Xmipp + wget -nv -O sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ vars.SONAR_VERSION }}-linux.zip + unzip -q sonar-scanner-cli.zip -d sonar-scanner-cli + mv sonar-scanner-cli/*/* sonar-scanner-cli/ + echo "${PWD}/sonar-scanner-cli/bin/" >> $GITHUB_PATH + # Run the SonarCloud Scan + - name: SonarCloud Scan env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=i2pc -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=XmippCore