From d9145229a66a0c65ef3f4f0bccc95b880d8cffe4 Mon Sep 17 00:00:00 2001 From: ezaz Date: Wed, 19 Feb 2025 11:21:01 -0800 Subject: [PATCH 1/2] added ci_cd worklflow --- .github/workflows/ci_cd.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/ci_cd.yml diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..a75c487 --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,27 @@ +name: C++ CI with Docker + +on: [push, pull_request] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Docker + run: | + sudo apt-get update + sudo apt-get install -y docker.io + + # Optional: If you want to clone the cpp-container repository inside your CI job + # or if your Dockerfile is in your HelloWorld repo, adjust accordingly + - name: Build Docker Image + run: | + docker build -t cpp-container . + + - name: Run Tests in Docker + run: | + docker run -v ${{ github.workspace }}:/usr/src -w /usr/src cpp-container sh ./test_runner.sh + From 9958372e68bcc57f77e69266d3b85edebcdb3c65 Mon Sep 17 00:00:00 2001 From: ezaz Date: Wed, 19 Feb 2025 11:37:17 -0800 Subject: [PATCH 2/2] added docker --- main.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index b22f491..c18653e 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,32 @@ #include +#include +#include + +int main() { + std::vector favoriteFoods; + std::string input; + + std::cout << "Enter your favorite food one by one. Type 'done' when finished.\n"; + + while (true) { + std::cout << "What's your favorite food? "; + std::getline(std::cin, input); + + // Check if the user is done entering foods + if (input == "done") { + break; + } + + // Add the food to the list + favoriteFoods.push_back(input); + } + + // Print the list of favorite foods + std::cout << "\nYour favorite foods are:\n"; + for (const auto& food : favoriteFoods) { + std::cout << "- " << food << "\n"; + } + + return 0; +} -int main(){ - std::cout<<"Hello World!\n"; - return 0; -} \ No newline at end of file