Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-2024-07
backend
Commits
fed89e5a
Commit
fed89e5a
authored
1 year ago
by
Andreas
Browse files
Options
Downloads
Patches
Plain Diff
bug/Fixed pipeline failing
parent
cec4387a
No related branches found
No related tags found
No related merge requests found
Pipeline
#283405
failed
1 year ago
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-26
2 additions, 26 deletions
.gitlab-ci.yml
pom.xml
+0
-22
0 additions, 22 deletions
pom.xml
scripts/add_jacoco_coverage_link_to_html.py
+0
-50
0 additions, 50 deletions
scripts/add_jacoco_coverage_link_to_html.py
scripts/test_data.sql
+0
-17
0 additions, 17 deletions
scripts/test_data.sql
with
2 additions
and
115 deletions
.gitlab-ci.yml
+
2
−
26
View file @
fed89e5a
...
...
@@ -62,31 +62,7 @@ test_project:
-
.m2/repository
policy
:
pull
generate_site_reports
:
stage
:
generate_site_reports
script
:
-
mvn site
# Generates a website containing project documentation (including checkstyle report)
artifacts
:
paths
:
-
target/site/
only
:
-
master
modify_generated_site_reports
:
# Modify the generated website containing project documentation to also link to JaCoCo coverage file
image
:
python:3.8-slim
stage
:
modify_generated_site_reports
script
:
-
pip install beautifulsoup4
# Used to parse contents of HTML files
-
python scripts/add_jacoco_coverage_link_to_html.py
# Script that modifies the HTML file to include a link to JaCoCo coverage file
artifacts
:
paths
:
-
target/site/
dependencies
:
-
generate_site_reports
only
:
-
master
# We move the code coverage reports generated by jacoco and mvn site to be served by Gitlab Pages (Settings -> Pages)
# We move the code coverage reports generated by jacoco to be served by Gitlab Pages (Settings -> Pages)
pages
:
image
:
alpine:latest
stage
:
publish_pages
...
...
@@ -94,7 +70,7 @@ pages:
-
modify_generated_site_reports
script
:
-
mkdir public
-
cp -r target/site/
*
public/
-
cp -r target/site/
jacoco
public/
artifacts
:
paths
:
-
public
...
...
This diff is collapsed.
Click to expand it.
pom.xml
+
0
−
22
View file @
fed89e5a
...
...
@@ -188,28 +188,6 @@
<artifactId>
maven-site-plugin
</artifactId>
<version>
4.0.0-M13
</version>
</plugin>
<!-- Plugin allow execution of system and Java programs -->
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<version>
3.2.0
</version>
<executions>
<execution>
<id>
update-html-report
</id>
<phase>
prepare-package
</phase>
<goals>
<goal>
exec
</goal>
</goals>
<configuration>
<executable>
python
</executable>
<workingDirectory>
${project.basedir}/scripts
</workingDirectory>
<arguments>
<argument>
add_jacoco_coverage_link_to_html.py
</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
...
...
This diff is collapsed.
Click to expand it.
scripts/add_jacoco_coverage_link_to_html.py
deleted
100644 → 0
+
0
−
50
View file @
cec4387a
# Function is used to modify target/site/project-reports.html to include
# a link to the JaCoCo generated coverage files at target/site/jacoco/index.html.
def
add_jacoco_coverage_link_to_html
(
file_path
):
import
bs4
# Open and read the HTML file at file_path
with
open
(
file_path
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
file
:
original_html
=
file
.
read
()
# Parse the content of the HTML file using Beautiful Soup (bs4)
soup
=
bs4
.
BeautifulSoup
(
original_html
,
features
=
'
html.parser
'
)
# Find the <ul> element that contains the Checkstyle link inside the Project Reports navigation section
# This is where we wanna add a list item for the JaCoCo coverage report
nav_list
=
soup
.
find
(
"
li
"
,
class_
=
"
active
"
).
find
(
"
ul
"
,
class_
=
"
nav nav-list
"
)
# Create the new list item for JaCoCo
new_li
=
soup
.
new_tag
(
"
li
"
)
new_a
=
soup
.
new_tag
(
"
a
"
,
href
=
"
jacoco/index.html
"
)
new_a
.
string
=
"
Jacoco Coverage
"
new_li
.
append
(
new_a
)
# Add the new list item to the navigation list
nav_list
.
append
(
new_li
)
# Find the table that contains the Checkstyle link
# This is where we wanna add a table that contains a link for the JaCoCo report
table
=
soup
.
find
(
"
table
"
,
class_
=
"
table table-striped
"
)
# Create the new table row for JaCoCo
new_tr
=
soup
.
new_tag
(
"
tr
"
,
**
{
"
class
"
:
"
a
"
})
new_td1
=
soup
.
new_tag
(
"
td
"
)
new_a2
=
soup
.
new_tag
(
"
a
"
,
href
=
"
jacoco/index.html
"
)
new_a2
.
string
=
"
Jacoco Coverage
"
new_td2
=
soup
.
new_tag
(
"
td
"
)
new_td2
.
string
=
"
Code coverage report generated by JaCoCo.
"
new_td1
.
append
(
new_a2
)
new_tr
.
append
(
new_td1
)
new_tr
.
append
(
new_td2
)
# Add the new table row to the table
table
.
append
(
new_tr
)
# Write the modified HTML content back to the original file
with
open
(
file_path
,
'
w
'
,
encoding
=
'
utf-8
'
)
as
file
:
file
.
write
(
str
(
soup
.
prettify
()))
file_path
=
'
target/site/project-reports.html
'
add_jacoco_coverage_link_to_html
(
file_path
)
This diff is collapsed.
Click to expand it.
scripts/test_data.sql
deleted
100644 → 0
+
0
−
17
View file @
cec4387a
-- Inserting users (PASSWORD = John1)
INSERT
INTO
user
(
first_name
,
last_name
,
password
,
email
,
created_at
,
role
,
point_id
,
streak_id
)
VALUES
(
'User'
,
'User'
,
'$2a$10$j3.TmUIfByIa8ZfDksVb0OFzyTxxIo1jgCx59oO0rX67b7IB8cStq'
,
'user@example.com'
,
'2024-04-16 15:00:00'
,
'USER'
,
1
,
1
),
(
'Admin'
,
'Admin'
,
'$2a$10$j3.TmUIfByIa8ZfDksVb0OFzyTxxIo1jgCx59oO0rX67b7IB8cStq'
,
'admin@example.com'
,
'2024-04-16 15:00:00'
,
'ADMIN'
,
2
,
2
);
-- Inserting points
INSERT
INTO
point
(
point_id
,
current_points
,
total_earned_points
)
VALUES
(
1
,
120
,
500
),
(
2
,
150
,
600
);
-- Inserting streaks
INSERT
INTO
streak
(
streak_id
,
current_streak
,
current_streak_created_at
,
current_streak_updated_at
,
highest_streak
,
highest_streak_created_at
,
highest_streak_ended_at
)
VALUES
(
1
,
10
,
'2024-04-16 15:00:00'
,
'2024-04-16 15:00:03'
,
15
,
'2020-04-16 15:00:00'
,
'2023-04-16 15:00:00'
),
(
2
,
8
,
'2024-04-16 15:00:00'
,
'2024-04-16 15:00:03'
,
20
,
'2020-04-16 15:00:00'
,
'2023-04-16 15:00:00'
);
-- Inserting friends
INSERT
INTO
friend
(
user_id
,
friend_id
,
pending
,
created_at
)
VALUES
(
1
,
2
,
FALSE
,
'2024-04-16 15:00:00'
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment