diff --git a/.github/workflows/build-cpp.yaml b/.github/workflows/build-cpp.yaml new file mode 100644 index 0000000..8ff9b95 --- /dev/null +++ b/.github/workflows/build-cpp.yaml @@ -0,0 +1,42 @@ +name: Build C++ Project + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake g++ lcov googletest + cd /usr/src/googletest + sudo cmake CMakeLists.txt + sudo make + sudo cp lib/*.a /usr/lib + cd ~ + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build project + run: | + ls -al + chmod 755 build.sh + ./build.sh -c + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: wordprocessor-build + path: | + _build/ + _bin/ + _test_reports/ + _test_coverage/ + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: wordprocessor-build diff --git a/CMakeLists.txt b/CMakeLists.txt index 8677861..cd0ecd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,10 +10,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # set the below values correctly if required -set(GTEST_LOCAL_PATH "/home/user/googletest") +set(GTEST_LOCAL_PATH "/usr/src/googletest") set(GTEST_ROOT "${GTEST_LOCAL_PATH}/googletest") -set(GTEST_LIBRARY "${GTEST_LOCAL_PATH}/build/lib/libgtest.a") -set(GTEST_MAIN_LIBRARY "${GTEST_LOCAL_PATH}/build/lib/libgtest_main.a") +set(GTEST_LIBRARY "${GTEST_LOCAL_PATH}/lib/libgtest.a") +set(GTEST_MAIN_LIBRARY "${GTEST_LOCAL_PATH}/lib/libgtest_main.a") set(GTEST_INCLUDE_DIRS "${GTEST_ROOT}/include") set(GMOCK_INCLUDE_DIRS "${GTEST_LOCAL_PATH}/googlemock/include") diff --git a/README.md b/README.md index 9b7e94f..84a409d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ The WordProcessor application is a C++ program that reads a list of ASCII words This ReadME file contains information on how to install and run the application, as well as the application's design page. +## Status + +[![Build WorkProcessor Project](https://github.com/RitheeshBaradwaj/WordProcessor/actions/workflows/build-cpp.yaml/badge.svg?branch=main)](https://github.com/RitheeshBaradwaj/WordProcessor/actions/workflows/build-cpp.yaml) + ## Design The detailed design of the WordProcessor application can be found on the [Design Page](docs/DESIGN.md). @@ -31,14 +35,53 @@ All the test results including binaries, unit test results, code coverage report * [Run Steps](README.md#run-steps) +## Install Build Dependencies + +The following are the steps to install dependencies for Wordprocessor applications: + +1. Update the package index on your Ubuntu system: + +```shell +sudo apt-get update +``` + +2. Install the cmake, g++ compiler, lcov coverage tool, Google Test and Google Mock libraries and headers using apt-get: + +```shell +sudo apt-get install -y googletest +``` + +3. Once the installation is complete, navigate to the /usr/src/googletest directory: + +```shell +cd /usr/src/googletest +``` + +4. Build the Google Test and Google Mock libraries: + +```shell +sudo cmake CMakeLists.txt +sudo make +``` + +5. Copy the compiled library files to the system library directory: + +```shell +sudo cp lib/*.a /usr/lib +``` + ## Installation Guide The following instructions explain how to install the WordProcessor application: -1. Clone the repository by running git clone https://github.com/example/WordProcessor.git. -2. Change to the project directory by running cd WordProcessor. -3. Install the required dependencies by running `sudo apt-get install -y g++ lcov libgtest-dev`. -4. Build the application by running `make`. +1. Install the dependencies mentioned above. +2. Clone the repository by running git clone https://github.com/example/WordProcessor.git. +3. Change to the project directory by running cd WordProcessor. +4. Build the application by running `build.sh`. + +```shell +./build.sh -c +``` ## Suitable Compiler