Skip to content

Commit 0be5f2d

Browse files
committed
Distribute the CI part into the former Local part
1 parent a55130d commit 0be5f2d

File tree

1 file changed

+93
-77
lines changed

1 file changed

+93
-77
lines changed

Doc/LatexTP/TPCI_SEDRAInria.tex

+93-77
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,7 @@ \subsection{\homeworkSectionName} % Make a subsection with the custom name of th
270270
% To have just one problem per page, simply put a \clearpage after each problem
271271
\begin{homeworkProblem}[Java Exercice]
272272

273-
\section{Local Test Part}
274-
275-
\subsection{Preamble}
273+
\section{Preamble}
276274

277275
To go through this exercise, you will need to install
278276
\begin{itemize}
@@ -283,9 +281,9 @@ \subsection{Preamble}
283281

284282
You will also need an account on both gforge.inria.fr and ci.inria.fr and be a member of the tpcisedra project.
285283

286-
\subsection{Setup}
284+
\section{Setup}
287285

288-
\subsubsection{Create a personal copy of the git repository from INRIA forge and clone it}
286+
\subsection{Create a personal copy of the git repository from INRIA forge and clone it}
289287
First, you will create your personal \texttt{git} repository on the INRIA forge as a branch of the main repository for the \texttt{tpcisedra} project~:
290288
\begin{itemize}
291289
\item Go to \url{https~://gforge.inria.fr/projects/tpcisedra/}
@@ -336,7 +334,7 @@ \subsubsection{Create a personal copy of the git repository from INRIA forge and
336334
\item A file \texttt{SphereTest.java} implementing its test class \texttt{SphereTest}.
337335
\end{itemize}
338336

339-
\subsubsection{Check that you can build the project}
337+
\subsection{Check that you can build the project}
340338
\begin{lstlisting}
341339
$ pwd
342340
yourpath/tpcisedra/java
@@ -353,9 +351,9 @@ \subsubsection{Check that you can build the project}
353351

354352

355353
%--------------------------------------
356-
\subsection{Testing your code}
354+
\section{Testing your code locally}
357355

358-
\subsubsection{Run the (single) test}
356+
\subsection{Run the (single) test}
359357
\begin{lstlisting}
360358
$ mvn test
361359
\end{lstlisting}
@@ -377,7 +375,43 @@ \subsubsection{Run the (single) test}
377375
[INFO] ------------------------------------------------------------------------
378376
\end{lstlisting}
379377

380-
\subsubsection{Exercice 1}
378+
379+
380+
%--------------------------------------
381+
\section{Testing your code remotely on ci.inria.fr}
382+
383+
\subsection{Log into the project's Jenkins instance}
384+
Connect to the INRIA Continuous Integration web portal~: \url{https://ci.inria.fr/} \\
385+
Log in and click \textbf{\texttt{Dashboard}} in the top menu \\
386+
You should have been added to project \textbf{\texttt{TPCISedRa}}, click on the \textbf{\texttt{Jenkins}} button \\
387+
You may be prompted to log into \texttt{Jenkins}, use the same login/passwd as for the ci portal
388+
389+
\subsection{Create a new Jenkins item}
390+
From our \texttt{Jenkins} dashboard page (\url{https://ci.inria.fr/tpcisedra/}), click \textbf{\texttt{New Item}} in the menu on the left
391+
Provide a name for this new item (avoid spaces since it is likely to lead to errors) and select \textbf{\texttt{Maven project}}
392+
393+
\subsection{Git configuration}
394+
In the new item's configuration page (which you will be redirected to after clicking \textbf{\texttt{OK}} on the \texttt{New Item} page), choose \texttt{git} as your \textbf{\texttt{Source Code Manager}} and copy the \emph{anonymous} url to your personal repository into the appropriate field~:
395+
\begin{lstlisting}
396+
https://scm.gforge.inria.fr/anonscm/git/tpcisedra/users/<yourlogin>.git
397+
\end{lstlisting}
398+
\end{homeworkProblem}
399+
400+
\subsection{Build configuration}
401+
In the \textbf{\texttt{Build}} section, change the root POM path to \texttt{java/pom.xml} and type \texttt{test} in \textbf{\texttt{Goals and options}} section.
402+
403+
\subsection{Save and run}
404+
Click \textbf{\texttt{Save}} at the bottom of the page \\
405+
Click \textbf{\texttt{Build Now}} in the menu on the left
406+
407+
\subsection{Check the output}
408+
In the \textbf{\texttt{Build History}} on the left, click on the last build (hopefully \#1), then select \textbf{\texttt{Console Output}} \\
409+
You can also check the \textbf{\texttt{Test Result}}
410+
411+
412+
413+
%--------------------------------------
414+
\section{Exercice 1}
381415

382416
Have a look at the code of the method \texttt{Sphere::computeVolume()}.\\
383417
To do so, edit \texttt{tpcisedra/java/src/main/java/fr/inria/sed/Sphere.java}.
@@ -392,7 +426,7 @@ \subsubsection{Exercice 1}
392426

393427
We might want the value~: \verb?4 * Math.PI / 3? to be computed once and for all.
394428

395-
TODO~:
429+
\subsubsection{TODO~:}
396430
\begin{itemize}
397431
\item Extract this value into a class data member
398432
\item Run the test again. It should fail.
@@ -418,7 +452,13 @@ \subsubsection{Exercice 1}
418452
[INFO] ------------------------------------------------------------------------
419453
\end{lstlisting}
420454

421-
\subsubsection{Exercice 2}
455+
\subsubsection{TODO~:}
456+
\begin{itemize}
457+
\item Check that tests fail on CI. \\
458+
Hint~: have you commited and pushed your changes ?
459+
\end{itemize}
460+
461+
\section{Exercice 2}
422462

423463
Why does the test in \texttt{SphereTest.java} fail ?
424464

@@ -430,23 +470,24 @@ \subsubsection{Exercice 2}
430470
\item In other cases, we need not worry about such a small difference and hence do not want to be bothered by tests complaining.
431471
\end{itemize}
432472

433-
TODO~:
473+
\subsubsection{TODO~:}
434474
\begin{itemize}
435475
\item Find a way to modify the appropriate test in \texttt{SphereTest.java}
436476
so small rounding differences do not cause errors.
477+
\item Check that tests pass on CI.
437478
\end{itemize}
438479

439480

440481
%--------------------------------------
441-
\subsection{Test Coverage}
482+
\section{Test Coverage}
442483

443484
At this stage, all our tests pass. But what does that mean regarding our application ?
444485

445486
Not much you may say, but can you quantify it and will you be able to tell on a real project ?
446487

447488
This is when \textbf{test coverage} becomes handy.
448489

449-
\subsubsection{Run test coverage}
490+
\subsection{Run test coverage}
450491

451492
Run the following \texttt{maven} command~:
452493
\begin{lstlisting}
@@ -464,15 +505,17 @@ \subsubsection{Run test coverage}
464505
$ firefox target/site/cobertura/index.html &
465506
\end{lstlisting}
466507

467-
\subsubsection{Exercice 3}
508+
\section{Exercice 3}
509+
510+
\subsubsection{TODO~:}
468511

469512
\begin{itemize}
470513
\item Populate your tests to achieve 100\% test coverage.\\
471514
Hint~: you may not need any additional tests ;)
472515
\end{itemize}
473516

474517

475-
\subsubsection{[Optional] Integrate cobertura to your reporting local website}
518+
\subsection{Integrate cobertura to your reporting local website}
476519

477520
Add the following to the file \texttt{pom.xml}
478521
\begin{lstlisting}
@@ -489,10 +532,10 @@ \subsubsection{[Optional] Integrate cobertura to your reporting local website}
489532

490533
The report generation is now included in the build lifecycle (\textbf{\texttt{site}} phase).
491534

492-
\subsubsection{Exercice 3bis}
535+
\subsubsection{TODO~:}
493536

494537
\begin{itemize}
495-
\item To generate the report~:
538+
\item Generate the report~:
496539
\begin{lstlisting}
497540
$ pwd
498541
yourpath/tpcisedra/java
@@ -505,24 +548,42 @@ \subsubsection{Exercice 3bis}
505548
\end{lstlisting}
506549
\end{itemize}
507550

508-
\subsubsection{Add some new class to our project}
551+
\section{Exercice 3bis - Coverage Report on Jenkins}
552+
553+
\subsection{Adding build feedback}
554+
One of the good things with \texttt{Jenkins} is its ability to nicely present your test results. \\
555+
The tools we used to run tests and code quality checks have been selected based on the availability of the corresponding \texttt{Jenkins} plugins.
556+
557+
\subsection{Add coverage report}
558+
\begin{itemize}
559+
\item Go back to your item's configuration page (use the menu on the left)
560+
\item Replace your build's \textbf{\texttt{Goals and options}} with \texttt{cobertura:cobertura -Dcobertura.report.format=xml}
561+
\item Click on \textbf{\texttt{Add post-build action}} and select \textbf{\texttt{Publish Cobertura Coverage Report}} from the drop-down menu, your \textbf{\texttt{Cobertura xml report pattern}} is \texttt{**/target/site/cobertura/coverage.xml} (it is the example provided below the field)
562+
\item Save and Run the test
563+
\item Check the output~: in the \texttt{Build History} on the left, click on the last build, you should have a new entry named \textbf{\texttt{Coverage Report}}, have a look at it
564+
\end{itemize}
565+
566+
567+
568+
\section{Add a new class to our project}
509569

510570
Let's add a new class \texttt{Alphabet} and its test class \texttt{AlphabetTest} to our project
511571
\begin{lstlisting}
512572
$ git merge alpha
513573
\end{lstlisting}
514574

515575

516-
\subsubsection{Exercice 4}
576+
\section{Exercice 4}
517577
\begin{itemize}
518578
\item Generate and visualize the corresponding coverage report
519579
\item Make what changes are necessary to achieve 100\% test coverage
580+
\item Check that you get the same results on Jenkins
520581
\end{itemize}
521582

522583
%--------------------------------------
523-
\subsection{Stylecheck}
584+
\section{Stylecheck}
524585

525-
\subsubsection{Run a style checker}
586+
\subsection{Run a style checker}
526587

527588
Let's try and run a style checker~:
528589
\begin{lstlisting}
@@ -532,9 +593,9 @@ \subsubsection{Run a style checker}
532593
\end{lstlisting}
533594
We get plenty of errors with the default style \verb?sun_checks.xml?.
534595

535-
Our coding style is close to Google style than it is to Sun style.
596+
Our coding style is closer to Google style than it is to Sun style.
536597

537-
\subsubsection{Run Google style checker}
598+
\subsection{Run Google style checker}
538599

539600
Try running with Google checks (provided by the plugin)
540601
\begin{lstlisting}
@@ -551,7 +612,9 @@ \subsubsection{Run Google style checker}
551612

552613
It's getting better but we might want to make a few changes to this default behaviour.
553614

554-
\subsubsection{Exercice 5}
615+
\section{Exercice 5}
616+
617+
\subsubsection{TODO~:}
555618

556619
\begin{itemize}
557620
\item Retrieve a local copy of google checks
@@ -563,7 +626,7 @@ \subsubsection{Exercice 5}
563626
\item You may also consider removing trailing underscores from data members or amending \texttt{checkstyle.xml}
564627
\end{itemize}
565628

566-
\subsubsection{[Optional] Integrate checkstyle to your reporting local website}
629+
\section{Integrate checkstyle to your reporting local website}
567630

568631
Add the following to the file \texttt{pom.xml}
569632
\begin{lstlisting}
@@ -580,10 +643,10 @@ \subsubsection{[Optional] Integrate checkstyle to your reporting local website}
580643

581644
The check style report is now included in the build lifecycle (\textbf{\texttt{site}} phase).
582645

583-
\subsubsection{Exercice 5bis}
646+
\subsubsection{TODO~:}
584647

585648
\begin {itemize}
586-
\item To generate the report~:
649+
\item Generate the report~:
587650
\begin{lstlisting}
588651
$ pwd
589652
yourpath/tpcisedra/java
@@ -595,56 +658,9 @@ \subsubsection{Exercice 5bis}
595658
\end{lstlisting}
596659
\end{itemize}
597660

661+
\section{Exercice 5bis - Checkstyle Report on Jenkins}
598662

599-
600-
%----------------------------------------------------------------------------------------
601-
% Java CI
602-
%----------------------------------------------------------------------------------------
603-
\section{Continuous Integration Part}
604-
605-
\subsection{Log into the project's Jenkins instance}
606-
Connect to the INRIA Continuous Integration web portal~: \url{https://ci.inria.fr/} \\
607-
Log in and click \textbf{\texttt{Dashboard}}in the top menu \\
608-
You should have been added to project \textbf{\texttt{TPCISedRa}}, click on the \textbf{\texttt{Jenkins}} button \\
609-
You may be prompted to log into \texttt{Jenkins}, use the same login/passwd as for the ci portal
610-
611-
\subsection{Running your first test on CI}
612-
From our \texttt{Jenkins} dashboard page (\url{https://ci.inria.fr/tpcisedra/}), click \textbf{\texttt{New Item}} in the menu on the left
613-
Provide a name for this new item (avoid spaces since it is likely to lead to errors) and select \textbf{\texttt{Maven project}}
614-
615-
\subsubsection{Git configuration}
616-
In the new item's configuration page (which you will be redirected to after clicking \textbf{\texttt{OK}}), choose \texttt{git} as your \textbf{\texttt{Source Code Manager}} and copy the \emph{anonymous} url to your personal repository into the appropriate field~:
617-
\begin{lstlisting}
618-
https://scm.gforge.inria.fr/anonscm/git/tpcisedra/users/<yourlogin>.git
619-
\end{lstlisting}
620-
\end{homeworkProblem}
621-
622-
\subsubsection{Build configuration}
623-
In the \textbf{\texttt{Build}} section, change the root POM path to \texttt{java/pom.xml} and type \texttt{test} in \textbf{\texttt{Goals and options}} section.
624-
625-
\subsubsection{Save}
626-
627-
\subsubsection{Run the test}
628-
Click \textbf{\texttt{Build Now}} in the menu on the left
629-
630-
\subsubsection{Check the output}
631-
In the \textbf{\texttt{Build History}} on the left, click on the last build (hopefully \#1), then select \textbf{\texttt{Console Output}} \\
632-
You can also check the \textbf{\texttt{Test Result}}
633-
634-
\subsection{Adding build feedback}
635-
One of the good things with \texttt{Jenkins} is its ability to nicely present your test results. \\
636-
The tools we used to run tests and code quality checks have been selected based on the availability of the corresponding \texttt{Jenkins} plugins.
637-
638-
\subsubsection{Add coverage report}
639-
\begin{itemize}
640-
\item Go back to your item's configuration page (use the menu on the left)
641-
\item Replace your build's \textbf{\texttt{Goals and options}} with \texttt{cobertura:cobertura -Dcobertura.report.format=xml}
642-
\item Click on \textbf{\texttt{Add post-build action}} and select \textbf{\texttt{Publish Cobertura Coverage Report}} from the drop-down menu, your \textbf{\texttt{Cobertura xml report pattern}} is \texttt{**/target/site/cobertura/coverage.xml} (it is the example provided below the field)
643-
\item Save and Run the test
644-
\item Check the output~: in the \texttt{Build History} on the left, click on the last build, you should have a new entry named \textbf{\texttt{Coverage Report}}, have a look at it
645-
\end{itemize}
646-
647-
\subsubsection{Add checkstyle report}
663+
\subsubsection{TODO~:}
648664
\begin{itemize}
649665
\item Go back to your item's configuration page and add \\
650666
\texttt{checkstyle:checkstyle -Dcheckstyle.config.location=google\_checks.xml} to your build's \textbf{\texttt{Goals and options}}

0 commit comments

Comments
 (0)