From fa2fc227f84b0de2220c9f7de45656b45c004a82 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:49:50 -0800 Subject: [PATCH 01/11] Create build.yml --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e910fdd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,12 @@ +name: cpplint +on: + pull_request: + branches: ["main"] +jobs: + cpplint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-python@v1 + - run: pip install cpplint + - run: cpplint --recursive From a87d43e4e9db075c6780a39700a19e12acfdaf78 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:51:16 -0800 Subject: [PATCH 02/11] Create linter.yml --- .github/workflows/linter.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..9ca647d --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,24 @@ +name: cpplinter + +on: + # push: + # branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y -f build-essential g++ cmake dos2unix python3 python3-pip + pip install cpplint + build: + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check Styling + run: cpplint *.cpp *.h From d1fb4e0d90059c9f8dbd3d14ad723a74db59f084 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 22:54:06 -0800 Subject: [PATCH 03/11] Update main.cpp --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index 65055f9..5bc9e15 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,7 @@ using std::cout; using std::endl; +// checking linter int main(int argc, char *argv[]) { if ( argc != 2 || std::atoi(argv[1]) < 1 ){ cout << "Incorrect command.\n" From df36fabbd97f158b0b7062cbf03e34cc60e0fb75 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:04:51 -0800 Subject: [PATCH 04/11] Update build.yml --- .github/workflows/build.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e910fdd..581327a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,17 @@ -name: cpplint +name: build + on: + push: + branches: [ "main" ] pull_request: - branches: ["main"] + branches: [ "main" ] + jobs: - cpplint: + build: + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - - run: pip install cpplint - - run: cpplint --recursive + - uses: actions/checkout@v3 + - name: make + run: make From 24f340918041eae26b5d22db5c5b399212f4b449 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:05:49 -0800 Subject: [PATCH 05/11] Update linter.yml --- .github/workflows/linter.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 9ca647d..4b4a260 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,24 +1,16 @@ -name: cpplinter - +name: cpp-lint on: - # push: - # branches: [ main ] + push: + branches: [ "main" ] pull_request: - branches: [ main ] - + branches: [ "main" ] jobs: - install: - runs-on: ubuntu-latest - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y -f build-essential g++ cmake dos2unix python3 python3-pip - pip install cpplint build: - needs: install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Check Styling - run: cpplint *.cpp *.h + - name: Checkout + uses: actions/checkout@v2 + - name: Build + run: | + docker build -t my-cpp-app . + docker run my-cpp-app cpplint *.cpp *. From a7c761274c4c14bdebb7a4bc7fa4ec55b955d615 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:07:29 -0800 Subject: [PATCH 06/11] Update main.cpp --- main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/main.cpp b/main.cpp index 5bc9e15..65055f9 100644 --- a/main.cpp +++ b/main.cpp @@ -6,7 +6,6 @@ using std::cout; using std::endl; -// checking linter int main(int argc, char *argv[]) { if ( argc != 2 || std::atoi(argv[1]) < 1 ){ cout << "Incorrect command.\n" From 06fe364ac9ecc2d6643d0f7288a5fb12d3bc2b18 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:08:36 -0800 Subject: [PATCH 07/11] Update GameDie.cpp --- GameDie.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameDie.cpp b/GameDie.cpp index d8ecb3a..8dd274c 100644 --- a/GameDie.cpp +++ b/GameDie.cpp @@ -29,7 +29,7 @@ GameDie::GameDie(unsigned int num) { // generate a random number between 1-n where n is the counter size // (inclusive) and return it int GameDie::roll() { - int roll = rand_r() % roll_counter.size(); + int roll = rand() % roll_counter.size(); roll_counter[roll]++; return roll + 1; } From 7d1e9b36a3342cffe70cbf881310adfb7772d1b0 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:13:32 -0800 Subject: [PATCH 08/11] Update main.cpp --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index 65055f9..666f6d1 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,7 @@ using std::cout; using std::endl; +// dummy comment int main(int argc, char *argv[]) { if ( argc != 2 || std::atoi(argv[1]) < 1 ){ cout << "Incorrect command.\n" From 918f89bb870c575787298e673bed7219d2f45f91 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:16:43 -0800 Subject: [PATCH 09/11] Update main.cpp --- main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 666f6d1..4b783dc 100644 --- a/main.cpp +++ b/main.cpp @@ -6,9 +6,9 @@ using std::cout; using std::endl; -// dummy comment +// Adding dummy comment to trigger CI workflows int main(int argc, char *argv[]) { - if ( argc != 2 || std::atoi(argv[1]) < 1 ){ + if ( argc != 2 || std::atoi(argv[1]) < 1 ) { cout << "Incorrect command.\n" << "Format: ./Roller \n" << "--------------------\n" @@ -16,8 +16,7 @@ int main(int argc, char *argv[]) { << "--------------------\n" << " - Required; a number 1 or greater representing the number\n" << " of faces on the die being rolled\n"; - } - else { + } else { int faces = std::atoi(argv[1]); GameDie die(faces); cout << die.roll() << endl; From 2c7b9c4eb90802b5cfe766b7704f71599aec7e14 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:22:12 -0800 Subject: [PATCH 10/11] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d46f7c6..dedafa6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![build](https://github.com/KishoreMenda/Roller/actions/workflows/build.yml/badge.svg)](https://github.com/KishoreMenda/Roller/actions/workflows/build.yml) # Roller This repository provides a program that rolls a game die, such as the From 5410e928c16ed8ac2b562524e6fbefc47ac2c996 Mon Sep 17 00:00:00 2001 From: Kishore <95542495+KishoreMenda@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:23:32 -0800 Subject: [PATCH 11/11] Adding status badge, Resolves #2 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dedafa6..73a3b17 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![build](https://github.com/KishoreMenda/Roller/actions/workflows/build.yml/badge.svg)](https://github.com/KishoreMenda/Roller/actions/workflows/build.yml) + # Roller This repository provides a program that rolls a game die, such as the