Aller au contenu

TP05 : Integrate CI/CD for your Application

In this assignment, you will deliver CI/CD integration for your application, based on the Node.js testing codelab.

You must deliver the code of your Express Node.js application on git. The application is the one delivered in TP 04 and it now integrates test programs with CI/CD.

When loading the Node.js application into WebStorm, one must be capable of successfully running the test programs locally, without any other step than performing npm install. CI/CD must also be correctly configured and tests must run successfully on the gitlab repository.

Goals

After accomplishing this assignement, students will have implemented test programs with CI/CD integration for their application.

At the end of this assignment, students:

  • will understand the important concepts for implementing test programs for Node.js applications;
  • will understand the important concepts for integrating CI/CD for Node.js applications;
  • will know how to use git for delivering the expected content.

The deliverables of the assignement are:

  • the code delivered to the existing “tp04” repository on “gitlab.forge.hefr.ch” with the Express Node.js application that implements the API defined in a OpenAPI specification document. Note that the Node.js modules required for the application must NOT be pushed to the repository, but must rather be added to the project/application dependencies;
  • the “.gitlab-ci.yml” file for executing continuous integration on the gitlab repository, integrating both tests and deployment.
  • a report in pdf format delivered using the related Teams assignment.
  • a fix for all issues that have been reported for “tp03” and “tp04”. Issues will be reported at latest 4 days before the deadline for delivering “tp05”. The issues must be reported as closed on git.

Deadline

The deadline for delivering this assignment is given in the semester planning and in the corresponding assignment on Teams.

Testing and Deploying your Express Application

For testing your application, you must apply the same CI/CD concepts as demonstrated in the Node.js testing codelab for the Unit Converter application. For your application, the following steps apply:

  • You must test the component delivering the whole set of cases from the csv file (function equivalent to readData() for the COVID example):
    • readData() returns a bi-dimensional array and the number of rows must correspond to the number of days stored in the database.
    • each row returned must contain the same number of columns (elements).
  • You must test the component delivering the data required by the controller (function equivalent to getCases() for the COVID example):
    • the number of rows in the array returned by the function is tested to be as expected.
    • the number of elements in each row is tested to be as expected.
  • You must test the Express application beyond tests already implicitly implemented by the OpenAPI validator module:
    • the responses sent by the Express application are correct in the case where no query parameter is specified in the request and in the case some or all query parameters are specified.
  • You must deploy the application to Heroku.
  • You must update your Express application by including the “.gitlab-ci.yml” file and the test files to your repository.

Report

The report must follow the following guidelines:

  • It must be written in French or English.
  • One title page with at least:
    • the school name and logo (official logo)
    • the course name : Module Application des données : Développement back-end
    • the title of the document : “Travail Pratique 5 : Integrate CI/CD for your Application”
    • your group number
    • the authors’ name
    • the report delivery date
  • One short introduction for describing the context and goals
  • A summary of the concepts that are important and that you should retain/fully understand, by commenting whether
    • the concept is not well understood (non acquis);
    • the concept is essentially understood, but some points remain to be exercised; (acquis, à exercer);
    • the concept is fully undertood (acquis).
  • The report must include a test section that shows that:
    • The Test job completes successfully as the first job of the pipeline.
    • The Deploy job completes successfully as the second job of the pipeline.
    • Your application runs successfully on Heroku.
  • The parts of the code/source/specification that should be highlighted and that require specific attention.
  • Some conclusions like what you have liked or not, remarks on how the codelab or assignement can be improved, and the number of hours that you have spent for each student of the group (outside hours in the classroom).

Important

Deliver your report based on instructions received during the lesson and according to the schedule. Your document must be named “report05.pdf”.