Integrate sonarcloud with Github Actions for a Swift project

Hello everyone,

I’m new with using sonarcloud, and more generally to the CI/CD world. I’m an iOS developer and I would like to integrate sonarcloud to a test project via Github Actions.

I’ve created this little project called TestCI, it only contains a TestCI target (a framework) and a test target TestCI-Tests.

My goal is to ensure the following for each pull request happening on this project:

  • All tests pass correctly
  • Linter is fine
  • And code coverage for new lines of code is at least 80%

The last point is where I want to use sonarcloud. Here is my .yml file so far:

name: Pull Request

on:
  pull_request:

jobs:
  build:
    runs-on: macos-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Xcode
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest

      - name: Install dependencies
        run: |
          sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
          sudo xcodebuild -license accept

      - name: TestCI-Tests
        run: xcodebuild test -scheme TestCI-Tests -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest'

  lint:
    runs-on: macos-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Install SwiftLint
        run: brew install swiftlint

      - name: Run SwiftLint
        run: swiftlint
        
  sonarcloud:
    name: SonarCloud
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

I’m sorry, but I’m really confused about what I need to do here for this to work fine. Right now I’m getting this error for the SonarCloud job:

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 6.136s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 8M/48M
ERROR: Project not found. Please check the ‘sonar.projectKey’ and ‘sonar.organization’ properties, the ‘SONAR_TOKEN’ environment variable, or contact the project administrator to check the permissions of the user the token belongs to

Thank you for your help

Create a file called sonar-project.properties in the project root folder with following properties

sonar.projectKey=
sonar.projectName=
sonar.organization=
sonar.sources=
sonar.exclusions=
sonar.javascript.lcov.reportPaths= // this line required for javascript/typescript language

1 Like

Thank you for your answer. I’ve already correctly set this sonar-project.properties file at the root of my project, and added needs: [build] as well for the sonarcloud job.

It correctly starts after the build job has finished, but I’m still getting an error during the SonarCloud Scan action:

Run SonarSource/sonarcloud-github-action@master
/usr/bin/docker run --name cd46cb23ecf2f5bb4a4d8d8875da11210526_2bcede --label 66cd46 --workdir /github/workspace --rm -e "JAVA_HOME" -e "JAVA_HOME_17_X64" -e "GITHUB_TOKEN" -e "SONAR_TOKEN" -e "INPUT_ARGS" -e "INPUT_PROJECTBASEDIR" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/entrypoint.sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/TestCI/TestCI":"/github/workspace" 66cd46:cb23ecf2f5bb4a4d8d8875da11210526 -X
10:12:46.207 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
10:12:46.222 INFO: Project root configuration file: /github/workspace/sonar-project.properties
10:12:46.245 INFO: SonarScanner 5.0.1.3006
10:12:46.245 INFO: Java 17.0.11 Alpine (64-bit)
10:12:46.246 INFO: Linux 6.5.0-1024-azure amd64
10:12:46.366 DEBUG: keyStore is : 
10:12:46.366 DEBUG: keyStore type is : pkcs12
10:12:46.366 DEBUG: keyStore provider is : 
10:12:46.366 DEBUG: init keystore
10:12:46.367 DEBUG: init keymanager of type SunX509
10:12:46.461 DEBUG: Create: /opt/sonar-scanner/.sonar/cache
10:12:46.462 INFO: User cache: /opt/sonar-scanner/.sonar/cache
10:12:46.462 DEBUG: Create: /opt/sonar-scanner/.sonar/cache/_tmp
10:12:46.464 DEBUG: Extract sonar-scanner-api-batch in temp...
10:12:46.467 DEBUG: Get bootstrap index...
10:12:46.467 DEBUG: Download: https://sonarcloud.io/batch/index
10:12:46.954 DEBUG: Get bootstrap completed
10:12:46.957 DEBUG: Download https://sonarcloud.io/batch/file?name=sonarcloud-scanner-engine-11.0.0.124.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache12708082181054234013.tmp
10:12:48.439 DEBUG: Create isolated classloader...
10:12:48.448 DEBUG: Start temp cleaning...
10:12:48.450 DEBUG: Temp cleaning done
10:12:48.450 INFO: Analyzing on SonarCloud
10:12:48.450 INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
10:12:48.451 DEBUG: Work directory: /github/workspace/.scannerwork
10:12:48.452 DEBUG: Execution execute
10:12:48.637 DEBUG: JVM max available memory: 3 GB
10:12:48.791 DEBUG: Sonar User Home: /opt/sonar-scanner/.sonar
10:12:48.791 DEBUG: Initialize DefaultScannerWsClient
10:12:49.024 DEBUG: Loaded [441] system trusted certificates
10:12:49.101 INFO: Load global settings
10:12:49.110 DEBUG: --> GET https://sonarcloud.io/api/settings/values.protobuf
10:12:49.480 DEBUG: <-- 401 https://sonarcloud.io/api/settings/values.protobuf (369ms, 0-byte body)
10:12:49.485 INFO: ------------------------------------------------------------------------
10:12:49.485 INFO: EXECUTION FAILURE
10:12:49.485 INFO: ------------------------------------------------------------------------
10:12:49.485 INFO: Total time: 3.285s
10:12:49.498 ERROR: Error during SonarScanner execution
10:12:49.498 INFO: Final Memory: 8M/40M
10:12:49.498 INFO: ------------------------------------------------------------------------
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.bootstrap.GlobalConfiguration
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)
	at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1026)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1003)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.bootstrap.GlobalServerSettings
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61)
	at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100)
	at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:112)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
	at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
	at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
	at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:50)
	... 31 more
Caused by: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator to check the permissions of the user the token belongs to

The sonar-project.properties file correctly contains my projectKey and organization value.
In the error stack, however, I’m a bit surprised to read: Project root configuration file: /github/workspace/sonar-project.properties.
This file is located at the root of my project. Could this be the cause?

Hi,

Welcome to the community!

Where are you starting analysis from? You should be cd-ed into the project root directory before you run the analysis command.

 
HTH,
Ann

Hi, thanks a lot!

I’m executing this command from the root of my project, pwd gives me the expected path:

Users/rob/XCodeProjects/TestCI

Hi,

I just re-reviewed your OP. For GitHub actions, you actually need to specify your properties in your yaml. Here’s the example from the README

- name: Analyze with SonarCloud
  uses: sonarsource/sonarcloud-github-action@<action version> # Ex: v2.1.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan
  with:
    projectBaseDir: my-custom-directory
    args: >
      -Dsonar.organization=my-organization
      -Dsonar.projectKey=my-projectkey
      -Dsonar.python.coverage.reportPaths=coverage.xml
      -Dsonar.sources=lib/
      -Dsonar.test.exclusions=tests/**
      -Dsonar.tests=tests/
      -Dsonar.verbose=true

 
HTH,
Ann

Hi Ann,

Thank you very much for your help. I think I’m close to succeed but for some reason I’m still having an issue.
As you can see, my project tree is very simple:

Capture d’écran 2024-08-06 à 12.59.19

The ProjectCI folder contains the sources and the Tests one the tests.

Also here is my github action script:

name: Pull Request

on:
  pull_request:

jobs:
  tests:
    runs-on: macos-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Xcode
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest

      - name: Install dependencies
        run: |
          sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
          sudo xcodebuild -license accept

      - name: Run Tests
        run: xcodebuild -scheme ProjectCI -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' -resultBundlePath ./test_result -enableCodeCoverage YES -derivedDataPath . clean build test

      - name: Code coverage
        run: |
          bash xccov-to-sonarqube-generic.sh test_result.xcresult/ >coverage.xml

  sonarcloud:
    runs-on: ubuntu-latest
    needs: [tests]

    steps:
      - name: SonarCloud Analysis
        uses: sonarsource/sonarcloud-github-action@v2.3.0
        with:
          projectBaseDir: .
          args: >
            -Dsonar.organization=robtles
            -Dsonar.projectKey=Robtles_ProjectCI
            -Dsonar.python.coverage.reportPaths=coverage.xml
            -Dsonar.sources=ProjectCI/
            -Dsonar.test.exclusions=Tests/**
            -Dsonar.tests=Tests/
            -Dsonar.verbose=true
            -X
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

But I’m getting an error as a result:

Run sonarsource/sonarcloud-github-action@v2.3.0
  with:
    projectBaseDir: .
    args: -Dsonar.organization=robtles -Dsonar.projectKey=Robtles_ProjectCI -Dsonar.python.coverage.reportPaths=coverage.xml -Dsonar.sources=ProjectCI/ -Dsonar.test.exclusions=Tests/** -Dsonar.tests=Tests/ -Dsonar.verbose=true -X
  
  env:
    GITHUB_TOKEN: ***
    SONAR_TOKEN: ***
/usr/bin/docker run --name eeaa94e6fe2e90a3f4998a50ead473f25c0df_f36bca --label 5eeaa9 --workdir /github/workspace --rm -e "GITHUB_TOKEN" -e "SONAR_TOKEN" -e "INPUT_PROJECTBASEDIR" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "

10:58:09.332 ERROR: Invalid value of sonar.tests for Robtles_ProjectCI
10:58:09.338 INFO: ------------------------------------------------------------------------
10:58:09.338 INFO: EXECUTION FAILURE
10:58:09.338 INFO: ------------------------------------------------------------------------
10:58:09.339 INFO: Total time: 6.853s
10:58:09.361 ERROR: Error during SonarScanner execution
10:58:09.361 INFO: Final Memory: 11M/48M
10:58:09.361 INFO: ------------------------------------------------------------------------
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.ProjectLock
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
	at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:277)
	at org.sonar.scanner.bootstrap.ScannerContainer.doBeforeStart(ScannerContainer.java:175)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:121)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.api.batch.fs.internal.DefaultInputProject
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:50)
	... 22 more
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.api.batch.bootstrap.ProjectReactor
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61)
	at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100)
	at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:112)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
	at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
	at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
	at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:50)
	... 36 more
Caused by: The folder 'Tests/' does not exist for 'Robtles_ProjectCI' (base directory = /github/workspace)
10:58:09.368 DEBUG: Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$290/0x00007fd9e02f8000@290aeb20 during JVM shutdown

I’m a bit confused about what’s wrong now.

Hi,

The example I posted from the README was meant to be just that: an example. So no need for this:

And probably not this (do you have any Python in this project?)

So let’s back up. Can you comment out analysis and sub-in something like

run: |
   echo "$PWD" 
   ls

That should tell us where analysis is kicking off from relative to your project structure.

 
Ann

Thanks again a lot for your help!

I commented the whole Analyze with SonarCloud part and replaced it with the pwd command. Here is the result that I get:

/home/runner/work/ProjectCI/ProjectCI

The ls command doesn’t return anything however.
I don’t know if I’m understanding everything correctly, but I feel like that the project which was generated in the first job (tests) doesn’t exist anymore when I start the second one (the sonarcloud one), because I also tried the pwd/ls command in the first job, and here I correctly see the file tree.

Also, about the python coverage part, I forgot to replace it (I’m following your guide for that). So I plan to replace this:

-Dsonar.python.coverage.reportPaths=coverage.xml

With this:

-Dsonar.coverageReportPaths=coverage.xml

Hi,

So you’re somehow cded into the source directory, it seems.

No wonder the test directory isn’t found.

This is not my area of expertise. And, looking closely at your pipeline, I see

Are you trying to run the different pieces on different machines? Because that’s definitely not gonna work. You need to check out, (build), test, and analyze not just on the same machine but in the same directory.

 
Ann

Sorry if this seems trivial but I’m generally new to CI and this is still pretty confusing for me.

Also, I get this error if I try to run sonarcloud-github-action in the tests job just after the code coverage/test location one, from the macOS machine:

Error: Container action is only supported on Linux

I understand that I need to run this from a Linux machine, but I need to run the xcode part from a macOS machine. So I don’t really know which solution I have here.

Hi,

Okay, let’s back up.

Can you try just doing the checkout and analysis steps on a Linux agent?

 
Ann

Hi, sure. Here is my .yml file now (I’ve removed the coverage argument since it’s not generated any longer):

name: Pull Request

on:
  pull_request:

jobs:
  sonarcloud:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: SonarCloud Analysis
        uses: sonarsource/sonarcloud-github-action@v2.3.0
        with:
          projectBaseDir: .
          args: >
            -Dsonar.organization=robtles
            -Dsonar.projectKey=Robtles_ProjectCI
            -Dsonar.sources=Sources/
            -Dsonar.tests=Tests/
            -Dsonar.verbose=true
            -Dsonar.sourceEncoding=UTF-8
            -Dsonar.language=swift
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

It seems to run fine.

SonarCloud Analysis

Run sonarsource/sonarcloud-github-action@v2.3.0
/usr/bin/docker run --name f12ea61cc864b5bcf41a58b487a2ba66da80a_23efb9 --label 8f12ea --workdir /github/workspace --rm -e "GITHUB_TOKEN" -e "SONAR_TOKEN" -e "INPUT_PROJECTBASEDIR" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/entrypoint.sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/ProjectCI/ProjectCI":"/github/workspace" 8f12ea:61cc864b5bcf41a58b487a2ba66da80a -Dsonar.organization=robtles -Dsonar.projectKey=Robtles_ProjectCI -Dsonar.sources=Sources/ -Dsonar.tests=Tests/ -Dsonar.verbose=true -Dsonar.sourceEncoding=UTF-8 -Dsonar.language=swift
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
12:44:14.148 INFO: SonarScanner 5.0.1.3006
12:44:14.156 INFO: Java 17.0.11 Alpine (64-bit)
12:44:14.157 INFO: Linux 6.5.0-1025-azure amd64
12:44:14.282 DEBUG: keyStore is : 
12:44:14.283 DEBUG: keyStore type is : pkcs12
12:44:14.283 DEBUG: keyStore provider is : 
12:44:14.283 DEBUG: init keystore
12:44:14.283 DEBUG: init keymanager of type SunX509
12:44:14.380 DEBUG: Create: /opt/sonar-scanner/.sonar/cache
12:44:14.381 INFO: User cache: /opt/sonar-scanner/.sonar/cache
12:44:14.381 DEBUG: Create: /opt/sonar-scanner/.sonar/cache/_tmp
12:44:14.384 DEBUG: Extract sonar-scanner-api-batch in temp...
12:44:14.386 DEBUG: Get bootstrap index...
12:44:14.386 DEBUG: Download: https://sonarcloud.io/batch/index
12:44:14.942 DEBUG: Get bootstrap completed
12:44:14.944 DEBUG: Download https://sonarcloud.io/batch/file?name=sonarcloud-scanner-engine-11.0.0.124.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache18155826843436663340.tmp
12:44:16.403 DEBUG: Create isolated classloader...
12:44:16.414 DEBUG: Start temp cleaning...
12:44:16.417 DEBUG: Temp cleaning done
12:44:16.417 INFO: Analyzing on SonarCloud
12:44:16.417 INFO: Default locale: "en_US", source code encoding: "UTF-8"
12:44:16.418 DEBUG: Work directory: /github/workspace/.scannerwork
12:44:16.419 DEBUG: Execution execute
12:44:16.617 DEBUG: JVM max available memory: 3 GB
12:44:16.775 DEBUG: Sonar User Home: /opt/sonar-scanner/.sonar
12:44:16.775 DEBUG: Initialize DefaultScannerWsClient
12:44:17.016 DEBUG: Loaded [441] system trusted certificates
12:44:17.091 INFO: Load global settings
12:44:17.103 DEBUG: --> GET https://sonarcloud.io/api/settings/values.protobuf
12:44:17.482 DEBUG: <-- 200 https://sonarcloud.io/api/settings/values.protobuf (378ms, unknown-length body)
12:44:17.490 INFO: Load global settings (done) | time=399ms
12:44:17.494 INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
12:44:17.496 DEBUG: Initialize DownloadPluginsScannerWsClient
12:44:17.642 DEBUG: Loaded [441] system trusted certificates
12:44:17.646 DEBUG: Create : /opt/sonar-scanner/.sonar/_tmp
12:44:17.646 DEBUG: User cache: /opt/sonar-scanner/.sonar/cache
12:44:17.651 INFO: Loading required plugins
12:44:17.652 INFO: Load plugins index
12:44:22.552 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jt&ps=500&p=1
12:44:22.688 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jt&ps=500&p=1 (136ms, unknown-length body)
12:44:22.690 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jr&ps=500&p=1
12:44:22.811 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jr&ps=500&p=1 (121ms, 6000-byte body)
12:44:22.813 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J8&ps=500&p=1
12:44:22.934 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J8&ps=500&p=1 (120ms, 11-byte body)
12:44:22.934 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jz&ps=500&p=1
12:44:23.058 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jz&ps=500&p=1 (123ms, 288-byte body)
12:44:23.058 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Js&ps=500&p=1
12:44:23.200 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Js&ps=500&p=1 (141ms, unknown-length body)
12:44:23.212 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KC&ps=500&p=1
12:44:23.420 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KC&ps=500&p=1 (207ms, 7589-byte body)
12:44:23.421 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J3&ps=500&p=1
12:44:23.549 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J3&ps=500&p=1 (128ms, unknown-length body)
12:44:23.555 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J9&ps=500&p=1
12:44:23.664 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J9&ps=500&p=1 (109ms, 11-byte body)
12:44:23.665 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jm&ps=500&p=1
12:44:23.840 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jm&ps=500&p=1 (175ms, unknown-length body)
12:44:23.883 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KB&ps=500&p=1
12:44:24.030 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KB&ps=500&p=1 (146ms, unknown-length body)
12:44:24.052 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J-&ps=500&p=1
12:44:24.198 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J-&ps=500&p=1 (145ms, 6405-byte body)
12:44:24.200 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KD&ps=500&p=1
12:44:24.339 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KD&ps=500&p=1 (139ms, unknown-length body)
12:44:24.349 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KF&ps=500&p=1
12:44:24.466 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KF&ps=500&p=1 (117ms, 7367-byte body)
12:44:24.468 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KP&ps=500&p=1
12:44:24.592 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KP&ps=500&p=1 (124ms, 4412-byte body)
12:44:24.594 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J2&ps=500&p=1
12:44:24.717 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J2&ps=500&p=1 (123ms, unknown-length body)
12:44:24.722 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KE&ps=500&p=1
12:44:24.842 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KE&ps=500&p=1 (119ms, 6266-byte body)
12:44:24.843 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KO&ps=500&p=1
12:44:24.976 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KO&ps=500&p=1 (132ms, unknown-length body)
12:44:24.981 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J4&ps=500&p=1
12:44:25.110 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J4&ps=500&p=1 (129ms, 8036-byte body)
12:44:25.112 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KK&ps=500&p=1
12:44:25.272 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KK&ps=500&p=1 (159ms, unknown-length body)
12:44:25.310 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jq&ps=500&p=1
12:44:25.443 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jq&ps=500&p=1 (133ms, unknown-length body)
12:44:25.447 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KA&ps=500&p=1
12:44:25.596 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_KA&ps=500&p=1 (148ms, unknown-length body)
12:44:25.617 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J_&ps=500&p=1
12:44:25.745 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J_&ps=500&p=1 (127ms, unknown-length body)
12:44:25.746 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J1&ps=500&p=1
12:44:25.874 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J1&ps=500&p=1 (127ms, unknown-length body)
12:44:25.875 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J5&ps=500&p=1
12:44:26.013 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_J5&ps=500&p=1 (137ms, unknown-length body)
12:44:26.015 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jo&ps=500&p=1
12:44:26.184 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLZQgu39yo7m_Jo&ps=500&p=1 (168ms, unknown-length body)
12:44:26.205 DEBUG: --> GET https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KG&ps=500&p=1
12:44:26.364 DEBUG: <-- 200 https://sonarcloud.io/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt,deprecatedKeys&activation=true&qprofile=AZEOXeLaQgu39yo7m_KG&ps=500&p=1 (158ms, unknown-length body)
12:44:26.426 INFO: Load active rules (done) | time=5992ms
12:44:26.457 DEBUG: --> GET https://sonarcloud.io/api/languages/list
12:44:26.558 DEBUG: <-- 200 https://sonarcloud.io/api/languages/list (100ms, unknown-length body)
12:44:26.566 INFO: Organization key: robtles
12:44:26.567 INFO: Pull request 1 for merge into main from add_test
12:44:26.573 DEBUG: Declared patterns of language Kubernetes were converted to sonar.lang.patterns.kubernetes : 
12:44:26.573 DEBUG: Declared patterns of language CSS were converted to sonar.lang.patterns.css : **/*.css,**/*.less,**/*.scss,**/*.sass
12:44:26.574 DEBUG: Declared patterns of language Scala were converted to sonar.lang.patterns.scala : **/*.scala
12:44:26.575 DEBUG: Declared patterns of language JSP were converted to sonar.lang.patterns.jsp : **/*.jsp,**/*.jspf,**/*.jspx
12:44:26.575 DEBUG: Declared patterns of language JavaScript were converted to sonar.lang.patterns.js : **/*.js,**/*.jsx,**/*.cjs,**/*.mjs,**/*.vue
12:44:26.575 DEBUG: Declared patterns of language Python were converted to sonar.lang.patterns.py : **/*.py
12:44:26.576 DEBUG: Declared patterns of language Apex were converted to sonar.lang.patterns.apex : **/*.cls,**/*.trigger
12:44:26.576 DEBUG: Declared patterns of language Docker were converted to sonar.lang.patterns.docker : **/Dockerfile,**/*.dockerfile
12:44:26.577 DEBUG: Declared patterns of language PL/SQL were converted to sonar.lang.patterns.plsql : **/*.sql,**/*.tab,**/*.pkb
12:44:26.577 DEBUG: Declared patterns of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
12:44:26.578 DEBUG: Declared patterns of language HTML were converted to sonar.lang.patterns.web : **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml,**/*.cmp,**/*.twig
12:44:26.578 DEBUG: Declared patterns of language Flex were converted to sonar.lang.patterns.flex : **/*.as
12:44:26.579 DEBUG: Declared patterns of language XML were converted to sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl,**/*.config
12:44:26.579 DEBUG: Declared patterns of language JSON were converted to sonar.lang.patterns.json : **/*.json
12:44:26.579 DEBUG: Declared patterns of language Text were converted to sonar.lang.patterns.text : 
12:44:26.580 DEBUG: Declared patterns of language VB.NET were converted to sonar.lang.patterns.vbnet : **/*.vb
12:44:26.580 DEBUG: Declared patterns of language CloudFormation were converted to sonar.lang.patterns.cloudformation : 
12:44:26.580 DEBUG: Declared patterns of language Swift were converted to sonar.lang.patterns.swift : **/*.swift
12:44:26.580 DEBUG: Declared patterns of language YAML were converted to sonar.lang.patterns.yaml : **/*.yaml,**/*.yml
12:44:26.582 DEBUG: Declared patterns of language C++ were converted to sonar.lang.patterns.cpp : **/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp,**/*.ixx,**/*.mxx,**/*.cppm,**/*.ccm,**/*.cxxm,**/*.c++m
12:44:26.582 DEBUG: Declared patterns of language C were converted to sonar.lang.patterns.c : **/*.c,**/*.h
12:44:26.583 DEBUG: Declared patterns of language Go were converted to sonar.lang.patterns.go : **/*.go
12:44:26.584 DEBUG: Declared patterns of language Kotlin were converted to sonar.lang.patterns.kotlin : **/*.kt,**/*.kts
12:44:26.584 DEBUG: Declared patterns of language RPG were converted to sonar.lang.patterns.rpg : **/*.rpg,**/*.rpgle,**/*.sqlrpgle,**/*.rpg,**/*.rpgle,**/*.sqlrpgle
12:44:26.584 DEBUG: Declared patterns of language PL/I were converted to sonar.lang.patterns.pli : **/*.pli
12:44:26.586 DEBUG: Declared patterns of language T-SQL were converted to sonar.lang.patterns.tsql : **/*.tsql
12:44:26.586 DEBUG: Declared patterns of language Vb were converted to sonar.lang.patterns.vb : **/*.bas,**/*.frm,**/*.ctl
12:44:26.587 DEBUG: Declared patterns of language Secrets were converted to sonar.lang.patterns.secrets : 
12:44:26.587 DEBUG: Declared patterns of language Ruby were converted to sonar.lang.patterns.ruby : **/*.rb
12:44:26.587 DEBUG: Declared patterns of language C# were converted to sonar.lang.patterns.cs : **/*.cs,**/*.razor
12:44:26.589 DEBUG: Declared patterns of language COBOL were converted to sonar.lang.patterns.cobol : 
12:44:26.590 DEBUG: Declared patterns of language PHP were converted to sonar.lang.patterns.php : **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
12:44:26.590 DEBUG: Declared patterns of language Terraform were converted to sonar.lang.patterns.terraform : **/*.tf
12:44:26.590 DEBUG: Declared patterns of language AzureResourceManager were converted to sonar.lang.patterns.azureresourcemanager : **/*.bicep
12:44:26.591 DEBUG: Declared patterns of language ABAP were converted to sonar.lang.patterns.abap : **/*.abap,**/*.ab4,**/*.flow,**/*.asprog
12:44:26.591 DEBUG: Declared patterns of language Objective-C were converted to sonar.lang.patterns.objc : **/*.m
12:44:26.591 DEBUG: Declared patterns of language TypeScript were converted to sonar.lang.patterns.ts : **/*.ts,**/*.tsx,**/*.cts,**/*.mts
12:44:26.595 INFO: Preprocessing files...
12:44:26.610 DEBUG: loading config FileBasedConfig[/tmp/jgit/config]
12:44:26.611 DEBUG: readpipe [/usr/bin/git, --version],/usr/bin
12:44:26.621 DEBUG: readpipe may return 'git version 2.43.4'
12:44:26.621 DEBUG: remaining output:

12:44:26.622 DEBUG: readpipe [/usr/bin/git, config, --system, --show-origin, --list, -z],/usr/bin
12:44:26.623 DEBUG: readpipe may return 'null'
12:44:26.624 DEBUG: remaining output:

12:44:26.625 DEBUG: readpipe rc=128
12:44:26.625 DEBUG: Exception caught during execution of command '[/usr/bin/git, config, --system, --show-origin, --list, -z]' in '/usr/bin', return code '128', error message 'fatal: unable to read config file '/etc/gitconfig': No such file or directory
'
12:44:26.626 DEBUG: loading config FileBasedConfig[/tmp/git/config]
12:44:26.626 DEBUG: loading config UserConfigFile[/root/.gitconfig]
12:44:26.659 DEBUG: 12 non excluded files in this Git repository
12:44:26.674 INFO: 1 language detected in 2 preprocessed files
12:44:26.675 INFO: 0 files ignored because of inclusion/exclusion patterns
12:44:26.675 INFO: 0 files ignored because of scm ignore settings
12:44:26.706 INFO: Loading plugins for detected languages
12:44:26.707 DEBUG: Detected languages: [swift]
12:44:26.707 INFO: Load/download plugins
12:44:26.708 DEBUG: Download plugin 'swift' to '/opt/sonar-scanner/.sonar/_tmp/fileCache4933466856586144530.tmp'
12:44:26.708 DEBUG: --> GET https://scanner.sonarcloud.io/plugins/swift/versions/bc6e218260dbb1e6565ecbf4479bed00.jar
12:44:26.717 DEBUG: <-- 200 https://scanner.sonarcloud.io/plugins/swift/versions/bc6e218260dbb1e6565ecbf4479bed00.jar (8ms, 1386363-byte body)
12:44:26.755 INFO: Load/download plugins (done) | time=47ms
12:44:26.756 DEBUG: Optional language-specific plugins not loaded: [abap, sonarapex, csharp, cpp, cobol, dbd, dbdjavafrontend, dbdpythonfrontend, flex, go, web, javasymbolicexecution, java, javascript, kotlin, php, pli, plsql, rpg, ruby, sonarscala, tsql, vbnet, vb, security, securitycsharpfrontend, securityjsfrontend, securityjavafrontend, securityphpfrontend, securitypythonfrontend]
12:44:26.771 DEBUG: Plugins loaded:
12:44:26.772 DEBUG:   * Swift Code Quality and Security 4.12.0.7262 (swift)
12:44:26.807 INFO: Load project repositories
12:44:26.807 DEBUG: --> GET https://sonarcloud.io/batch/project.protobuf?key=Robtles_ProjectCI&branch=main
12:44:26.931 DEBUG: <-- 200 https://sonarcloud.io/batch/project.protobuf?key=Robtles_ProjectCI&branch=main (123ms, 0-byte body)
12:44:26.936 INFO: Load project repositories (done) | time=129ms
12:44:26.937 INFO: SCM collecting changed files in the branch
12:44:26.941 WARN: Could not find ref: main in refs/heads, refs/remotes/upstream or refs/remotes/origin
12:44:26.941 DEBUG: All found refs are:
12:44:26.945 DEBUG: Ref[HEAD=35fbdbba34143156504e97a9931c818b3d28193d(-1)]
12:44:26.945 DEBUG: Ref[refs/remotes/pull/1/merge=35fbdbba34143156504e97a9931c818b3d28193d(-1)]
12:44:26.946 INFO: SCM collecting changed files in the branch (done) | time=9ms
12:44:26.946 DEBUG: SCM information about changed files in the branch is not available
12:44:26.947 INFO: Indexing files...
12:44:26.948 INFO: Project configuration:
12:44:26.948 INFO:   Excluded sources: **/build-wrapper-dump.json
12:44:26.951 DEBUG: 'Sources/Model.swift' indexed with language 'swift'
12:44:26.952 DEBUG: 'Tests/ProjectCITests.swift' indexed as test with language 'swift'
12:44:26.953 INFO: 2 files indexed
12:44:26.957 DEBUG: Available languages:
12:44:26.957 DEBUG:   * Python => "py"
12:44:26.958 DEBUG:   * XML => "xml"
12:44:26.958 DEBUG:   * Terraform => "terraform"
12:44:26.958 DEBUG:   * CloudFormation => "cloudformation"
12:44:26.958 DEBUG:   * Kubernetes => "kubernetes"
12:44:26.958 DEBUG:   * Docker => "docker"
12:44:26.958 DEBUG:   * AzureResourceManager => "azureresourcemanager"
12:44:26.958 DEBUG:   * YAML => "yaml"
12:44:26.958 DEBUG:   * JSON => "json"
12:44:26.958 DEBUG:   * Text => "text"
12:44:26.958 DEBUG:   * Secrets => "secrets"
12:44:26.958 DEBUG:   * Swift => "swift"
12:44:26.959 INFO: Quality profile for swift: Sonar way
12:44:26.959 INFO: ------------- Run sensors on module Robtles_ProjectCI
12:44:26.995 INFO: Load metrics repository
12:44:26.995 DEBUG: --> GET https://sonarcloud.io/api/metrics/search?f=name,description,direction,qualitative&ps=500&p=1
12:44:27.184 DEBUG: <-- 200 https://sonarcloud.io/api/metrics/search?f=name,description,direction,qualitative&ps=500&p=1 (188ms, unknown-length body)
12:44:27.189 INFO: Load metrics repository (done) | time=195ms
12:44:27.193 INFO: Sensor cache enabled
12:44:27.194 DEBUG: Initialize GenericWsClient
12:44:27.301 DEBUG: Loaded [441] system trusted certificates
12:44:27.307 INFO: Load sensor cache
12:44:27.308 DEBUG: --> GET https://api.sonarcloud.io/analysis/sensor-cache/prepare-read?organization=robtles&project=Robtles_ProjectCI&branch=main
12:44:28.401 DEBUG: <-- 200 https://api.sonarcloud.io/analysis/sensor-cache/prepare-read?organization=robtles&project=Robtles_ProjectCI&branch=main (1092ms, 17-byte body)
12:44:28.424 INFO: Load sensor cache (404) | time=1117ms
12:44:28.906 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
12:44:28.907 DEBUG: 'Python Sensor' skipped because there is no related file in current project
12:44:28.907 DEBUG: 'Cobertura Sensor for Python coverage' skipped because there is no related file in current project
12:44:28.907 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
12:44:28.908 DEBUG: 'Import of Pylint issues' skipped because there is no related file in current project
12:44:28.908 DEBUG: 'Import of Bandit issues' skipped because there is no related file in current project
12:44:28.908 DEBUG: 'Import of Flake8 issues' skipped because there is no related file in current project
12:44:28.908 DEBUG: 'Import of Mypy issues' skipped because there is no related file in current project
12:44:28.908 DEBUG: 'Import of Ruff issues' skipped because there is no related file in current project
12:44:28.909 DEBUG: 'XML Sensor' skipped because there is no related file in current project
12:44:28.909 DEBUG: 'IaC Terraform Sensor' skipped because there is no related file in current project
12:44:28.909 DEBUG: 'IaC CloudFormation Sensor' skipped because there is no related file in current project
12:44:28.909 DEBUG: 'IaC Kubernetes Sensor' skipped because there is no related file in current project
12:44:28.910 DEBUG: 'IaC AzureResourceManager Sensor' skipped because there is no related file in current project
12:44:28.910 DEBUG: 'Import of SwiftLint issues' skipped because one of the required properties is missing
12:44:28.912 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
12:44:28.912 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
12:44:28.912 DEBUG: Sensors : JaCoCo XML Report Importer -> Java Config Sensor -> Swift Code Quality and Security -> IaC Docker Sensor -> TextAndSecretsSensor
12:44:28.913 INFO: Sensor JaCoCo XML Report Importer [jacoco]
12:44:28.915 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
12:44:28.915 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
12:44:28.915 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
12:44:28.916 INFO: Sensor Java Config Sensor [iac]
12:44:28.936 INFO: 0 source files to be analyzed
12:44:28.945 INFO: 0/0 source files have been analyzed
12:44:28.946 INFO: Sensor Java Config Sensor [iac] (done) | time=30ms
12:44:28.947 INFO: Sensor Swift Code Quality and Security [swift]
12:44:28.947 INFO: Sensor Swift Code Quality and Security is restricted to changed files only
12:44:28.952 DEBUG: 'Sources/Model.swift' generated metadata with charset 'UTF-8'
12:44:28.954 INFO: 1 source file to be analyzed
12:44:29.713 INFO: 1/1 source file has been analyzed
12:44:29.714 INFO: Sensor Swift Code Quality and Security [swift] (done) | time=767ms
12:44:29.714 INFO: Sensor IaC Docker Sensor [iac]
12:44:29.714 INFO: Sensor IaC Docker Sensor is restricted to changed files only
12:44:29.794 INFO: 0 source files to be analyzed
12:44:29.794 INFO: 0/0 source files have been analyzed
12:44:29.795 INFO: Sensor IaC Docker Sensor [iac] (done) | time=81ms
12:44:29.796 INFO: Sensor TextAndSecretsSensor [text]
12:44:29.797 INFO: Sensor TextAndSecretsSensor is restricted to changed files only
12:44:29.797 INFO: Available processors: 4
12:44:29.798 INFO: Using 4 threads for analysis.
12:44:30.262 DEBUG: git --version returned: git version 2.43.4
12:44:30.263 INFO: Using git CLI to retrieve untracked files
12:44:30.265 DEBUG: Process [git, status, --untracked-files=all, --porcelain] exited with code 128
12:44:30.266 DEBUG: Unable to retrieve git status
12:44:30.266 WARN: Analyzing only language associated files, make sure to run the analysis inside a git repository to make use of inclusions specified via "sonar.text.inclusions"
12:44:30.268 DEBUG: 'Tests/ProjectCITests.swift' generated metadata as test  with charset 'UTF-8'
12:44:30.280 INFO: 2 source files to be analyzed
12:44:30.298 INFO: 2/2 source files have been analyzed
12:44:30.299 INFO: Sensor TextAndSecretsSensor [text] (done) | time=503ms
12:44:30.304 INFO: ------------- Run sensors on project
12:44:30.309 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project
12:44:30.309 DEBUG: Sensors : Zero Coverage Sensor
12:44:30.310 INFO: Sensor Zero Coverage Sensor
12:44:30.316 INFO: Sensor Zero Coverage Sensor (done) | time=6ms
12:44:30.318 INFO: SCM Publisher SCM provider for this project is: git
12:44:30.319 INFO: SCM Publisher 2 source files to be analyzed
12:44:30.321 WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.
12:44:30.325 INFO: SCM Publisher 0/2 source files have been analyzed (done) | time=6ms
12:44:30.325 WARN: Missing blame information for the following files:
12:44:30.326 WARN:   * Tests/ProjectCITests.swift
12:44:30.326 WARN:   * Sources/Model.swift
12:44:30.327 WARN: This may lead to missing/broken features in SonarCloud
12:44:30.329 INFO: CPD Executor Calculating CPD for 1 file
12:44:30.329 DEBUG: Detection of duplications for /github/workspace/Sources/Model.swift
12:44:30.335 INFO: CPD Executor CPD calculation finished (done) | time=6ms
12:44:30.410 INFO: SCM writing changed lines
12:44:30.413 WARN: Could not find ref: main in refs/heads, refs/remotes/upstream or refs/remotes/origin
12:44:30.413 DEBUG: All found refs are:
12:44:30.414 DEBUG: Ref[HEAD=35fbdbba34143156504e97a9931c818b3d28193d(-1)]
12:44:30.415 DEBUG: Ref[refs/remotes/pull/1/merge=35fbdbba34143156504e97a9931c818b3d28193d(-1)]
12:44:30.416 DEBUG: SCM reported changed lines for 0 files in the branch
12:44:30.416 INFO: SCM writing changed lines (done) | time=6ms
12:44:30.419 DEBUG: Could not detect the dotnet / msbuild version
12:44:30.419 DEBUG: MSBuild version NOT found.
12:44:30.488 INFO: Analysis report generated in 152ms, dir size=244 KB
12:44:30.503 INFO: Analysis report compressed in 15ms, zip size=50 KB
12:44:30.503 INFO: Analysis report generated in /github/workspace/.scannerwork/scanner-report
12:44:30.503 DEBUG: Upload report
12:44:30.506 DEBUG: --> POST https://sonarcloud.io/api/ce/submit?organization=robtles&projectKey=Robtles_ProjectCI&characteristic=pullRequest%3D1 (52425-byte body)
12:44:30.873 DEBUG: <-- 200 https://sonarcloud.io/api/ce/submit?organization=robtles&projectKey=Robtles_ProjectCI&characteristic=pullRequest%3D1 (366ms, 44-byte body)
12:44:30.875 INFO: Analysis report uploaded in 372ms
12:44:30.876 DEBUG: Report metadata written to /github/workspace/.scannerwork/report-task.txt
12:44:30.876 INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=Robtles_ProjectCI&pullRequest=1
12:44:30.876 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
12:44:30.876 INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AZEs3paY_6oPpTS3UT1J
12:44:30.878 DEBUG: Post-jobs : 
12:44:30.879 INFO: Analysis total time: 12.143 s
12:44:30.880 INFO: ------------------------------------------------------------------------
12:44:30.881 INFO: EXECUTION SUCCESS
12:44:30.881 INFO: ------------------------------------------------------------------------
12:44:30.881 INFO: Total time: 16.764s
12:44:30.921 INFO: Final Memory: 19M/80M
12:44:30.921 INFO: ------------------------------------------------------------------------
12:44:30.924 DEBUG: Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$290/0x00007fe93f2f5d08@290aeb20 during JVM shutdown

Post SonarCloud Analysis

Post job cleanup.
/usr/bin/docker run --name f12ea61cc864b5bcf41a58b487a2ba66da80a_f725fb --label 8f12ea --workdir /github/workspace --rm -e "GITHUB_TOKEN" -e "SONAR_TOKEN" -e "INPUT_PROJECTBASEDIR" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/cleanup.sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/ProjectCI/ProjectCI":"/github/workspace" 8f12ea:61cc864b5bcf41a58b487a2ba66da80a -Dsonar.organization=robtles -Dsonar.projectKey=Robtles_ProjectCI -Dsonar.sources=Sources/ -Dsonar.tests=Tests/ -Dsonar.verbose=true -Dsonar.sourceEncoding=UTF-8 -Dsonar.language=swift

Post Checkout code

Post job cleanup.
/usr/bin/git version
git version 2.46.0
Temporarily overriding HOME='/home/runner/work/_temp/37e8fd2f-dcdc-4f87-8fd1-a7d0f5a56154' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/ProjectCI/ProjectCI
/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
http.https://github.com/.extraheader
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"

Hi,

So we have analysis. :tada:

Now I suppose you’re constrained to build on macos, and it’s not possible to just run the whole pipeline on Linux? :innocent:

So, this might help:

 
Ann

1 Like

Great, I think I got this to work!

I’ve removed the sonarcloud job from my .yml file, everything is now in the same job from code checkout and coverage to sonar analysis.
In order for sonar-scanner to work, I install it on macos with brew before running it, and it looks like it’s running fine. Here’s my current yml file:

name: Pull Request

on:
  pull_request:

jobs:
  tests:
    runs-on: macos-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Setup Xcode
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest

      - name: Install dependencies
        run: |
          sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
          sudo xcodebuild -license accept

      - name: Run Tests
        run: xcodebuild -scheme ProjectCI -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' -resultBundlePath ./test_result -enableCodeCoverage YES -derivedDataPath . clean build test

      - name: Code coverage
        run: |
          bash xccov-to-sonarqube-generic.sh test_result.xcresult/ >coverage.xml

      - name: Install SonarScanner
        run: |
          brew install sonar-scanner

      - name: SonarCloud Analysis
        run: |
          sonar-scanner \
            -Dsonar.organization={org} \
            -Dsonar.projectKey={project_key} \
            -Dsonar.sources=Sources/ \
            -Dsonar.tests=Tests/ \
            -Dsonar.language=swift \
            -Dsonar.sourceEncoding=UTF-8 \
            -Dsonar.verbose=true \
            -Dsonar.coverageReportPaths=coverage.xml
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

The expected result in my PR:

Do you have any other recommendation about this?

And thank you very much for your patience and your help!

Hi,

Well done!

I think you’ve got it covered. Let us know (in a new topic, please :slight_smile: ) if you have more questions.

 
Ann

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.