import { getHostUrl } from '../../../../helpers/urls';
import CodeSnippet from '../../../common/CodeSnippet';
import { CompilationInfo } from '../../components/CompilationInfo';
+import GithubCFamilyExampleRepositories from '../../components/GithubCFamilyExampleRepositories';
import RenderOptions from '../../components/RenderOptions';
import SentenceWithHighlights from '../../components/SentenceWithHighlights';
-import { BuildTools, OSs } from '../../types';
+import { BuildTools, OSs, TutorialModes } from '../../types';
import AlertClassicEditor from './AlertClassicEditor';
import PrepareAnalysisCommand, { PrepareType } from './PrepareAnalysisCommand';
import PublishSteps from './PublishSteps';
{os && (
<>
+ <GithubCFamilyExampleRepositories
+ className="big-spacer-top abs-width-600"
+ os={os}
+ ci={TutorialModes.AzurePipelines}
+ />
<AlertClassicEditor />
<ol className="list-styled big-spacer-top">
<li>
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="azure-pipelines"
+ className="big-spacer-top abs-width-600"
+ os="linux"
+ />
<AlertClassicEditor />
<ol
className="list-styled big-spacer-top"
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="azure-pipelines"
+ className="big-spacer-top abs-width-600"
+ os="mac"
+ />
<AlertClassicEditor />
<ol
className="list-styled big-spacer-top"
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="azure-pipelines"
+ className="big-spacer-top abs-width-600"
+ os="win"
+ />
<AlertClassicEditor />
<ol
className="list-styled big-spacer-top"
} from '../../../types/alm-settings';
import AllSetStep from '../components/AllSetStep';
import FinishButton from '../components/FinishButton';
+import GithubCFamilyExampleRepositories from '../components/GithubCFamilyExampleRepositories';
import Step from '../components/Step';
import YamlFileStep from '../components/YamlFileStep';
+import { BuildTools, TutorialModes } from '../types';
import AnalysisCommand from './AnalysisCommand';
import RepositoryVariables from './RepositoryVariables';
<YamlFileStep>
{buildTool => (
<>
+ {buildTool === BuildTools.CFamily && (
+ <GithubCFamilyExampleRepositories
+ className="big-spacer-top"
+ ci={TutorialModes.BitbucketPipelines}
+ />
+ )}
<AnalysisCommand buildTool={buildTool} component={component} />
<FinishButton onClick={() => setStep(Steps.ALL_SET)} />
</>
--- /dev/null
+/*
+ * 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.
+ */
+
+.github-cfamily-example-repositories-box {
+ box-sizing: border-box;
+}
--- /dev/null
+/*
+ * 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 classNames from 'classnames';
+import React from 'react';
+import { translate } from '../../../helpers/l10n';
+import { getBaseUrl } from '../../../helpers/system';
+import { OSs, TutorialModes } from '../types';
+import './GithubCFamilyExampleRepositories.css';
+
+export interface GithubCFamilyExampleRepositoriesProps {
+ className?: string;
+ os?: OSs;
+ ci?: TutorialModes;
+}
+
+const OS_SEARCH_MAP = {
+ [OSs.Linux]: 'linux',
+ [OSs.Windows]: 'windows',
+ [OSs.MacOS]: 'macos'
+};
+
+const CI_SEARCH_MAP = {
+ [TutorialModes.Jenkins]: 'jenkins',
+ [TutorialModes.AzurePipelines]: 'azure',
+ [TutorialModes.GitHubActions]: 'gh-actions',
+ [TutorialModes.GitLabCI]: 'gitlab',
+ [TutorialModes.BitbucketPipelines]: 'bitbucket',
+ [TutorialModes.Manual]: 'manual',
+ [TutorialModes.OtherCI]: 'manual'
+};
+
+export default function GithubCFamilyExampleRepositories(
+ props: GithubCFamilyExampleRepositoriesProps
+) {
+ const { className, os, ci } = props;
+ const queryParams = ['sq', os ? OS_SEARCH_MAP[os] : undefined, ci ? CI_SEARCH_MAP[ci] : undefined]
+ .filter(s => !!s)
+ .join('+');
+ const link = `https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=${queryParams}`;
+
+ return (
+ <div
+ className={classNames(
+ 'github-cfamily-example-repositories-box big-padded boxed-group',
+ className
+ )}>
+ <div className="display-flex-center">
+ <img
+ alt="" // Should be ignored by screen readers
+ className="spacer-right"
+ height={20}
+ src={`${getBaseUrl()}/images/alm/github.svg`}
+ />
+ <a className="spacer-left big" rel="noopener noreferrer" target="_blank" href={link}>
+ sonarsource-cfamily-examples
+ </a>
+ </div>
+ <p className="spacer-top">
+ {translate('onboarding.tutorial.cfamily.examples_repositories_description')}
+ </p>
+ </div>
+ );
+}
hasCLanguageFeature: boolean;
}
-export interface AnalysisCommandProps {
- appState: T.AppState;
- buildTool?: BuildTools;
- component: T.Component;
-}
-
export function YamlFileStep(props: YamlFileStepProps) {
const { children, hasCLanguageFeature } = props;
const [buildToolSelected, setBuildToolSelected] = React.useState<BuildTools>();
return (
- <>
- <ol className="list-styled big-spacer-top big-spacer-bottom">
- <li>
- {translate('onboarding.build')}
-
- <RenderOptions
- checked={buildToolSelected}
- name="language"
- onCheck={value => setBuildToolSelected(value as BuildTools)}
- options={buildTools}
- optionLabelKey="onboarding.build"
- />
- </li>
- {children && buildToolSelected && children(buildToolSelected)}
- </ol>
- </>
+ <ol className="list-styled big-spacer-top big-spacer-bottom">
+ <li className="abs-width-600">
+ {translate('onboarding.build')}
+ <RenderOptions
+ checked={buildToolSelected}
+ name="language"
+ onCheck={value => setBuildToolSelected(value as BuildTools)}
+ options={buildTools}
+ optionLabelKey="onboarding.build"
+ />
+ </li>
+ {children && buildToolSelected && children(buildToolSelected)}
+ </ol>
);
}
--- /dev/null
+/*
+ * 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 { OSs, TutorialModes } from '../../types';
+import GithubCFamilyExampleRepositories, {
+ GithubCFamilyExampleRepositoriesProps
+} from '../GithubCFamilyExampleRepositories';
+
+it('should render correctly', () => {
+ expect(shallowRender()).toMatchSnapshot();
+ expect(shallowRender({ os: OSs.MacOS, ci: TutorialModes.AzurePipelines })).toMatchSnapshot();
+});
+
+function shallowRender(props: Partial<GithubCFamilyExampleRepositoriesProps> = {}) {
+ return shallow<GithubCFamilyExampleRepositoriesProps>(
+ <GithubCFamilyExampleRepositories className="test-class" {...props} />
+ );
+}
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<div
+ className="github-cfamily-example-repositories-box big-padded boxed-group test-class"
+>
+ <div
+ className="display-flex-center"
+ >
+ <img
+ alt=""
+ className="spacer-right"
+ height={20}
+ src="/images/alm/github.svg"
+ />
+ <a
+ className="spacer-left big"
+ href="https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=sq"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ sonarsource-cfamily-examples
+ </a>
+ </div>
+ <p
+ className="spacer-top"
+ >
+ onboarding.tutorial.cfamily.examples_repositories_description
+ </p>
+</div>
+`;
+
+exports[`should render correctly 2`] = `
+<div
+ className="github-cfamily-example-repositories-box big-padded boxed-group test-class"
+>
+ <div
+ className="display-flex-center"
+ >
+ <img
+ alt=""
+ className="spacer-right"
+ height={20}
+ src="/images/alm/github.svg"
+ />
+ <a
+ className="spacer-left big"
+ href="https://github.com/orgs/sonarsource-cfamily-examples/repositories?q=sq+macos+azure"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ sonarsource-cfamily-examples
+ </a>
+ </div>
+ <p
+ className="spacer-top"
+ >
+ onboarding.tutorial.cfamily.examples_repositories_description
+ </p>
+</div>
+`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render child correctly: C unavailable 1`] = `
-<Fragment>
- <ol
- className="list-styled big-spacer-top big-spacer-bottom"
+<ol
+ className="list-styled big-spacer-top big-spacer-bottom"
+>
+ <li
+ className="abs-width-600"
>
- <li>
- onboarding.build
- <RenderOptions
- name="language"
- onCheck={[Function]}
- optionLabelKey="onboarding.build"
- options={
- Array [
- "maven",
- "gradle",
- "dotnet",
- "other",
- ]
- }
- />
- </li>
- </ol>
-</Fragment>
+ onboarding.build
+ <RenderOptions
+ name="language"
+ onCheck={[Function]}
+ optionLabelKey="onboarding.build"
+ options={
+ Array [
+ "maven",
+ "gradle",
+ "dotnet",
+ "other",
+ ]
+ }
+ />
+ </li>
+</ol>
`;
exports[`should render correctly: C available 1`] = `
-<Fragment>
- <ol
- className="list-styled big-spacer-top big-spacer-bottom"
+<ol
+ className="list-styled big-spacer-top big-spacer-bottom"
+>
+ <li
+ className="abs-width-600"
>
- <li>
- onboarding.build
- <RenderOptions
- name="language"
- onCheck={[Function]}
- optionLabelKey="onboarding.build"
- options={
- Array [
- "maven",
- "gradle",
- "dotnet",
- "cfamily",
- "other",
- ]
- }
- />
- </li>
- </ol>
-</Fragment>
+ onboarding.build
+ <RenderOptions
+ name="language"
+ onCheck={[Function]}
+ optionLabelKey="onboarding.build"
+ options={
+ Array [
+ "maven",
+ "gradle",
+ "dotnet",
+ "cfamily",
+ "other",
+ ]
+ }
+ />
+ </li>
+</ol>
`;
exports[`should render correctly: C unavailable 1`] = `
-<Fragment>
- <ol
- className="list-styled big-spacer-top big-spacer-bottom"
+<ol
+ className="list-styled big-spacer-top big-spacer-bottom"
+>
+ <li
+ className="abs-width-600"
>
- <li>
- onboarding.build
- <RenderOptions
- name="language"
- onCheck={[Function]}
- optionLabelKey="onboarding.build"
- options={
- Array [
- "maven",
- "gradle",
- "dotnet",
- "other",
- ]
- }
- />
- </li>
- </ol>
-</Fragment>
+ onboarding.build
+ <RenderOptions
+ name="language"
+ onCheck={[Function]}
+ optionLabelKey="onboarding.build"
+ options={
+ Array [
+ "maven",
+ "gradle",
+ "dotnet",
+ "other",
+ ]
+ }
+ />
+ </li>
+</ol>
`;
import CreateYmlFile from '../../components/CreateYmlFile';
import DefaultProjectKey from '../../components/DefaultProjectKey';
import FinishButton from '../../components/FinishButton';
+import GithubCFamilyExampleRepositories from '../../components/GithubCFamilyExampleRepositories';
import RenderOptions from '../../components/RenderOptions';
-import { OSs } from '../../types';
+import { OSs, TutorialModes } from '../../types';
export interface CFamilyProps {
branchesEnabled?: boolean;
return (
<>
<DefaultProjectKey component={component} />
- <li>
+ <li className="abs-width-600">
<span>{translate('onboarding.build.other.os')}</span>
<RenderOptions
checked={os}
optionLabelKey="onboarding.build.other.os"
options={Object.values(OSs)}
/>
+ {os && (
+ <GithubCFamilyExampleRepositories
+ className="big-spacer-top"
+ os={os}
+ ci={TutorialModes.GitHubActions}
+ />
+ )}
</li>
{os && (
<>
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
<span>
onboarding.build.other.os
</span>
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
<span>
onboarding.build.other.os
</span>
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="github-actions"
+ className="big-spacer-top"
+ os="linux"
+ />
</li>
<CreateYmlFile
yamlFileName=".github/workflows/build.yml"
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
<span>
onboarding.build.other.os
</span>
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="github-actions"
+ className="big-spacer-top"
+ os="mac"
+ />
</li>
<CreateYmlFile
yamlFileName=".github/workflows/build.yml"
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
<span>
onboarding.build.other.os
</span>
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="github-actions"
+ className="big-spacer-top"
+ os="win"
+ />
</li>
<CreateYmlFile
yamlFileName=".github/workflows/build.yml"
import { translate } from '../../../helpers/l10n';
import { withAppState } from '../../hoc/withAppState';
import FinishButton from '../components/FinishButton';
+import GithubCFamilyExampleRepositories from '../components/GithubCFamilyExampleRepositories';
import Step from '../components/Step';
-import { BuildTools } from '../types';
+import { BuildTools, TutorialModes } from '../types';
import PipeCommand from './commands/PipeCommand';
export interface YmlFileStepProps {
<div className="flex-column-full">
{buildTool && (
<>
+ {buildTool === BuildTools.CFamily && (
+ <GithubCFamilyExampleRepositories
+ className="big-spacer-bottom abs-width-600"
+ ci={TutorialModes.GitLabCI}
+ />
+ )}
<div className="big-spacer-bottom">
<FormattedMessage
defaultMessage={translate('onboarding.tutorial.with.gitlab_ci.yml.description')}
}}
/>
</div>
-
<div className="big-spacer-bottom abs-width-600">
<PipeCommand
buildTool={buildTool}
projectKey={projectKey}
/>
</div>
-
<p className="little-spacer-bottom">
{branchesEnabled
? translate('onboarding.tutorial.with.gitlab_ci.yml.baseconfig')
: translate('onboarding.tutorial.with.gitlab_ci.yml.baseconfig.no_branches')}
</p>
-
<p>{translate('onboarding.tutorial.with.gitlab_ci.yml.existing')}</p>
</>
)}
className="flex-column-full"
>
<React.Fragment>
+ <GithubCFamilyExampleRepositories
+ ci="gitlab-ci"
+ className="big-spacer-bottom abs-width-600"
+ />
<div
className="big-spacer-bottom"
>
className="flex-column-full"
>
<React.Fragment>
+ <GithubCFamilyExampleRepositories
+ ci="gitlab-ci"
+ className="big-spacer-bottom abs-width-600"
+ />
<div
className="big-spacer-bottom"
>
import { CompilationInfo } from '../../components/CompilationInfo';
import DefaultProjectKey from '../../components/DefaultProjectKey';
import FinishButton from '../../components/FinishButton';
+import GithubCFamilyExampleRepositories from '../../components/GithubCFamilyExampleRepositories';
import RenderOptions from '../../components/RenderOptions';
-import { OSs } from '../../types';
+import { OSs, TutorialModes } from '../../types';
import { LanguageProps } from '../JenkinsfileStep';
import CreateJenkinsfileBulletPoint from './CreateJenkinsfileBulletPoint';
return (
<>
<DefaultProjectKey component={component} />
- <li>
+ <li className="abs-width-600">
{translate('onboarding.build.other.os')}
<RenderOptions
checked={os}
onCheck={value => setOs(value as OSs)}
options={Object.values(OSs)}
/>
+ {os && (
+ <GithubCFamilyExampleRepositories
+ className="big-spacer-top big-spacer-bottom"
+ os={os}
+ ci={TutorialModes.Jenkins}
+ />
+ )}
</li>
{os && (
<>
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
onboarding.build.other.os
<RenderOptions
name="flavorComponent"
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
onboarding.build.other.os
<RenderOptions
checked="linux"
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="jenkins"
+ className="big-spacer-top big-spacer-bottom"
+ os="linux"
+ />
</li>
<CreateJenkinsfileBulletPoint
alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
onboarding.build.other.os
<RenderOptions
checked="mac"
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="jenkins"
+ className="big-spacer-top big-spacer-bottom"
+ os="mac"
+ />
</li>
<CreateJenkinsfileBulletPoint
alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
}
}
/>
- <li>
+ <li
+ className="abs-width-600"
+ >
onboarding.build.other.os
<RenderOptions
checked="win"
]
}
/>
+ <GithubCFamilyExampleRepositories
+ ci="jenkins"
+ className="big-spacer-top big-spacer-bottom"
+ os="win"
+ />
</li>
<CreateJenkinsfileBulletPoint
alertTranslationKeyPart="onboarding.tutorial.with.jenkins.jenkinsfile.other.step3"
import RadioToggle from '../../../components/controls/RadioToggle';
import { translate } from '../../../helpers/l10n';
import { withCLanguageFeature } from '../../hoc/withCLanguageFeature';
+import GithubCFamilyExampleRepositories from '../components/GithubCFamilyExampleRepositories';
import RenderOptions from '../components/RenderOptions';
-import { BuildTools, ManualTutorialConfig, OSs } from '../types';
+import { BuildTools, ManualTutorialConfig, OSs, TutorialModes } from '../types';
interface Props {
hasCLanguageFeature: boolean;
titleLabelKey="onboarding.build.other.os"
/>
)}
+
+ {config.buildTool === BuildTools.CFamily && config.os && (
+ <GithubCFamilyExampleRepositories
+ className="big-spacer-top abs-width-600"
+ os={config.os}
+ ci={TutorialModes.Manual}
+ />
+ )}
</>
);
}
<BuildToolForm onDone={this.handleBuildToolSelect} />
{this.state.config && (
- <div className="huge-spacer-top">
+ <div className="big-spacer-top">
<AnalysisCommand
component={this.props.component}
languageConfig={this.state.config}
onboarding.tutorial.cfamilly.compilation_database_info.link=compilation database
onboarding.tutorial.cfamilly.speed_caching=You can also speed up your analysis by enabling {link}.
onboarding.tutorial.cfamilly.speed_caching.link=multi-threading and caching
+onboarding.tutorial.cfamily.examples_repositories_description=Check out our C and C++ sample projects with SonarQube analysis configured
onboarding.tutorial.choose_method=How do you want to analyze your repository?
onboarding.tutorial.choose_method.devops_platform.description=Do you want to integrate with your favorite CI? Choose one of the following tutorials.