Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report generator as submodule debian #50

Merged
merged 7 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
*.png
!seapath-themes/logo.png
.vscode/*
*.pdf
674 changes: 0 additions & 674 deletions LISCENCE.GPLv3

This file was deleted.

1 change: 1 addition & 0 deletions ansible-lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2023, RTE (http://www.rte-france.com)
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# This script download the sources of a specific pull request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends \
asciidoc \
bash \
locales \
python3-matplotlib \
ruby \
ruby-asciidoctor-pdf \
xmlstarlet \
&& rm -rf /var/lib/apt/lists/*

RUN sed -i "s/# en_US\.UTF-8 UTF-8/en_US\.UTF-8 UTF-8/" /etc/locale.gen
Expand Down
6 changes: 6 additions & 0 deletions latency-tests-analysis/.cqfdrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[project]
org='sfl'
name='latency-results-analysis'

[build]
command='./compile_latency.sh'
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ add_latency_results()
# Output example: $SUB_RESULT_FILE = /tmp/tests_results/sub_results_hypervisor_virtu-ci1 --> $SUB_MACHINE_NAME = virtu-ci1

echo "=== $SUB_MACHINE_NAME" >> "$LATENCY_ADOC_FILE" # Subtitle for each subscriber
echo "image::./include/sub_"$SUB_MACHINE_NAME"_delay.png[]" >> "$LATENCY_ADOC_FILE" # Include delay graph
echo "image::./include/pub_standalone_interval_between.png[]" >> "$LATENCY_ADOC_FILE" # Include time between packets graph
echo "image::../../include/sub_"$SUB_MACHINE_NAME"_delay.png[]" >> "$LATENCY_ADOC_FILE" # Include delay graph
echo "image::../../include/pub_ci-tool_interval_between.png[]" >> "$LATENCY_ADOC_FILE" # Include time between packets graph
echo " " >> "$LATENCY_ADOC_FILE"

sed -i 's/$/ +/' $STATS_FILE # Add '+' character at the end of each file sub stat line for making carriage return
Expand Down
9 changes: 7 additions & 2 deletions launch-yocto.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2023 Savoir-faire Linux, Inc.
# Copyright (C) 2023-2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# This script download the sources of a specific pull request,
Expand Down Expand Up @@ -109,8 +109,13 @@ launch_system_tests() {
# Generate the test report and upload it
generate_report() {

# Generate test report
# Replace test-report-pdf themes with SEAPATH one
cd "${WORK_DIR}/ci/test-report-pdf"
rm themes/sfl.png
mv ../seapath-themes/logo.png themes
mv ../seapath-themes/theme.yml themes/sfl-theme.yml

# Generate test report
cqfd -q init
if ! CQFD_EXTRA_RUN_ARGS="" cqfd -q run ./compile.py -s -m -i include ; then
die "cqfd error"
Expand Down
62 changes: 33 additions & 29 deletions launch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2023, RTE (http://www.rte-france.com)
# Copyright (C) 2024 Savoir-faire Linux, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# This script download the sources of a specific pull request,
Expand Down Expand Up @@ -129,16 +130,11 @@ launch_system_tests() {
playbooks/ci_test.yaml
echo "System tests launched successfully"

# Generate test report part
INCLUDE_DIR=${WORK_DIR}/ci/report-generator/include
# Move tests results to test-report-pdf directory
INCLUDE_DIR=${WORK_DIR}/ci/test-report-pdf/include
mkdir "$INCLUDE_DIR"
mv ${WORK_DIR}/ansible/*.xml $INCLUDE_DIR # Test files
mv ${WORK_DIR}/ansible/cukinia_*.xml $INCLUDE_DIR # Test files
cp ${WORK_DIR}/ansible/src/cukinia-tests/*.csv $INCLUDE_DIR # Compliance matrix
cd ${WORK_DIR}/ci/report-generator
cqfd -q init
if ! cqfd -q -b generate_test_part; then
die "cqfd error"
fi

# Check for kernel backtrace error. This is a random error so it must not
# stop the CI but just display a warning
Expand Down Expand Up @@ -184,18 +180,9 @@ launch_vm_tests() {
--limit VMs \
playbooks/ci_test.yaml

# Generate test report part
# This part relaunch the test report generator with all cukinia test file
# including the physical machine and the VM.
# This actually redo what was done in the launch_system_tests but with the VM file
# That's the best way I found to integrate this properly
INCLUDE_DIR=${WORK_DIR}/ci/report-generator/include
mv ${WORK_DIR}/ansible/*.xml $INCLUDE_DIR # Test files
cd ${WORK_DIR}/ci/report-generator
cqfd -q init
if ! cqfd -q -b generate_test_part; then
die "cqfd error"
fi
# Move VM test results to test-report-pdf
INCLUDE_DIR=${WORK_DIR}/ci/test-report-pdf/include
mv ${WORK_DIR}/ansible/cukinia_*.xml $INCLUDE_DIR # Test files

# Display test results
if grep -q '<failure' $INCLUDE_DIR/*.xml; then
Expand All @@ -217,15 +204,23 @@ launch_latency_tests() {
playbooks/test_run_latency_tests.yaml

# Generate latency report part
LATENCY_TEST_DIR="${WORK_DIR}/latency"
LATENCY_TEST_DIR="${WORK_DIR}/ci/latency-results"
mkdir $LATENCY_TEST_DIR
mv -v ${WORK_DIR}/ansible/tests_results/* $LATENCY_TEST_DIR
cd ${WORK_DIR}/ci/report-generator
mv ${WORK_DIR}/ansible/tests_results/* $LATENCY_TEST_DIR
cd ${WORK_DIR}/ci/latency-tests-analysis
cqfd -q init
if ! CQFD_EXTRA_RUN_ARGS="-v $LATENCY_TEST_DIR:/tmp/tests_results" \
cqfd -q -b generate_latency_part; then
cqfd -q run ./compile_latency.sh /tmp/tests_results/; then
die "cqfd error"
fi

# This move is needed for test-report-pdf to work correctly.
# By copying the latency reports adoc in the include directory under the
# "notes.adoc" name, it will automatically be append at the end of the report.
mv latency-test-reports.adoc "${WORK_DIR}/ci/test-report-pdf/include/notes.adoc"
# Move images generated by compile_latency.sh
mv include/* "${WORK_DIR}/ci/test-report-pdf/include/"

echo "See latency report in the section 'Upload test report'"

# TODO : Add return value : false if we exceed max latency
Expand All @@ -234,9 +229,18 @@ launch_latency_tests() {
# Generate the test report and upload it
generate_report() {

# Generate pdf
cd "${WORK_DIR}/ci/report-generator"
if ! CQFD_EXTRA_RUN_ARGS="" cqfd -q run; then
# Replace test-report-pdf themes with SEAPATH one
cd "${WORK_DIR}/ci/test-report-pdf"
rm themes/sfl.png
mv ../seapath-themes/logo.png themes
mv ../seapath-themes/theme.yml themes/sfl-theme.yml

# Generate test report
cqfd -q init
if ! CQFD_EXTRA_RUN_ARGS="" cqfd -q run ./compile.py -s -m -i include \
-c include/ANSSI-BP28-Recommandations-M.csv \
-c include/ANSSI-BP28-Recommandations-MI.csv \
-c include/ANSSI-BP28-Recommandations-MIR.csv; then
die "cqfd error"
fi
echo "Test report generated successfully"
Expand All @@ -248,7 +252,7 @@ generate_report() {
REPORT_DIR="${WORK_DIR}/reports/docs/reports/PR-${PR_N}"
REPORT_BRANCH="reports-PR${PR_N}"

# The CI repo have one branche per pull request.
# The CI repo have one branch per pull request.
# If the report is the first of the PR, the branch needs to be created.
# Otherwise, it just have to be switched on.
git clone -q --depth 1 -b reports-base-commit \
Expand All @@ -263,7 +267,7 @@ generate_report() {
git switch -q "$REPORT_BRANCH"

mkdir -p "$REPORT_DIR"
mv "${WORK_DIR}"/ci/report-generator/test-report.pdf "$REPORT_DIR/$REPORT_NAME"
mv "${WORK_DIR}"/ci/test-report-pdf/test-report.pdf "$REPORT_DIR/$REPORT_NAME"
git config --local user.email "[email protected]"
git config --local user.name "Seapath CI"
git config --local core.sshCommand "ssh -i ~/.ssh/ci_rsa"
Expand Down
13 changes: 0 additions & 13 deletions report-generator/.cqfdrc

This file was deleted.

Loading