]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15028 C-Family config for GitHub Actions
authorJeremy Davis <jeremy.davis@sonarsource.com>
Wed, 16 Jun 2021 08:36:31 +0000 (10:36 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Jun 2021 20:03:14 +0000 (20:03 +0000)
server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/components/YamlFileStep.tsx
server/sonar-web/src/main/js/components/tutorials/components/__tests__/YamlFileStep-test.tsx
server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/YamlFileStep-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/github-action/AnalysisCommand.tsx
server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/AnalysisCommand-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/GitHubActionTutorial-test.tsx.snap
server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/CFamily-test.tsx.snap [new file with mode: 0644]

index d3e72b5eb64a056e90a38db88af89c2d0f0cbd8d..45e2b22a3674e96f53474a0d77e0393e6ae12a4f 100644 (file)
@@ -73,9 +73,9 @@ exports[`should render correctly: repo variable step content 1`] = `
 `;
 
 exports[`should render correctly: yaml file step content 1`] = `
-<YamlFileStep
+<Connect(withCLanguageFeature(YamlFileStep))
   alm="bitbucketcloud"
 >
   [Function]
-</YamlFileStep>
+</Connect(withCLanguageFeature(YamlFileStep))>
 `;
index 88026e76c98a278cf8d70595e401ae5352531a57..1c28586d3e81d32338930420a63f2be64af3885e 100644 (file)
@@ -20,6 +20,7 @@
 import * as React from 'react';
 import { translate } from 'sonar-ui-common/helpers/l10n';
 import { AlmKeys } from '../../../types/alm-settings';
+import { withCLanguageFeature } from '../../hoc/withCLanguageFeature';
 import RenderOptions from '../components/RenderOptions';
 import { BuildTools } from '../types';
 import AllSet from './AllSet';
@@ -27,6 +28,7 @@ import AllSet from './AllSet';
 export interface YamlFileStepProps {
   alm: AlmKeys;
   children?: (buildTool?: BuildTools) => React.ReactElement<{}>;
+  hasCLanguageFeature: boolean;
 }
 
 export interface AnalysisCommandProps {
@@ -35,9 +37,15 @@ export interface AnalysisCommandProps {
   component: T.Component;
 }
 
-export default function YamlFileStep(props: YamlFileStepProps) {
-  const { alm, children } = props;
-  const buildTools = [BuildTools.Maven, BuildTools.Gradle, BuildTools.DotNet, BuildTools.Other];
+export function YamlFileStep(props: YamlFileStepProps) {
+  const { alm, children, hasCLanguageFeature } = props;
+
+  const buildTools = [BuildTools.Maven, BuildTools.Gradle, BuildTools.DotNet];
+  if (hasCLanguageFeature) {
+    buildTools.push(BuildTools.CFamily);
+  }
+  buildTools.push(BuildTools.Other);
+
   const [buildToolSelected, setBuildToolSelected] = React.useState<BuildTools>();
 
   return (
@@ -65,3 +73,5 @@ export default function YamlFileStep(props: YamlFileStepProps) {
     </>
   );
 }
+
+export default withCLanguageFeature(YamlFileStep);
index 94bb3e9c7143b70eb1954a6cf2bf045a8b6f9b97..936287cac5538b95921ac9e7a506c81c5fb9ec68 100644 (file)
 import { shallow } from 'enzyme';
 import * as React from 'react';
 import { AlmKeys } from '../../../../types/alm-settings';
-import YamlFileStep, { YamlFileStepProps } from '../YamlFileStep';
+import { YamlFileStep, YamlFileStepProps } from '../YamlFileStep';
 
 it('should render correctly', () => {
-  expect(shallowRender()).toMatchSnapshot();
+  expect(shallowRender()).toMatchSnapshot('C unavailable');
+  expect(shallowRender({ hasCLanguageFeature: true })).toMatchSnapshot('C available');
 });
 
 function shallowRender(props: Partial<YamlFileStepProps> = {}) {
-  return shallow<YamlFileStepProps>(<YamlFileStep alm={AlmKeys.GitHub} {...props} />);
+  return shallow<YamlFileStepProps>(
+    <YamlFileStep alm={AlmKeys.GitHub} hasCLanguageFeature={false} {...props} />
+  );
 }
index 4682c79068d13044d0b6d926c3dee6f76a06e1b9..c33c7635df3aec9fd0b54bd31404f969c9fb89d5 100644 (file)
@@ -1,6 +1,32 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`should render correctly 1`] = `
+exports[`should render correctly: C available 1`] = `
+<Fragment>
+  <ol
+    className="list-styled big-spacer-top big-spacer-bottom"
+  >
+    <li>
+      onboarding.build
+      <RenderOptions
+        name="language"
+        onCheck={[Function]}
+        optionLabelKey="onboarding.build"
+        options={
+          Array [
+            "maven",
+            "gradle",
+            "dotnet",
+            "cfamily",
+            "other",
+          ]
+        }
+      />
+    </li>
+  </ol>
+</Fragment>
+`;
+
+exports[`should render correctly: C unavailable 1`] = `
 <Fragment>
   <ol
     className="list-styled big-spacer-top big-spacer-bottom"
index c0147f4be568828cf2264e45fb2d95b205709fc1..40e2333e4e708f5bc8f7db050db54747884ee210 100644 (file)
@@ -20,6 +20,7 @@
 import * as React from 'react';
 import { withAppState } from '../../hoc/withAppState';
 import { BuildTools } from '../types';
+import CFamily from './commands/CFamily';
 import DotNet from './commands/DotNet';
 import Gradle from './commands/Gradle';
 import JavaMaven from './commands/JavaMaven';
@@ -49,6 +50,8 @@ export function AnalysisCommand(props: AnalysisCommandProps) {
       return <Gradle branchesEnabled={branchesEnabled} component={component} />;
     case BuildTools.DotNet:
       return <DotNet branchesEnabled={branchesEnabled} component={component} />;
+    case BuildTools.CFamily:
+      return <CFamily branchesEnabled={branchesEnabled} component={component} />;
     case BuildTools.Other:
       return <Others branchesEnabled={branchesEnabled} component={component} />;
   }
index 4f86247edbf8cdd1a2ba4ec96db5f6014eaa5ebf..99f415c28cbf36d729f88e5d429d9ae5551dad5f 100644 (file)
@@ -1,6 +1,31 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`should render correctly for "cfamily" 1`] = `""`;
+exports[`should render correctly for "cfamily" 1`] = `
+<CFamily
+  component={
+    Object {
+      "breadcrumbs": Array [],
+      "key": "my-project",
+      "name": "MyProject",
+      "qualifier": "TRK",
+      "qualityGate": Object {
+        "isDefault": true,
+        "key": "30",
+        "name": "Sonar way",
+      },
+      "qualityProfiles": Array [
+        Object {
+          "deleted": false,
+          "key": "my-qp",
+          "language": "ts",
+          "name": "Sonar way",
+        },
+      ],
+      "tags": Array [],
+    }
+  }
+/>
+`;
 
 exports[`should render correctly for "dotnet" 1`] = `
 <DotNet
index 253a32dc6a61387f0ff6a24c0f23bd07010ee08b..a4e2065b68b3ac40968aa85a5c5c43ec3790d106 100644 (file)
@@ -73,9 +73,9 @@ exports[`should render correctly: secrets step content 1`] = `
 `;
 
 exports[`should render correctly: yaml file step content 1`] = `
-<YamlFileStep
+<Connect(withCLanguageFeature(YamlFileStep))
   alm="github"
 >
   [Function]
-</YamlFileStep>
+</Connect(withCLanguageFeature(YamlFileStep))>
 `;
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/CFamily.tsx
new file mode 100644 (file)
index 0000000..f673d58
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import * as React from 'react';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+import { CompilationInfo } from '../../components/CompilationInfo';
+import CreateYmlFile from '../../components/CreateYmlFile';
+import DefaultProjectKey from '../../components/DefaultProjectKey';
+import RenderOptions from '../../components/RenderOptions';
+import { OSs } from '../../types';
+
+export interface CFamilyProps {
+  branchesEnabled?: boolean;
+  component: T.Component;
+}
+
+const STEPS = {
+  [OSs.Linux]: `steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Download and install the build wrapper, build the project
+        run: |
+          mkdir $HOME/.sonar
+          curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-linux-x86.zip
+          unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
+          $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
+        env:
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+
+      - name: SonarQube analysis
+        uses: SonarSource/sonarqube-scan-action@v1.0.0
+        with:
+          args: -Dsonar.cfamily.build-wrapper-output=bw-output
+        env:
+          SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}`,
+  [OSs.MacOS]: `steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Download and install the build wrapper
+        run: |
+          mkdir $HOME/.sonar
+          curl -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-macosx-x86.zip
+          unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/
+        env:
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+
+      - name: Download and install the SonarScanner
+        run: |
+          curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip
+          unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+
+      - name: Build and analyse the project
+        run: |
+          # Potential improvement : add these paths to the PATH env var.
+          $HOME/.sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir bw-output <your clean build command>
+          $HOME/.sonar/sonar-scanner-4.6.2.2472-macosx/bin/sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output
+        env:
+          SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}`,
+  [OSs.Windows]: `steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Download and install the build wrapper
+        shell: powershell
+        run: |
+          $path = "$HOME/.sonar/build-wrapper-win-x86.zip"
+          mkdir $HOME/.sonar
+          [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+          (New-Object System.Net.WebClient).DownloadFile("\${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-win-x86.zip", $path)
+          Add-Type -AssemblyName System.IO.Compression.FileSystem
+          [System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
+        env:
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+
+      - name: Download and install the SonarScanner
+        shell: powershell
+        run: |
+          $path = "$HOME/.sonar/sonar-scanner-cli-4.6.2.2472-windows.zip"
+          [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+          (New-Object System.Net.WebClient).DownloadFile("https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-windows.zip", $path)
+          Add-Type -AssemblyName System.IO.Compression.FileSystem
+          [System.IO.Compression.ZipFile]::ExtractToDirectory($path, "$HOME/.sonar")
+
+      - name: Build and analyse the project
+        shell: powershell
+        run: |
+          $env:Path += ";$HOME/.sonar/build-wrapper-win-x86;$HOME/.sonar/sonar-scanner-4.6.2.2472-windows/bin"
+          build-wrapper-win-x86-64 --out-dir bw-output <your clean build command>
+          sonar-scanner.bat "-Dsonar.cfamily.build-wrapper-output=bw-output"
+        env:
+          SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}`
+};
+
+const cfamilyYamlTemplate = (branchesEnabled: boolean, os: OSs) => `name: Build
+on:
+  push:
+    branches:
+      - master
+${branchesEnabled ? '  pull_request:\n    types: [opened, synchronize, reopened]' : ''}
+
+jobs:
+  build:
+    runs-on: <image ready for your build toolchain>
+    ${STEPS[os]}
+`;
+
+export default function CFamily(props: CFamilyProps) {
+  const { component, branchesEnabled } = props;
+  const [os, setOs] = React.useState<undefined | OSs>();
+
+  return (
+    <>
+      <DefaultProjectKey component={component} />
+      <li>
+        <span>{translate('onboarding.build.other.os')}</span>
+        <RenderOptions
+          checked={os}
+          name="os"
+          onCheck={(value: OSs) => setOs(value)}
+          optionLabelKey="onboarding.build.other.os"
+          options={Object.values(OSs)}
+        />
+      </li>
+      {os && (
+        <>
+          <CreateYmlFile
+            yamlFileName=".github/workflows/build.yml"
+            yamlTemplate={cfamilyYamlTemplate(!!branchesEnabled, os)}
+          />
+          <CompilationInfo className="abs-width-800" />
+        </>
+      )}
+    </>
+  );
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/CFamily-test.tsx
new file mode 100644 (file)
index 0000000..c809742
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import { shallow } from 'enzyme';
+import * as React from 'react';
+import { mockComponent } from '../../../../../helpers/testMocks';
+import RenderOptions from '../../../components/RenderOptions';
+import { OSs } from '../../../types';
+import CFamily, { CFamilyProps } from '../CFamily';
+
+it('should render correctly', () => {
+  expect(shallowRender()).toMatchSnapshot();
+});
+
+it.each([
+  [OSs.Linux, false],
+  [OSs.MacOS, true],
+  [OSs.Windows, true]
+])('should render correctly for %s', (os: OSs, branchesEnabled: boolean) => {
+  const wrapper = shallowRender({ branchesEnabled });
+  wrapper
+    .find(RenderOptions)
+    .props()
+    .onCheck(os);
+  expect(wrapper).toMatchSnapshot(`branches ${branchesEnabled ? 'enabled' : 'disabled'}`);
+});
+
+function shallowRender(props: Partial<CFamilyProps> = {}) {
+  return shallow<CFamilyProps>(
+    <CFamily branchesEnabled={true} component={mockComponent()} {...props} />
+  );
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/CFamily-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/__tests__/__snapshots__/CFamily-test.tsx.snap
new file mode 100644 (file)
index 0000000..6e48693
--- /dev/null
@@ -0,0 +1,326 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<Fragment>
+  <DefaultProjectKey
+    component={
+      Object {
+        "breadcrumbs": Array [],
+        "key": "my-project",
+        "name": "MyProject",
+        "qualifier": "TRK",
+        "qualityGate": Object {
+          "isDefault": true,
+          "key": "30",
+          "name": "Sonar way",
+        },
+        "qualityProfiles": Array [
+          Object {
+            "deleted": false,
+            "key": "my-qp",
+            "language": "ts",
+            "name": "Sonar way",
+          },
+        ],
+        "tags": Array [],
+      }
+    }
+  />
+  <li>
+    <span>
+      onboarding.build.other.os
+    </span>
+    <RenderOptions
+      name="os"
+      onCheck={[Function]}
+      optionLabelKey="onboarding.build.other.os"
+      options={
+        Array [
+          "linux",
+          "win",
+          "mac",
+        ]
+      }
+    />
+  </li>
+</Fragment>
+`;
+
+exports[`should render correctly for linux: branches disabled 1`] = `
+<Fragment>
+  <DefaultProjectKey
+    component={
+      Object {
+        "breadcrumbs": Array [],
+        "key": "my-project",
+        "name": "MyProject",
+        "qualifier": "TRK",
+        "qualityGate": Object {
+          "isDefault": true,
+          "key": "30",
+          "name": "Sonar way",
+        },
+        "qualityProfiles": Array [
+          Object {
+            "deleted": false,
+            "key": "my-qp",
+            "language": "ts",
+            "name": "Sonar way",
+          },
+        ],
+        "tags": Array [],
+      }
+    }
+  />
+  <li>
+    <span>
+      onboarding.build.other.os
+    </span>
+    <RenderOptions
+      checked="linux"
+      name="os"
+      onCheck={[Function]}
+      optionLabelKey="onboarding.build.other.os"
+      options={
+        Array [
+          "linux",
+          "win",
+          "mac",
+        ]
+      }
+    />
+  </li>
+  <CreateYmlFile
+    yamlFileName=".github/workflows/build.yml"
+    yamlTemplate="name: Build
+on:
+  push:
+    branches:
+      - master
+
+
+jobs:
+  build:
+    runs-on: <image ready for your build toolchain>
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Download and install the build wrapper, build the project
+        run: |
+          mkdir $HOME/.sonar
+          curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-linux-x86.zip
+          unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
+          $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output <your clean build command>
+        env:
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+
+      - name: SonarQube analysis
+        uses: SonarSource/sonarqube-scan-action@v1.0.0
+        with:
+          args: -Dsonar.cfamily.build-wrapper-output=bw-output
+        env:
+          SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+"
+  />
+  <CompilationInfo
+    className="abs-width-800"
+  />
+</Fragment>
+`;
+
+exports[`should render correctly for mac: branches enabled 1`] = `
+<Fragment>
+  <DefaultProjectKey
+    component={
+      Object {
+        "breadcrumbs": Array [],
+        "key": "my-project",
+        "name": "MyProject",
+        "qualifier": "TRK",
+        "qualityGate": Object {
+          "isDefault": true,
+          "key": "30",
+          "name": "Sonar way",
+        },
+        "qualityProfiles": Array [
+          Object {
+            "deleted": false,
+            "key": "my-qp",
+            "language": "ts",
+            "name": "Sonar way",
+          },
+        ],
+        "tags": Array [],
+      }
+    }
+  />
+  <li>
+    <span>
+      onboarding.build.other.os
+    </span>
+    <RenderOptions
+      checked="mac"
+      name="os"
+      onCheck={[Function]}
+      optionLabelKey="onboarding.build.other.os"
+      options={
+        Array [
+          "linux",
+          "win",
+          "mac",
+        ]
+      }
+    />
+  </li>
+  <CreateYmlFile
+    yamlFileName=".github/workflows/build.yml"
+    yamlTemplate="name: Build
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    types: [opened, synchronize, reopened]
+
+jobs:
+  build:
+    runs-on: <image ready for your build toolchain>
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Download and install the build wrapper
+        run: |
+          mkdir $HOME/.sonar
+          curl -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip \${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-macosx-x86.zip
+          unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/
+        env:
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+
+      - name: Download and install the SonarScanner
+        run: |
+          curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-macosx.zip
+          unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
+
+      - name: Build and analyse the project
+        run: |
+          # Potential improvement : add these paths to the PATH env var.
+          $HOME/.sonar/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir bw-output <your clean build command>
+          $HOME/.sonar/sonar-scanner-4.6.2.2472-macosx/bin/sonar-scanner -Dsonar.cfamily.build-wrapper-output=bw-output
+        env:
+          SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+"
+  />
+  <CompilationInfo
+    className="abs-width-800"
+  />
+</Fragment>
+`;
+
+exports[`should render correctly for win: branches enabled 1`] = `
+<Fragment>
+  <DefaultProjectKey
+    component={
+      Object {
+        "breadcrumbs": Array [],
+        "key": "my-project",
+        "name": "MyProject",
+        "qualifier": "TRK",
+        "qualityGate": Object {
+          "isDefault": true,
+          "key": "30",
+          "name": "Sonar way",
+        },
+        "qualityProfiles": Array [
+          Object {
+            "deleted": false,
+            "key": "my-qp",
+            "language": "ts",
+            "name": "Sonar way",
+          },
+        ],
+        "tags": Array [],
+      }
+    }
+  />
+  <li>
+    <span>
+      onboarding.build.other.os
+    </span>
+    <RenderOptions
+      checked="win"
+      name="os"
+      onCheck={[Function]}
+      optionLabelKey="onboarding.build.other.os"
+      options={
+        Array [
+          "linux",
+          "win",
+          "mac",
+        ]
+      }
+    />
+  </li>
+  <CreateYmlFile
+    yamlFileName=".github/workflows/build.yml"
+    yamlTemplate="name: Build
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    types: [opened, synchronize, reopened]
+
+jobs:
+  build:
+    runs-on: <image ready for your build toolchain>
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+
+      - name: Download and install the build wrapper
+        shell: powershell
+        run: |
+          $path = \\"$HOME/.sonar/build-wrapper-win-x86.zip\\"
+          mkdir $HOME/.sonar
+          [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+          (New-Object System.Net.WebClient).DownloadFile(\\"\${{ secrets.SONAR_HOST_URL }}/static/cpp/build-wrapper-win-x86.zip\\", $path)
+          Add-Type -AssemblyName System.IO.Compression.FileSystem
+          [System.IO.Compression.ZipFile]::ExtractToDirectory($path, \\"$HOME/.sonar\\")
+        env:
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+
+      - name: Download and install the SonarScanner
+        shell: powershell
+        run: |
+          $path = \\"$HOME/.sonar/sonar-scanner-cli-4.6.2.2472-windows.zip\\"
+          [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+          (New-Object System.Net.WebClient).DownloadFile(\\"https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-windows.zip\\", $path)
+          Add-Type -AssemblyName System.IO.Compression.FileSystem
+          [System.IO.Compression.ZipFile]::ExtractToDirectory($path, \\"$HOME/.sonar\\")
+
+      - name: Build and analyse the project
+        shell: powershell
+        run: |
+          $env:Path += \\";$HOME/.sonar/build-wrapper-win-x86;$HOME/.sonar/sonar-scanner-4.6.2.2472-windows/bin\\"
+          build-wrapper-win-x86-64 --out-dir bw-output <your clean build command>
+          sonar-scanner.bat \\"-Dsonar.cfamily.build-wrapper-output=bw-output\\"
+        env:
+          SONAR_TOKEN: \${{ secrets.SONAR_TOKEN }}
+          SONAR_HOST_URL: \${{ secrets.SONAR_HOST_URL }}
+"
+  />
+  <CompilationInfo
+    className="abs-width-800"
+  />
+</Fragment>
+`;