Skip to content
Snippets Groups Projects
Commit fed89e5a authored by Andreas's avatar Andreas
Browse files

bug/Fixed pipeline failing

parent cec4387a
No related branches found
No related tags found
No related merge requests found
Pipeline #283405 failed
......@@ -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
......
......@@ -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>
......
# 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)
-- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment