Skip to content

Commit 4b1abf4

Browse files
authored
feat: include sonarcloud analysis (#155)
1 parent 1e31f19 commit 4b1abf4

File tree

4 files changed

+91
-23
lines changed

4 files changed

+91
-23
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: sonar analysis
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
sonarcloud:
11+
name: SonarCloud
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
# Checkout
16+
- name: checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
20+
# Load cache modules
21+
- name: Cache node modules
22+
id: cache-npm
23+
uses: actions/cache@v3
24+
with:
25+
path: ~/.npm
26+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-build-${{ env.cache-name }}-
29+
${{ runner.os }}-build-
30+
${{ runner.os }}-
31+
32+
33+
34+
# Run tests with coverage
35+
- name: run tests
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: 18.x
39+
run: |
40+
npm ci
41+
npm run test -- --coverage . --watchAll=false
42+
43+
# Send report to sonar
44+
- name: SonarCloud Scan
45+
uses: SonarSource/sonarcloud-github-action@master
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
48+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"jest": {
4141
"transformIgnorePatterns": [
4242
"/node_modules/(?!axios)/"
43-
]
43+
],
44+
"coveragePathIgnorePatterns": ["reportWebVitals.ts","/\\.(Style|Type|types)\\.tsx?$/\n","colors.ts"]
4445
},
4546
"eslintConfig": {
4647
"extends": [

sonar-project.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sonar.projectKey=devbcn.github.io
2+
sonar.organization=devbcn
3+
4+
# This is the name and version displayed in the SonarCloud UI.
5+
sonar.projectName=Devbcn website
6+
sonar.projectVersion=1.5.0
7+
sonar.typescript.lcov.reportPaths=coverage/lcov.info
8+
sonar.test.inclusions=*.test.tsx,*.test.ts
9+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
10+
#sonar.sources=.
11+
12+
# Encoding of the source code. Default is default system encoding
13+
#sonar.sourceEncoding=UTF-8

src/views/Cfp/CfpSection.tsx

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,40 @@ const CfpTrackComponent: FC<CfpTrackProps> = ({ track }) => (
2727
style={{
2828
paddingTop: "1.5rem",
2929
paddingBottom: "1rem",
30-
fontSize: "2rem",
30+
fontSize: "1.8rem",
31+
color: Color.DARK_BLUE,
3132
}}
3233
>
3334
{track.name}
3435
</h2>
3536
</section>
3637
<div style={{ display: "flex", margin: "1rem" }}>
37-
{track.members.map((member) => (
38-
<>
39-
{member.photo !== "" && (
40-
<div key={member.name}>
41-
<StyledAboutImage src={member.photo} alt={member.name} />
42-
<h5 style={{ color: Color.DARK_BLUE }}>{member.name}</h5>
43-
<StyledSocialIconsWrapper>
44-
{member.twitter !== "" && (
45-
<TwitterIcon color={Color.BLUE} twitterUrl={member.twitter} />
46-
)}
47-
{member.linkedIn !== "" && (
48-
<LinkedinIcon
49-
color={Color.BLUE}
50-
linkedinUrl={member.linkedIn}
51-
/>
52-
)}
53-
</StyledSocialIconsWrapper>
54-
</div>
55-
)}
56-
</>
57-
))}
38+
{track.members.map((member) => {
39+
return (
40+
<div key={member.name}>
41+
{member.photo !== "" && (
42+
<div>
43+
<StyledAboutImage src={member.photo} alt={member.name} />
44+
<h5 style={{ color: Color.DARK_BLUE }}>{member.name}</h5>
45+
<StyledSocialIconsWrapper>
46+
{member.twitter !== "" && (
47+
<TwitterIcon
48+
color={Color.BLUE}
49+
twitterUrl={member.twitter}
50+
/>
51+
)}
52+
{member.linkedIn !== "" && (
53+
<LinkedinIcon
54+
color={Color.BLUE}
55+
linkedinUrl={member.linkedIn}
56+
/>
57+
)}
58+
</StyledSocialIconsWrapper>
59+
</div>
60+
)}
61+
</div>
62+
);
63+
})}
5864
</div>
5965
</>
6066
);

0 commit comments

Comments
 (0)