|
1 | | -## OVERVIEW |
2 | | - - Structure: |
3 | | - includes/ → header files (.h, .hpp) |
4 | | - src/ → source files (.cpp) |
5 | | - tests/ → GoogleTest test cases |
| 1 | +## 1. OVERVIEW |
| 2 | +**Project Structure** |
| 3 | +``` |
| 4 | +includes/ → Header files (.h, .hpp) |
| 5 | +src/ → Source files (.cpp) |
| 6 | +tests/ → GoogleTest test cases |
| 7 | +``` |
| 8 | +## 2. DEPENDENCIES |
| 9 | +Make sure the following tools are installed before building the project: |
| 10 | +- **g++ / gcc** |
| 11 | +- **CMake** |
| 12 | +- **Git** |
| 13 | +- **lcov** (for code coverage) |
| 14 | +- **cppcheck** (for static analysis) |
6 | 15 |
|
7 | | -## DEPENDENCIES |
8 | | - |
9 | | -## SETUP |
| 16 | +## 3. SETUP |
10 | 17 | * Setup the Local Test Environment |
11 | | - * Using your own Ubuntu system |
| 18 | + * 1.Using your own Ubuntu system |
12 | 19 | * Install `gcc`, `cmake`, `git`, and `pthread` (Skip this step if you already install) |
13 | 20 | ``` |
14 | 21 | $ sudo apt-get update |
15 | | - $ sudo apt-get install g++=4:5.3.1-1ubuntu1 |
16 | | - $ sudo apt-get install lcov=1.12-2 |
17 | | - $ sudo apt-get install cmake=3.5.1-1ubuntu3 |
18 | | - $ sudo apt-get install git=1:2.7.4-0ubuntu1.6 |
19 | | - $ sudo apt-get install libpthread-stubs0-dev=0.3-4 |
20 | | - |
| 22 | + $ sudo apt-get install g++ |
| 23 | + $ sudo apt-get install lcov |
| 24 | + $ sudo apt-get install cmake |
| 25 | + $ sudo apt-get install git |
| 26 | + $ sudo apt-get install cppcheck |
21 | 27 | ``` |
22 | 28 | * Build the application and the tests |
23 | 29 | ``` |
24 | 30 | $ cd build |
25 | 31 | $ cmake .. |
26 | 32 | $ cmake --build . |
27 | | - |
28 | 33 | ``` |
29 | 34 | * Run the application and the test |
30 | 35 | ``` |
31 | 36 | $ ./cpp_lab_project |
32 | 37 | $ ./cpp_lab_project_test |
33 | 38 | ``` |
34 | | - * (Optional) Run the cpp check |
| 39 | + * (Optional) Run static analysis |
35 | 40 | ``` |
36 | 41 | $ sudo apt-get install cppcheck |
37 | 42 | $ cppcheck "folder" / "file" |
38 | 43 | ``` |
39 | | - * Using **Docker** |
40 | | - * Use the -t or --tag flag to set the name of the image to be created. (the full name is actually sample-ci-cpp:latest, since latest is the default tag) |
41 | | - * Opening an interactive shell inside your Docker container to explore, test, or debug the environment built from your image. |
42 | | - * docker run → start a new container. |
43 | | - * -it → run it interactively: |
44 | | - * -i = keep STDIN open (so you can type commands) |
45 | | - * -t = allocate a terminal (TTY) |
46 | | - * sample-ci-cpp:latest → the image you built earlier. |
47 | | - * /bin/bash → the command to execute inside the container (opens a Bash shell). |
| 44 | + * 2.Using **Docker** |
| 45 | + * Build the Docker image |
48 | 46 | ``` |
49 | 47 | docker build --tag sample-ci-cpp . |
| 48 | + ``` |
| 49 | + * Run an interactive container |
| 50 | + ``` |
50 | 51 | docker run -it sample-ci-cpp:latest /bin/bash |
| 52 | + ``` |
| 53 | + * Inspect the environment |
| 54 | + ``` |
51 | 55 | printenv |
52 | 56 | ``` |
| 57 | + * *Notes:* |
| 58 | + * Use the -t or --tag flag to set the name of the image to be created. (the full name is actually sample-ci-cpp:latest, since latest is the default tag) |
| 59 | + * Opening an interactive shell inside your Docker container to explore, test, or debug the environment built from your image. |
| 60 | + * docker run to start a new container. |
| 61 | + * -it → run it interactively: |
| 62 | + * -i = keep STDIN open (so you can type commands) |
| 63 | + * -t = allocate a terminal (TTY) |
| 64 | + * sample-ci-cpp:latest → the image you built earlier. |
| 65 | + * /bin/bash → the command to execute inside the container (opens a Bash shell). |
53 | 66 |
|
54 | | -## DOCUMENTATIONs |
| 67 | +## 4. DOCUMENTATIONS |
0 commit comments