Skip to content

Commit 291f033

Browse files
✨ Integrate Javelit to build dashboard + configure semantic release (#28)
✨ 🚀 Init Javelit interface
1 parent c9acf11 commit 291f033

19 files changed

Lines changed: 816 additions & 124 deletions

File tree

.env-example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This is an example of env file.
2-
github.token=<set your token here>
2+
github.token=<set your token here>

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
27+
cache: maven
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 'lts/*'
33+
34+
- name: Install dependencies
35+
run: npm install -g semantic-release semantic-release-gitmoji @semantic-release/exec @semantic-release/git
36+
37+
- name: Release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: npx semantic-release

.releaserc.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"semantic-release-gitmoji",
6+
{
7+
"releaseRules": {
8+
"major": [":boom:"],
9+
"minor": [":sparkles:"],
10+
"patch": [":bug:", ":ambulance:", ":lock:"]
11+
},
12+
"releaseNotes": {
13+
"template": "default"
14+
}
15+
}
16+
],
17+
"@semantic-release/github",
18+
[
19+
"@semantic-release/exec",
20+
{
21+
"prepareCmd": "mvn versions:set -DnewVersion=${nextRelease.version} && mvn versions:commit",
22+
"publishCmd": "mvn deploy -DskipTests"
23+
}
24+
],
25+
[
26+
"@semantic-release/git",
27+
{
28+
"assets": ["pom.xml"],
29+
"message": ":bookmark: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
30+
}
31+
]
32+
]
33+
}

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Opensource-statistiques 📊
22

3+
![GitHub Release](https://img.shields.io/github/v/release/zenika-open-source/opensource-statistics)
4+
![Quarkus](https://img.shields.io/badge/Quarkus-3.12.1-4695EB?logo=quarkus)
5+
![Java](https://img.shields.io/badge/Java-17-ED8B00?logo=openjdk&logoColor=white)
6+
37
🚧 This project is in progress ...
48

5-
One objective of this project is to highlight Zenika members for your open source contributions.
9+
One objective of this project is to highlight Zenika members for their open source contributions.
610

7-
To do this, the zenika-open-source GitHub Organization is scanned and data are be saved in a private Database on GCP.
8-
Datas could be used to find and list projects maintained or forked by Zenika Members, all projects which Zenika members contributed, etc.
11+
To do this, the zenika-open-source GitHub Organization is scanned and data is saved in a private Database on GCP.
12+
Data could be used to find and list projects maintained or forked by Zenika Members, all projects to which Zenika members contributed, etc.
913

1014
## 🗄️ Tech
1115

12-
Using :
16+
Using:
1317
- [Quarkus](https://quarkus.io/)
1418
- [Firestore](https://docs.quarkiverse.io/quarkus-google-cloud-services/) to save data
1519
- [GitHub actions](https://github.com/features/actions) as CICD - 🚧 not implemented
@@ -23,7 +27,7 @@ Some resources are available but only the first is in progress :
2327
- `/contributions/` to get information about contributions from GCP database 🚧 not implemented
2428
- `/workflow/` to get data and save them on GCP database
2529

26-
> 🎯 The last one resource will be removed after implementing all features and will be replaced by schedules.
30+
> 🎯 The last resource will be removed after implementing all features and will be replaced by schedules.
2731
2832
## 📝 Setup
2933

@@ -33,9 +37,8 @@ Some resources are available but only the first is in progress :
3337
- Run the application with `quarkus dev` if you have the [Quarkus CLI](https://quarkus.io/guides/cli-tooling) installed on your environment, or `mvn quarkus:dev`command.
3438
- You can use Quarkus dev service for Firestore enabling this variable `quarkus.google.cloud.firestore.devservice.enabled` in application.properties file.
3539

36-
3740
## ✨Contribute
3841

39-
Anyone can contribute to this project. For the moment, please add your question or purpose something in [a new issue](https://github.com/zenika-open-source/opensource-statistics/issues).
42+
Anyone can contribute to this project. For the moment, please add your question or propose something in [a new issue](https://github.com/zenika-open-source/opensource-statistics/issues).
4043

4144
![with love by zenika](https://img.shields.io/badge/With%20%E2%9D%A4%EF%B8%8F%20by-Zenika-b51432.svg?link=https://oss.zenika.com)

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@
9999
<artifactId>quarkus-junit5-mockito</artifactId>
100100
<scope>test</scope>
101101
</dependency>
102+
<dependency>
103+
<groupId>io.javelit</groupId>
104+
<artifactId>javelit</artifactId>
105+
<version>0.86.0</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>io.quarkus</groupId>
109+
<artifactId>quarkus-cache</artifactId>
110+
</dependency>
102111

103112
</dependencies>
104113
<build>

src/main/java/zenika/oss/stats/beans/ZenikaMember.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class ZenikaMember {
1111

1212
private String firstname;
1313

14+
private String city;
15+
1416
private GitHubMember gitHubAccount;
1517

1618
private GitLabMember gitlabAccount;
@@ -39,6 +41,14 @@ public void setFirstname(String firstname) {
3941
this.firstname = firstname;
4042
}
4143

44+
public String getCity() {
45+
return city;
46+
}
47+
48+
public void setCity(String city) {
49+
this.city = city;
50+
}
51+
4252
public GitHubMember getGitHubAccount() {
4353
return gitHubAccount;
4454
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package zenika.oss.stats.beans.github;
2+
3+
public class Parent {
4+
5+
public String title;
6+
public String url;
7+
public String html_url;
8+
public String full_name;
9+
10+
public String getTitle() {
11+
return title;
12+
}
13+
14+
public void setTitle(String title) {
15+
this.title = title;
16+
}
17+
18+
public String getUrl() {
19+
return url;
20+
}
21+
22+
public void setUrl(String url) {
23+
this.url = url;
24+
}
25+
26+
public String getHtml_url() {
27+
return html_url;
28+
}
29+
30+
public void setHtml_url(String html_url) {
31+
this.html_url = html_url;
32+
}
33+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
package zenika.oss.stats.beans.gitlab;
22

33
public class GitLabMember {
4+
private String username;
5+
6+
public String getUsername() {
7+
return username;
8+
}
9+
10+
public void setUsername(String username) {
11+
this.username = username;
12+
}
413
}

src/main/java/zenika/oss/stats/mapper/ZenikaMemberMapper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.cloud.firestore.QueryDocumentSnapshot;
44
import zenika.oss.stats.beans.ZenikaMember;
55
import zenika.oss.stats.beans.github.GitHubMember;
6+
import zenika.oss.stats.beans.gitlab.GitLabMember;
67

78
import java.util.UUID;
89

@@ -19,14 +20,18 @@ public static ZenikaMember mapFirestoreZenikaMemberToZenikaMember(QueryDocumentS
1920

2021
zenikaMember.setFirstname(documentMember.getString("firstname"));
2122
zenikaMember.setName(documentMember.getString("name"));
23+
zenikaMember.setCity(documentMember.getString("city"));
2224
zenikaMember.setId(documentMember.getId());
2325
zenikaMember.setGitHubAccount(documentMember.get("gitHubAccount", GitHubMember.class));
26+
zenikaMember.setGitlabAccount(documentMember.get("gitlabAccount", GitLabMember.class));
2427

2528
return zenikaMember;
29+
2630
}
2731

2832
/**
2933
* Create a ZenikaMember from a GitHub Member.
34+
*
3035
* @param gitHubMember : the github Member to map
3136
* @return an instance of ZenikaMember
3237
*/

src/main/java/zenika/oss/stats/ressources/workflow/WorkflowRessources.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public Response saveMembers() throws DatabaseException {
4040
firestoreServices.deleteAllMembers();
4141

4242
List<GitHubMember> gitHubMembers = gitHubServices.getZenikaOpenSourceMembers();
43-
gitHubMembers.forEach(gitHubMember -> firestoreServices.createMember(ZenikaMemberMapper.mapGitHubMemberToZenikaMember(gitHubMember)));
43+
gitHubMembers.forEach(gitHubMember -> firestoreServices
44+
.createMember(ZenikaMemberMapper.mapGitHubMemberToZenikaMember(gitHubMember)));
4445

4546
return Response.ok().build();
4647
}
@@ -62,7 +63,8 @@ public Response savePersonalProjects() throws DatabaseException {
6263
List<ZenikaMember> members = firestoreServices.getAllMembers();
6364

6465
members.forEach(member -> {
65-
List<GitHubProject> gitHubProjects = gitHubServices.getPersonalProjectForAnUser(member.getGitHubAccount().getLogin());
66+
List<GitHubProject> gitHubProjects = gitHubServices
67+
.getPersonalProjectForAnUser(member.getGitHubAccount().getLogin());
6668

6769
gitHubProjects.forEach(project -> {
6870
firestoreServices.createProject(project);
@@ -75,7 +77,6 @@ public Response savePersonalProjects() throws DatabaseException {
7577
@Path("stats/save/{year}")
7678
@Produces(MediaType.TEXT_PLAIN)
7779
public Response saveStatsForYear(@PathParam("year") int year) throws DatabaseException {
78-
List<CustomStatsContributionsUserByMonth> stats = new ArrayList<>();
7980

8081
firestoreServices.deleteStatsForAllGitHubAccountForAYear(year);
8182

@@ -84,8 +85,10 @@ public Response saveStatsForYear(@PathParam("year") int year) throws DatabaseExc
8485
for (ZenikaMember zenikaMember : zMembers) {
8586
if (zenikaMember.getGitHubAccount() != null) {
8687
System.out.print("\uD83D\uDD0E Check information for " + zenikaMember.getGitHubAccount().getLogin());
87-
stats.addAll(gitHubServices.getContributionsForTheCurrentYear(zenikaMember.getGitHubAccount().getLogin(), year));
88-
List<StatsContribution> statsMap = StatsMapper.mapGithubStatisticsToStatsContribution(zenikaMember.getGitHubAccount().getLogin(), year, stats);
88+
List<CustomStatsContributionsUserByMonth> stats = gitHubServices
89+
.getContributionsForTheCurrentYear(zenikaMember.getGitHubAccount().getLogin(), year);
90+
List<StatsContribution> statsMap = StatsMapper.mapGithubStatisticsToStatsContribution(
91+
zenikaMember.getGitHubAccount().getLogin(), year, stats);
8992
System.out.println("... ✅");
9093

9194
if (!statsMap.isEmpty()) {
@@ -102,13 +105,16 @@ public Response saveStatsForYear(@PathParam("year") int year) throws DatabaseExc
102105
@POST
103106
@Path("stats/save/{githubMember}/{year}")
104107
@Produces(MediaType.TEXT_PLAIN)
105-
public Response saveStatsForAGitHubAccountForAYear(@PathParam("githubMember") String githubMember, @PathParam("year") int year) throws DatabaseException {
108+
public Response saveStatsForAGitHubAccountForAYear(@PathParam("githubMember") String githubMember,
109+
@PathParam("year") int year) throws DatabaseException {
106110

107111
firestoreServices.deleteStatsForAGitHubAccountForAYear(githubMember, year);
108112

109-
List<CustomStatsContributionsUserByMonth> stats = gitHubServices.getContributionsForTheCurrentYear(githubMember, year);
113+
List<CustomStatsContributionsUserByMonth> stats = gitHubServices.getContributionsForTheCurrentYear(githubMember,
114+
year);
110115

111-
List<StatsContribution> statsMap = StatsMapper.mapGithubStatisticsToStatsContribution(githubMember, year, stats);
116+
List<StatsContribution> statsMap = StatsMapper.mapGithubStatisticsToStatsContribution(githubMember, year,
117+
stats);
112118

113119
if (!statsMap.isEmpty()) {
114120
for (StatsContribution stat : statsMap) {

0 commit comments

Comments
 (0)