From af3e90490edac6a77550160c3042c1d4e2d6dfdf Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Fri, 8 Sep 2023 13:27:50 +0530 Subject: [PATCH 01/56] fix(*): code cleanups --- .phpunit.result.cache | 2 +- .../HR/Tests/Feature}/ApplicantTest.php | 4 +- .../HR/Tests/Unit}/ApplicantTest.php | 2 +- app/User.php | 86 ------------------- tests/TestCase.php | 2 +- 5 files changed, 5 insertions(+), 91 deletions(-) rename {tests/Feature/HR => Modules/HR/Tests/Feature}/ApplicantTest.php (84%) rename {tests/Unit/HR => Modules/HR/Tests/Unit}/ApplicantTest.php (92%) delete mode 100644 app/User.php diff --git a/.phpunit.result.cache b/.phpunit.result.cache index a5091659c3..b584f9b9a9 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"Tests\\Feature\\ExampleTest::test_example":4,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":3},"times":{"Tests\\Unit\\ExampleTest::test_example":0.302,"Tests\\Feature\\ExampleTest::test_example":3.062,"Tests\\Unit\\HR\\ApplicationTest::test_example":0.128,"Tests\\Unit\\HR\\ApplicantTest::test_example":0.121,"Tests\\Unit\\HR\\ApplicantTest::test_example_2":0.13,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":0.138,"Tests\\Feature\\HR\\ExampleTest::test_example":0.152}} \ No newline at end of file +{"version":1,"defects":{"Tests\\Feature\\ExampleTest::test_example":4,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":3,"Modules\\HR\\Tests\\Feature\\ApplicantTest::test_example":4},"times":{"Tests\\Unit\\ExampleTest::test_example":0.251,"Tests\\Feature\\ExampleTest::test_example":3.573,"Tests\\Unit\\HR\\ApplicationTest::test_example":0.128,"Tests\\Unit\\HR\\ApplicantTest::test_example":0.121,"Tests\\Unit\\HR\\ApplicantTest::test_example_2":0.13,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":0.138,"Tests\\Feature\\HR\\ExampleTest::test_example":0.152,"Modules\\HR\\Tests\\Feature\\ApplicantTest::test_example":0.27,"Modules\\HR\\Tests\\Unit\\ApplicantTest::test_example":0.19,"Modules\\HR\\Tests\\Unit\\ApplicantTest::test_create_applicant":0.187}} \ No newline at end of file diff --git a/tests/Feature/HR/ApplicantTest.php b/Modules/HR/Tests/Feature/ApplicantTest.php similarity index 84% rename from tests/Feature/HR/ApplicantTest.php rename to Modules/HR/Tests/Feature/ApplicantTest.php index 2b4a093b9c..df985ae571 100644 --- a/tests/Feature/HR/ApplicantTest.php +++ b/Modules/HR/Tests/Feature/ApplicantTest.php @@ -1,11 +1,11 @@ first(); - } - - /** - * Checks if the user is super admin. - * - * @return bool - */ - public function isSuperAdmin() - { - return $this->hasRole('super-admin'); - } - - public static function scopeInterviewers($query) - { - return $query->where('provider', 'google'); - } - - public function getAvatarAttribute($value) - { - return $value ?: url('/images/default_profile.png'); - } - - public function books() - { - return $this->belongsToMany(Book::class, 'book_readers', 'user_id', 'library_book_id'); - } - - public function totalReadBooks() - { - return $this->books()->count(); - } - - public function getIsActiveEmployeeAttribute() - { - // The employees will have a GSuite ID. That means the provider will be google. - // Also, to make sure there's no false entry, we'll also check if the email - // contains the gsuite client hd parameter. - return $this->provider == 'google' && strpos($this->email, config('constants.gsuite.client-hd')) !== false; - } - - public function employee() - { - return $this->hasOne(Employee::class, 'user_id'); - } - - public function scopeFindByEmail($query, $email) - { - return $query->where('email', $email); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php index ac34a367df..60fc29648e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,7 +11,7 @@ abstract class TestCase extends BaseTestCase protected function signIn($role = null) { - $user = create(User::class); + $user = User::factory()->create(); is_null($role) ?: $user->assignRole($role); $this->be($user); From 30cc3a584d55c90195455f3789e4e735b0bb4e7d Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Fri, 8 Sep 2023 13:30:04 +0530 Subject: [PATCH 02/56] fix(*): code cleanups --- .gitignore | 2 + .husky/_/.gitignore | 1 - .husky/_/husky.sh | 29 -- .husky/_/pre-commit | 4 - .phpunit.result.cache | 1 - .../views/hr/application/create.blade.php | 344 +++++++++--------- 6 files changed, 174 insertions(+), 207 deletions(-) delete mode 100644 .husky/_/.gitignore delete mode 100644 .husky/_/husky.sh delete mode 100644 .husky/_/pre-commit delete mode 100644 .phpunit.result.cache diff --git a/.gitignore b/.gitignore index dcc1d3e2b6..5b1ecc545e 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ cypress/screenshots google_service_credentials.json .phpunit.result.cache +.phpunit.result.cache/ + diff --git a/.husky/_/.gitignore b/.husky/_/.gitignore deleted file mode 100644 index f59ec20aab..0000000000 --- a/.husky/_/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* \ No newline at end of file diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh deleted file mode 100644 index 5f7c17c20e..0000000000 --- a/.husky/_/husky.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -if [ -z "$husky_skip_init" ]; then - debug () { - [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" - } - - readonly hook_name="$(basename "$0")" - debug "starting $hook_name..." - - if [ "$HUSKY" = "0" ]; then - debug "HUSKY env variable is set to 0, skipping hook" - exit 0 - fi - - if [ -f ~/.huskyrc ]; then - debug "sourcing ~/.huskyrc" - . ~/.huskyrc - fi - - export readonly husky_skip_init=1 - sh -e "$0" "$@" - exitCode="$?" - - if [ $exitCode != 0 ]; then - echo "husky - $hook_name hook exited with code $exitCode (error)" - fi - - exit $exitCode -fi diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit deleted file mode 100644 index 36af219892..0000000000 --- a/.husky/_/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx lint-staged diff --git a/.phpunit.result.cache b/.phpunit.result.cache deleted file mode 100644 index b584f9b9a9..0000000000 --- a/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -{"version":1,"defects":{"Tests\\Feature\\ExampleTest::test_example":4,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":3,"Modules\\HR\\Tests\\Feature\\ApplicantTest::test_example":4},"times":{"Tests\\Unit\\ExampleTest::test_example":0.251,"Tests\\Feature\\ExampleTest::test_example":3.573,"Tests\\Unit\\HR\\ApplicationTest::test_example":0.128,"Tests\\Unit\\HR\\ApplicantTest::test_example":0.121,"Tests\\Unit\\HR\\ApplicantTest::test_example_2":0.13,"Tests\\Unit\\HR\\ApplicantTest::test_create_applicant":0.138,"Tests\\Feature\\HR\\ExampleTest::test_example":0.152,"Modules\\HR\\Tests\\Feature\\ApplicantTest::test_example":0.27,"Modules\\HR\\Tests\\Unit\\ApplicantTest::test_example":0.19,"Modules\\HR\\Tests\\Unit\\ApplicantTest::test_create_applicant":0.187}} \ No newline at end of file diff --git a/resources/views/hr/application/create.blade.php b/resources/views/hr/application/create.blade.php index 6ebada1634..e0cc9d6104 100644 --- a/resources/views/hr/application/create.blade.php +++ b/resources/views/hr/application/create.blade.php @@ -1,172 +1,172 @@ -@extends('layouts.app') -@include('hr.application.excel-import') - -@section('content') -
-
-
-
- @include('hr.menu') -

-
-
- - - -
-

Add new application

-
- - - -
-
-
- @include('status', ['errors' => $errors->all()]) -
-
- @csrf -
-
-
-
-
- -
- - -
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
-
- - -
-
-
- -
- - -
-
- -
-
- - -
- -
- - -
- -
- - -
- - -
- - -
- -
- - -
- -
- - -
-
-
-
- - -
-
-
-
-@endsection +@extends('layouts.app') +@include('hr.application.excel-import') + +@section('content') +
+
+
+
+ @include('hr.menu') +

+
+
+ + + +
+

Add new application

+
+ + + +
+
+
+ @include('status', ['errors' => $errors->all()]) +
+
+ @csrf +
+
+
+
+
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ + +
+
+
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+
+
+
+@endsection From fc3167fcc8ab8879734a3811dd81fc678cfdb48e Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Sat, 9 Sep 2023 14:51:41 +0530 Subject: [PATCH 03/56] fix(*): code cleanups --- Modules/Project/Contract/ProjectServiceContract.php | 2 +- phpunit.xml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Modules/Project/Contract/ProjectServiceContract.php b/Modules/Project/Contract/ProjectServiceContract.php index 95452ecc82..65309d4c84 100644 --- a/Modules/Project/Contract/ProjectServiceContract.php +++ b/Modules/Project/Contract/ProjectServiceContract.php @@ -1,6 +1,6 @@ ./app + ./Modules/HR + + ./Modules + ./Modules/**/Routes + ./Modules/**/Resources + ./Modules/**/Tests + ./Modules/**/Config + From a761bf9acb7037fde8b1dab8c7cc87aaba3d250a Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Sat, 9 Sep 2023 14:54:14 +0530 Subject: [PATCH 04/56] fix(*): code cleanups --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5b1ecc545e..d7375a1213 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ google_service_credentials.json .phpunit.result.cache .phpunit.result.cache/ +codecov +codecov/ From 836d1497544534a0dd608c01fb02e145dc4a9ea8 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Sat, 9 Sep 2023 15:05:14 +0530 Subject: [PATCH 05/56] fix(*): Add CI files for code coverage --- .github/workflows/code-coverage.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/code-coverage.yml diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml new file mode 100644 index 0000000000..a642a894c2 --- /dev/null +++ b/.github/workflows/code-coverage.yml @@ -0,0 +1,18 @@ +name: Workflow for code coverage +on: [push, pull_request] +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up php 7.4 + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + - name: Install dependencies + run: composer self-update && composer install && composer dump-autoload + - name: Run tests and collect coverage + run: vendor/bin/phpunit --coverage-clover coverage.xml . + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 From 54c3f56e6b086470f63ad581f4f586e18ee4aa83 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Sat, 9 Sep 2023 15:19:08 +0530 Subject: [PATCH 06/56] fix(*): Add CI files for code coverage --- .github/workflows/code-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index a642a894c2..a393b0fc83 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -13,6 +13,6 @@ jobs: - name: Install dependencies run: composer self-update && composer install && composer dump-autoload - name: Run tests and collect coverage - run: vendor/bin/phpunit --coverage-clover coverage.xml . + run: vendor/bin/phpunit --coverage-clover coverage.xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 From b9e9b5fe1e36ff048afc5e8a2355ce0754c79ae2 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Sat, 9 Sep 2023 15:24:51 +0530 Subject: [PATCH 07/56] fix(*): Add CI files for code coverage --- .github/workflows/code-coverage.yml | 18 ------------------ .github/workflows/integration-testing.yml | 9 ++++++++- 2 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 .github/workflows/code-coverage.yml diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml deleted file mode 100644 index a393b0fc83..0000000000 --- a/.github/workflows/code-coverage.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Workflow for code coverage -on: [push, pull_request] -jobs: - run: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up php 7.4 - uses: shivammathur/setup-php@v2 - with: - php-version: "7.4" - - name: Install dependencies - run: composer self-update && composer install && composer dump-autoload - - name: Run tests and collect coverage - run: vendor/bin/phpunit --coverage-clover coverage.xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index ed27083da3..2715cc01bb 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -31,7 +31,7 @@ jobs: - name: Setup PHP v8.2 uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: "8.2" - name: Setup cypress-testing uses: actions/checkout@v2 @@ -71,3 +71,10 @@ jobs: run: | cp cypress.json.example cypress.json npm run cypress-record ${{ secrets.CYPRESS_DASHBOARD_KEY }} + + - name: Run Test Suit + run: | + vendor/bin/phpunit --coverage-clover coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 From 7d0406066cde57a88726a0bd9f557162fc404c01 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 12:49:05 +0530 Subject: [PATCH 08/56] fix(*): Add CI files for code coverage --- .env.example | 11 +- .github/workflows/integration-testing.yml | 12 +- config/database.php | 2 +- coverage.xml | 8450 +++++++++++++++++++++ 4 files changed, 8462 insertions(+), 13 deletions(-) create mode 100644 coverage.xml diff --git a/.env.example b/.env.example index ef30989360..6ab0ecc0b9 100644 --- a/.env.example +++ b/.env.example @@ -14,6 +14,10 @@ DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret +DB_TEST_DATABASE=homestead +DB_TEST_USERNAME=homestead +DB_TEST_PASSWORD=secret + BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file @@ -110,9 +114,4 @@ HR_FOLLOWUP_EMAIL_SECONDARY="" CAMPAIGNS_TOOL_URL= CAMPAIGNS_CLIENT_SECRET= -CAMPAIGNS_CLIENT_ID= - - -DB_TEST_DATABASE=portal_test -DB_TEST_USERNAME='root' -DB_TEST_PASSWORD='root' \ No newline at end of file +CAMPAIGNS_CLIENT_ID= \ No newline at end of file diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index 2715cc01bb..852cc45845 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -33,8 +33,8 @@ jobs: with: php-version: "8.2" - - name: Setup cypress-testing - uses: actions/checkout@v2 + # - name: Setup cypress-testing + # uses: actions/checkout@v2 - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" @@ -67,10 +67,10 @@ jobs: run: | php artisan serve & - - name: Run cypress - run: | - cp cypress.json.example cypress.json - npm run cypress-record ${{ secrets.CYPRESS_DASHBOARD_KEY }} + # - name: Run cypress + # run: | + # cp cypress.json.example cypress.json + # npm run cypress-record ${{ secrets.CYPRESS_DASHBOARD_KEY }} - name: Run Test Suit run: | diff --git a/config/database.php b/config/database.php index e3753b1a80..29dfa528c0 100644 --- a/config/database.php +++ b/config/database.php @@ -56,7 +56,7 @@ 'testing' => [ 'driver' => 'mysql', - 'host' => env('DB_TEST_HOST', '127.0.0.1'), + 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_TEST_DATABASE', 'portal_test'), 'username' => env('DB_TEST_USERNAME', 'root'), diff --git a/coverage.xml b/coverage.xml new file mode 100644 index 0000000000..7075e105a0 --- /dev/null +++ b/coverage.xml @@ -0,0 +1,8450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e1f2bc1fee8c5a4045f9662ab082db843193b127 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 12:53:39 +0530 Subject: [PATCH 09/56] fix(*): Add CI files for code coverage --- .github/workflows/integration-testing.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index 852cc45845..dcf5b6f6ee 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -28,13 +28,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # cypress setup - - name: Setup PHP v8.2 + - name: Setup PHP v7.4 uses: shivammathur/setup-php@v2 with: - php-version: "8.2" + php-version: "7.4" - # - name: Setup cypress-testing - # uses: actions/checkout@v2 + - name: Setup cypress-testing + uses: actions/checkout@v2 - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" @@ -67,14 +67,14 @@ jobs: run: | php artisan serve & - # - name: Run cypress - # run: | - # cp cypress.json.example cypress.json - # npm run cypress-record ${{ secrets.CYPRESS_DASHBOARD_KEY }} - - name: Run Test Suit run: | vendor/bin/phpunit --coverage-clover coverage.xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + + - name: Run cypress + run: | + cp cypress.json.example cypress.json + npm run cypress-record ${{ secrets.CYPRESS_DASHBOARD_KEY }} From c35f94187108e370378846832e012641b0b77887 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 12:59:52 +0530 Subject: [PATCH 10/56] fix(*): Add CI files for code coverage --- .github/workflows/integration-testing.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index dcf5b6f6ee..42a89eab87 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -68,6 +68,12 @@ jobs: php artisan serve & - name: Run Test Suit + env: + DB_CONNECTION: mysql + DB_DATABASE: homestead + DB_PORT: 3306 + DB_USER: homestead + DB_PASSWORD: secret run: | vendor/bin/phpunit --coverage-clover coverage.xml From f00f6c76d12344450e6a4ecb98f18a8490c84f0d Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:07:04 +0530 Subject: [PATCH 11/56] fix(*): Add CI files for code coverage --- config/database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/database.php b/config/database.php index 29dfa528c0..aa35caf371 100644 --- a/config/database.php +++ b/config/database.php @@ -58,9 +58,9 @@ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_TEST_DATABASE', 'portal_test'), - 'username' => env('DB_TEST_USERNAME', 'root'), - 'password' => env('DB_TEST_PASSWORD', 'root'), + 'database' => env('DB_TEST_DATABASE', 'homestead'), + 'username' => env('DB_TEST_USERNAME', 'homestead'), + 'password' => env('DB_TEST_PASSWORD', 'secret'), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', From 986dc37b0a15a7dca8b1ccbd61c9537be1d845c8 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:11:07 +0530 Subject: [PATCH 12/56] fix(*): Add CI files for code coverage --- .env.testing | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.testing b/.env.testing index bb05718ffc..a1587410e4 100644 --- a/.env.testing +++ b/.env.testing @@ -4,9 +4,9 @@ APP_URL=http://127.0.0.1:8000 APP_TIMEZONE=UTC DB_CONNECTION=testing -DB_TEST_DATABASE=portal_test -DB_TEST_USERNAME='root' -DB_TEST_PASSWORD='root' +DB_TEST_DATABASE=homestead +DB_TEST_USERNAME=homestead +DB_TEST_PASSWORD=secret CACHE_DRIVER=array SESSION_DRIVER=array From 6b9659c8f7e30b8b53858e95d4c3153ffa6677f2 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:20:08 +0530 Subject: [PATCH 13/56] fix(*): Add CI files for code coverage --- .env.example | 10 +- .env.testing | 6 +- .github/workflows/integration-testing.yml | 20 +- config/database.php | 6 +- coverage.xml | 826 +++++++++++----------- 5 files changed, 429 insertions(+), 439 deletions(-) diff --git a/.env.example b/.env.example index 6ab0ecc0b9..ca31eefc89 100644 --- a/.env.example +++ b/.env.example @@ -10,13 +10,9 @@ LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=homestead -DB_USERNAME=homestead -DB_PASSWORD=secret - -DB_TEST_DATABASE=homestead -DB_TEST_USERNAME=homestead -DB_TEST_PASSWORD=secret +DB_DATABASE=portal_test +DB_USERNAME=root +DB_PASSWORD=root BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/.env.testing b/.env.testing index a1587410e4..bb05718ffc 100644 --- a/.env.testing +++ b/.env.testing @@ -4,9 +4,9 @@ APP_URL=http://127.0.0.1:8000 APP_TIMEZONE=UTC DB_CONNECTION=testing -DB_TEST_DATABASE=homestead -DB_TEST_USERNAME=homestead -DB_TEST_PASSWORD=secret +DB_TEST_DATABASE=portal_test +DB_TEST_USERNAME='root' +DB_TEST_PASSWORD='root' CACHE_DRIVER=array SESSION_DRIVER=array diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index 42a89eab87..d5e33ada13 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -17,10 +17,10 @@ jobs: mysql: image: mysql:5.7 env: - MYSQL_USER: homestead - MYSQL_PASSWORD: secret + MYSQL_USER: root + MYSQL_PASSWORD: root MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: homestead + MYSQL_DATABASE: portal_test ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 @@ -63,23 +63,17 @@ jobs: npm install npm run dev - - name: Run local server - run: | - php artisan serve & - - name: Run Test Suit - env: - DB_CONNECTION: mysql - DB_DATABASE: homestead - DB_PORT: 3306 - DB_USER: homestead - DB_PASSWORD: secret run: | vendor/bin/phpunit --coverage-clover coverage.xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + - name: Run local server + run: | + php artisan serve & + - name: Run cypress run: | cp cypress.json.example cypress.json diff --git a/config/database.php b/config/database.php index aa35caf371..29dfa528c0 100644 --- a/config/database.php +++ b/config/database.php @@ -58,9 +58,9 @@ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_TEST_DATABASE', 'homestead'), - 'username' => env('DB_TEST_USERNAME', 'homestead'), - 'password' => env('DB_TEST_PASSWORD', 'secret'), + 'database' => env('DB_TEST_DATABASE', 'portal_test'), + 'username' => env('DB_TEST_USERNAME', 'root'), + 'password' => env('DB_TEST_PASSWORD', 'root'), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', diff --git a/coverage.xml b/coverage.xml index 7075e105a0..d63b210442 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,6 +1,6 @@ - - + + @@ -163,7 +163,7 @@ - + @@ -172,14 +172,14 @@ - - - - - - - - + + + + + + + + @@ -224,19 +224,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -460,187 +460,187 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - + - - - - + + + + - + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - + - - - - + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - - + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - + + + + + + + + + + @@ -649,137 +649,137 @@ - + - + - - - - + + + + - + - + - - - - + + + + - + - + - - - - + + + + - + - + - - - - + + + + - + - + - - - - + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - + - - - - - + + + + + - + - - - - - - - - - - - + + + + + + + + + + + @@ -787,71 +787,71 @@ - + - + - - - - + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + @@ -859,35 +859,35 @@ - + - - - - - - - - + + + + + + + + - + - + - - - - + + + + - + @@ -1966,7 +1966,7 @@ - + @@ -1998,8 +1998,8 @@ - - + + @@ -2037,7 +2037,7 @@ - + @@ -5132,11 +5132,11 @@ - + - - - + + + @@ -5146,7 +5146,7 @@ - + @@ -5367,84 +5367,84 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - + + + - + @@ -5769,11 +5769,11 @@ - + - - - + + + @@ -5880,7 +5880,7 @@ - + @@ -5918,9 +5918,9 @@ - - - + + + @@ -6522,19 +6522,19 @@ - + - - - - - - - - - - - + + + + + + + + + + + @@ -6562,7 +6562,7 @@ - + @@ -7377,15 +7377,15 @@ - + - - - - - - - + + + + + + + @@ -7638,7 +7638,7 @@ - + @@ -7664,8 +7664,8 @@ - - + + @@ -7675,15 +7675,15 @@ - - - - - - - - - + + + + + + + + + @@ -7720,7 +7720,7 @@ - + @@ -8032,41 +8032,41 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + - + - - - - - - + + + + + + @@ -8081,10 +8081,10 @@ - - - - + + + + @@ -8445,6 +8445,6 @@ - + From 736c56292b29da21b78293749d4bde90ccec0b03 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:25:14 +0530 Subject: [PATCH 14/56] fix(*): Add CI files for code coverage --- .github/workflows/integration-testing.yml | 17 ++----- .github/workflows/unit-testing.yml | 62 +++++++++++++++++++++++ 2 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/unit-testing.yml diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index d5e33ada13..91aa4dc0ad 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -17,10 +17,10 @@ jobs: mysql: image: mysql:5.7 env: - MYSQL_USER: root - MYSQL_PASSWORD: root + MYSQL_USER: homestead + MYSQL_PASSWORD: secret MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: portal_test + MYSQL_DATABASE: homestead ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 @@ -28,10 +28,10 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # cypress setup - - name: Setup PHP v7.4 + - name: Setup PHP v8.2 uses: shivammathur/setup-php@v2 with: - php-version: "7.4" + php-version: "8.2" - name: Setup cypress-testing uses: actions/checkout@v2 @@ -63,13 +63,6 @@ jobs: npm install npm run dev - - name: Run Test Suit - run: | - vendor/bin/phpunit --coverage-clover coverage.xml - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - - name: Run local server run: | php artisan serve & diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml new file mode 100644 index 0000000000..43d325c241 --- /dev/null +++ b/.github/workflows/unit-testing.yml @@ -0,0 +1,62 @@ +name: Integration testing + +# Controls when the action will run. +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + portal: + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_USER: root + MYSQL_PASSWORD: root + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: portal_test + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # cypress setup + - name: Setup PHP v7.4 + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + + - name: Install Dependencies + run: composer install + + - name: Generate key + run: php artisan key:generate + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Run migrations + run: | + php artisan migrate + + - name: Run seeders + run: | + php artisan db:seed + php artisan module:seed + + - name: Run Test Suit + run: | + vendor/bin/phpunit --coverage-clover coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 From 4d676ff3def48690332fc71983fe34a7fd28811d Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:31:31 +0530 Subject: [PATCH 15/56] fix(*): Add CI files for code coverage --- .github/workflows/unit-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 43d325c241..6ed39ef267 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -1,4 +1,4 @@ -name: Integration testing +name: Unit testing # Controls when the action will run. on: From d4587a39f9bb7eb04fb00bd4b7f587d0651736fa Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:34:57 +0530 Subject: [PATCH 16/56] fix(*): Add CI files for code coverage --- .env.testing | 2 +- .github/workflows/unit-testing.yml | 2 +- config/database.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.testing b/.env.testing index bb05718ffc..3fb5010364 100644 --- a/.env.testing +++ b/.env.testing @@ -5,7 +5,7 @@ APP_TIMEZONE=UTC DB_CONNECTION=testing DB_TEST_DATABASE=portal_test -DB_TEST_USERNAME='root' +DB_TEST_USERNAME='mysql_test_user' DB_TEST_PASSWORD='root' CACHE_DRIVER=array diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 6ed39ef267..2ebef358e9 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -17,7 +17,7 @@ jobs: mysql: image: mysql:5.7 env: - MYSQL_USER: root + MYSQL_USER: mysql_test_user MYSQL_PASSWORD: root MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_DATABASE: portal_test diff --git a/config/database.php b/config/database.php index 29dfa528c0..f9bc79bdf0 100644 --- a/config/database.php +++ b/config/database.php @@ -59,7 +59,7 @@ 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_TEST_DATABASE', 'portal_test'), - 'username' => env('DB_TEST_USERNAME', 'root'), + 'username' => env('DB_TEST_USERNAME', 'mysql_test_user'), 'password' => env('DB_TEST_PASSWORD', 'root'), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', From b6a14a95647d58a80991bc63d11076f061ff01fa Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:38:14 +0530 Subject: [PATCH 17/56] fix(*): Add CI files for code coverage --- .github/workflows/unit-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 2ebef358e9..becd2841ec 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -33,6 +33,9 @@ jobs: with: php-version: "7.4" + - name: Setup unit-testing + uses: actions/checkout@v2 + - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" From 05baf9edf2009fb54df568cbc2c12363534c984d Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:44:05 +0530 Subject: [PATCH 18/56] fix(*): Add CI files for code coverage --- .github/workflows/unit-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index becd2841ec..395fa93ff4 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -50,12 +50,12 @@ jobs: - name: Run migrations run: | - php artisan migrate + php artisan migrate --env=testing - name: Run seeders run: | - php artisan db:seed - php artisan module:seed + php artisan db:seed --env=testing + php artisan module:seed --env=testing - name: Run Test Suit run: | From 092d5ae1edebacd5cd038bb8338c53e3661c476f Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:52:19 +0530 Subject: [PATCH 19/56] fix(*): Add CI files for code coverage --- Modules/HR/Database/Seeders/HRDatabaseSeeder.php | 2 +- database/Seeders/DatabaseSeeder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/HR/Database/Seeders/HRDatabaseSeeder.php b/Modules/HR/Database/Seeders/HRDatabaseSeeder.php index 7d7f0739d3..7f71cbc071 100644 --- a/Modules/HR/Database/Seeders/HRDatabaseSeeder.php +++ b/Modules/HR/Database/Seeders/HRDatabaseSeeder.php @@ -13,7 +13,7 @@ class HRDatabaseSeeder extends Seeder */ public function run() { - if (! app()->environment(['local', 'staging', 'UAT'])) { + if (! app()->environment(['local', 'staging', 'UAT', 'testing'])) { return 0; } $this->call(HRPermissionsTableSeeder::class); diff --git a/database/Seeders/DatabaseSeeder.php b/database/Seeders/DatabaseSeeder.php index 4ddb8906f7..e3b20745db 100644 --- a/database/Seeders/DatabaseSeeder.php +++ b/database/Seeders/DatabaseSeeder.php @@ -15,7 +15,7 @@ class DatabaseSeeder extends Seeder */ public function run() { - if (! app()->environment(['local', 'staging', 'UAT'])) { + if (! app()->environment(['local', 'staging', 'UAT', 'testing'])) { return 0; } From 0bb949ff4ebb98458dc277f840c3ecec1064fe8f Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 13:55:17 +0530 Subject: [PATCH 20/56] fix(*): Add CI files for code coverage --- .github/workflows/unit-testing.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 395fa93ff4..6135908043 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -57,6 +57,12 @@ jobs: php artisan db:seed --env=testing php artisan module:seed --env=testing + - name: Compile assets + run: | + export NODE_OPTIONS=--openssl-legacy-provider + npm install + npm run dev + - name: Run Test Suit run: | vendor/bin/phpunit --coverage-clover coverage.xml From a2e7240d9727579b16aa6278b7777a092a2f5491 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 14:01:30 +0530 Subject: [PATCH 21/56] fix(*): Add CI files for code coverage --- .github/workflows/integration-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index 91aa4dc0ad..ba83c446a0 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -50,12 +50,12 @@ jobs: - name: Run migrations run: | - php artisan migrate + php artisan migrate --env=local - name: Run seeders run: | - php artisan db:seed - php artisan module:seed + php artisan db:seed --env=local + php artisan module:seed --env=local - name: Compile assets run: | From bddca101168903f3401849ae904e40076e6b256d Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 14:04:38 +0530 Subject: [PATCH 22/56] fix(*): Add CI files for code coverage --- .env.example | 13 ++++-- .github/workflows/coding-standards.yml | 50 ----------------------- .github/workflows/integration-testing.yml | 6 +-- 3 files changed, 12 insertions(+), 57 deletions(-) diff --git a/.env.example b/.env.example index ca31eefc89..ef30989360 100644 --- a/.env.example +++ b/.env.example @@ -10,9 +10,9 @@ LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=portal_test -DB_USERNAME=root -DB_PASSWORD=root +DB_DATABASE=homestead +DB_USERNAME=homestead +DB_PASSWORD=secret BROADCAST_DRIVER=log CACHE_DRIVER=file @@ -110,4 +110,9 @@ HR_FOLLOWUP_EMAIL_SECONDARY="" CAMPAIGNS_TOOL_URL= CAMPAIGNS_CLIENT_SECRET= -CAMPAIGNS_CLIENT_ID= \ No newline at end of file +CAMPAIGNS_CLIENT_ID= + + +DB_TEST_DATABASE=portal_test +DB_TEST_USERNAME='root' +DB_TEST_PASSWORD='root' \ No newline at end of file diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index ccf6cc447d..96ca2ef542 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -5,56 +5,6 @@ on: branches: [master] jobs: - # phpcs: - # name: PHP CS - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Setup PHP v8.2 - # uses: shivammathur/setup-php@v2 - # with: - # php-version: "8.2" - # - name: Install composer dependencies - # run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - # - name: PHP Coding Standards - # run: PHP_CS_FIXER_IGNORE_ENV=1 php ./vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --dry-run --verbose --diff - - # eslint: - # name: ES Lint - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Setup PHP v8.2 - # uses: shivammathur/setup-php@v2 - # with: - # php-version: "8.2" - # - name: Install composer dependencies - # run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - # - name: Install NPM Dependencies - # run: npm install - # - name: ESLINT - # run: ./node_modules/.bin/eslint resources/js/ Modules/*/Resources/assets/js/ --ext .js,.vue - - # larastan: - # name: Larastan - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Setup PHP v8.2 - # uses: shivammathur/setup-php@v2 - # with: - # php-version: "8.2" - # - name: Install composer dependencies - # run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - # - name: Setup env file - # run: cp ./.env.example .env - # - name: Configure application encryption key - # run: php artisan key:generate - # - name: clear cache - # run: php artisan view:clear - # - name: Larastan - # run: ./vendor/bin/phpstan analyse - ColoredCowLaravelCI: name: ColoredCowLaravelCI runs-on: ubuntu-latest diff --git a/.github/workflows/integration-testing.yml b/.github/workflows/integration-testing.yml index ba83c446a0..91aa4dc0ad 100644 --- a/.github/workflows/integration-testing.yml +++ b/.github/workflows/integration-testing.yml @@ -50,12 +50,12 @@ jobs: - name: Run migrations run: | - php artisan migrate --env=local + php artisan migrate - name: Run seeders run: | - php artisan db:seed --env=local - php artisan module:seed --env=local + php artisan db:seed + php artisan module:seed - name: Compile assets run: | From f22841204137bac761f92624cce5531378b04259 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Mon, 11 Sep 2023 14:19:12 +0530 Subject: [PATCH 23/56] fix(*): Add CI files for code coverage --- Modules/HR/Tests/Unit/ApplicantTest.php | 4 ++++ phpstan.neon | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Modules/HR/Tests/Unit/ApplicantTest.php b/Modules/HR/Tests/Unit/ApplicantTest.php index 1ac749bf2a..375096836a 100644 --- a/Modules/HR/Tests/Unit/ApplicantTest.php +++ b/Modules/HR/Tests/Unit/ApplicantTest.php @@ -2,6 +2,10 @@ namespace Modules\HR\Tests\Unit; +/* + * @var \Illuminate\Database\Eloquent\Factory $factory + */ + use Modules\HR\Entities\Applicant; use Tests\TestCase; diff --git a/phpstan.neon b/phpstan.neon index 09e4caa7ee..49f07185fa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,6 +12,8 @@ parameters: - Modules/*/vendor/composer/ClassLoader.php - Modules/*/Database/Factories/*.php # Ignore Error occurring due to Laravel factories - Modules/*/Database/Seeders/*.php # Ignore Error occurring due to Laravel factories + - Modules/*/Database/Seeders/*.php # Ignore Error occurring due to Laravel factories + - Modules/*/Tests/*.php # Ignore Error occurring due to Laravel factories # The level 8 is the highest level level: 5 From 3ccb2e44fd50a9a0c3e0c450f0949b92f0ee5ba4 Mon Sep 17 00:00:00 2001 From: Sachinbisht27 Date: Wed, 13 Sep 2023 13:18:23 +0530 Subject: [PATCH 24/56] Added new step to add comment of code coverage details in the pr throuh github actions --- .github/workflows/unit-testing.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 6135908043..7b6f805e91 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -69,3 +69,10 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + + - name: Post Code Coverage Comment + uses: softprops/action-gh-release@v1 + with: + files: coverage.xml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 003b312a04a396b0ab643e4ca01eb6eaaad6543e Mon Sep 17 00:00:00 2001 From: Sachinbisht27 Date: Wed, 13 Sep 2023 13:24:59 +0530 Subject: [PATCH 25/56] Added new step of creating a git tag required for adding coverage comment --- .github/workflows/unit-testing.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 7b6f805e91..e8a03d6588 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -67,6 +67,11 @@ jobs: run: | vendor/bin/phpunit --coverage-clover coverage.xml + - name: Create Git Tag + run: | + git tag -a v1.0 -m "Version 1.0" + git push origin v1.0 + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 @@ -74,5 +79,4 @@ jobs: uses: softprops/action-gh-release@v1 with: files: coverage.xml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} From 8415045bf9f3cd169c5ce9f6bb4172bd479e0b9a Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 14:13:38 +0530 Subject: [PATCH 26/56] Added new step of creating a git tag required for adding coverage comment --- .github/workflows/unit-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index e8a03d6588..6d4f5ec74b 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -27,7 +27,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # cypress setup + # cypress & unit testing setup - name: Setup PHP v7.4 uses: shivammathur/setup-php@v2 with: From e1d4a2cc624b053c4e59ba777543f09435f24a14 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 17:17:53 +0530 Subject: [PATCH 27/56] Added new step of creating a git tag required for adding coverage comment --- .github/workflows/unit-testing.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 6d4f5ec74b..fa12364499 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -27,7 +27,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # cypress & unit testing setup + # cypress setup - name: Setup PHP v7.4 uses: shivammathur/setup-php@v2 with: @@ -63,15 +63,20 @@ jobs: npm install npm run dev - - name: Run Test Suit + - name: Set Git User Identity run: | - vendor/bin/phpunit --coverage-clover coverage.xml + git config user.email "sachinbisht27@gmail.com" + git config user.name "Sachin Bisht" - name: Create Git Tag run: | git tag -a v1.0 -m "Version 1.0" git push origin v1.0 + - name: Run Test Suit + run: | + vendor/bin/phpunit --coverage-clover coverage.xml + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 From ae0179849e3b9d427467e601094adba7f1dc9d8a Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 17:25:54 +0530 Subject: [PATCH 28/56] Added new step of creating a git tag required for adding coverage comment --- .github/workflows/unit-testing.yml | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index fa12364499..d83c15872d 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -63,25 +63,19 @@ jobs: npm install npm run dev - - name: Set Git User Identity - run: | - git config user.email "sachinbisht27@gmail.com" - git config user.name "Sachin Bisht" - - - name: Create Git Tag - run: | - git tag -a v1.0 -m "Version 1.0" - git push origin v1.0 - - - name: Run Test Suit + - name: Run Test Suite run: | vendor/bin/phpunit --coverage-clover coverage.xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - - - name: Post Code Coverage Comment + - name: Create GitHub Release + id: create_release uses: softprops/action-gh-release@v1 with: files: coverage.xml - token: ${{ secrets.GITHUB_TOKEN }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get Release URL + run: | + release_url="${{ steps.create_release.outputs.upload_url }}" + echo "Release URL: $release_url" From 3e3cd592d45953cbe165e18eb33151a76d3b70ec Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 19:00:48 +0530 Subject: [PATCH 29/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index d83c15872d..8f7cd24c50 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -63,19 +63,17 @@ jobs: npm install npm run dev - - name: Run Test Suite + - name: Run Test Suit run: | vendor/bin/phpunit --coverage-clover coverage.xml - - name: Create GitHub Release - id: create_release - uses: softprops/action-gh-release@v1 - with: - files: coverage.xml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 - - name: Get Release URL + - name: Code coverage comment run: | - release_url="${{ steps.create_release.outputs.upload_url }}" - echo "Release URL: $release_url" + echo "Code Coverage Report" > coverage_comment.txt + echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt + echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt + + gh pr comment "$(cat coverage_comment.txt)" From a65cd4a8d65f7f516ed85b8add05ef32d151dbd6 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 19:11:32 +0530 Subject: [PATCH 30/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 8f7cd24c50..af482ad30b 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -76,4 +76,5 @@ jobs: echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt + echo "::set-env name=GH_TOKEN::${{ secrets.GITHUB_TOKEN }}" gh pr comment "$(cat coverage_comment.txt)" From f8d00163aadc5c67e41e0bebd2b9df8fcab8752c Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 22:57:04 +0530 Subject: [PATCH 31/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index af482ad30b..0aa5b22d02 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -70,11 +70,18 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - - name: Code coverage comment + - name: Post Code Coverage Comment run: | echo "Code Coverage Report" > coverage_comment.txt echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt - echo "::set-env name=GH_TOKEN::${{ secrets.GITHUB_TOKEN }}" - gh pr comment "$(cat coverage_comment.txt)" + # Set up the comment payload in a JSON file + echo '{"body": "'$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')'"}' > comment_payload.json + + # Post the comment using the GitHub API + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d @comment_payload.json \ + "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" From d58398134d7a8f9c20c386b2bccc5d6e75db74f8 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 23:08:25 +0530 Subject: [PATCH 32/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 0aa5b22d02..3e26076990 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -76,12 +76,9 @@ jobs: echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt - # Set up the comment payload in a JSON file - echo '{"body": "'$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')'"}' > comment_payload.json - - # Post the comment using the GitHub API + # Post the comment using the GitHub API with PR number directly curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d @comment_payload.json \ - "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" + -d "{\"body\": \"$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ + "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From b28bdc313c21b2fce049a68caef5c64eb4c550bc Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 23:41:57 +0530 Subject: [PATCH 33/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 3e26076990..20e1959989 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -65,16 +65,20 @@ jobs: - name: Run Test Suit run: | - vendor/bin/phpunit --coverage-clover coverage.xml + vendor/bin/phpunit --coverage-clover coverage.xml --cov > coverage.txt + + - name: Convert Coverage to HTML + run: | + php-coveralls/php-coveralls coverage:clover --output coverage-html - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - name: Post Code Coverage Comment run: | - echo "Code Coverage Report" > coverage_comment.txt + echo "Code Coverage Report" echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt + echo "Coverage details are available [here](./coverage.txt)." >> coverage_comment.txt # Post the comment using the GitHub API with PR number directly curl -X POST \ From 8e432065cdda57d652f28213ee03836281e6d79f Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Wed, 13 Sep 2023 23:56:28 +0530 Subject: [PATCH 34/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 20e1959989..b20d4bf4a6 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -65,20 +65,21 @@ jobs: - name: Run Test Suit run: | - vendor/bin/phpunit --coverage-clover coverage.xml --cov > coverage.txt + vendor/bin/phpunit --coverage-clover coverage.xml - - name: Convert Coverage to HTML + - name: Print Coverage report run: | - php-coveralls/php-coveralls coverage:clover --output coverage-html + coverage.xml --cov > coverage.txt + cat coverage.txt - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - name: Post Code Coverage Comment run: | - echo "Code Coverage Report" + echo "Code Coverage Report" > coverage_comment.txt echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available [here](./coverage.txt)." >> coverage_comment.txt + echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt # Post the comment using the GitHub API with PR number directly curl -X POST \ From dd6ba43c33f895319ed7cc244b21b101753685a1 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 00:01:35 +0530 Subject: [PATCH 35/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index b20d4bf4a6..b7d786828b 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -68,9 +68,7 @@ jobs: vendor/bin/phpunit --coverage-clover coverage.xml - name: Print Coverage report - run: | - coverage.xml --cov > coverage.txt - cat coverage.txt + run: cat coverage.xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 From 392882fddcd75f5533496ccd1118b86210b41b2f Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 00:20:16 +0530 Subject: [PATCH 36/56] Adding code coverage comment in the PR --- .github/workflows/unit-testing.yml | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index b7d786828b..fb9a11c09f 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -63,25 +63,6 @@ jobs: npm install npm run dev - - name: Run Test Suit + - name: Run Test Suit and Generate Coverage Text Report run: | - vendor/bin/phpunit --coverage-clover coverage.xml - - - name: Print Coverage report - run: cat coverage.xml - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - - - name: Post Code Coverage Comment - run: | - echo "Code Coverage Report" > coverage_comment.txt - echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt - - # Post the comment using the GitHub API with PR number directly - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "{\"body\": \"$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ - "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" + vendor/bin/phpunit --coverage-text > coverage_report.txt From 9bee75ed1756f8bf4ee013d540ba4f860168495d Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 00:28:35 +0530 Subject: [PATCH 37/56] print the coverage.txt --- .github/workflows/unit-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index fb9a11c09f..b8166b5228 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -66,3 +66,6 @@ jobs: - name: Run Test Suit and Generate Coverage Text Report run: | vendor/bin/phpunit --coverage-text > coverage_report.txt + + - name: Display Coverage Report + run: cat coverage_report.txt From 487feb97690d7b620f724c98430a542bd3c6de98 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 00:43:44 +0530 Subject: [PATCH 38/56] Added the coverage.xml in gitignore as not needed --- .github/workflows/unit-testing.yml | 16 ++++++++++++++++ .gitignore | 2 ++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index b8166b5228..352f638c9b 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -69,3 +69,19 @@ jobs: - name: Display Coverage Report run: cat coverage_report.txt + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + + - name: Post Code Coverage Comment + run: | + echo "Code Coverage Report" > coverage_comment.txt + echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt + echo "Coverage details are available [here](./coverage.xml)." >> coverage_report.txt + + # Post the comment using the GitHub API with PR number directly + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{\"body\": \"$(cat coverage_report.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ + "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" diff --git a/.gitignore b/.gitignore index d7375a1213..620faab2fd 100644 --- a/.gitignore +++ b/.gitignore @@ -51,5 +51,7 @@ google_service_credentials.json .phpunit.result.cache .phpunit.result.cache/ +# Unit test / coverage reports +coverage.xml codecov codecov/ From 97ee34b1d309313fc59d4a15dcdbacabf4b0fe18 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 00:55:38 +0530 Subject: [PATCH 39/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 352f638c9b..1d5dab73f2 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -77,11 +77,13 @@ jobs: run: | echo "Code Coverage Report" > coverage_comment.txt echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available [here](./coverage.xml)." >> coverage_report.txt + echo "Coverage details are available below:" >> coverage_comment.txt + + cat coverage_report.txt >> coverage_comment.txt # Post the comment using the GitHub API with PR number directly curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"$(cat coverage_report.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ + -d "{\"body\": \"$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 8af0a79e3ac5a2829bdc6a8fcb6c55bb02f7fe9a Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:02:27 +0530 Subject: [PATCH 40/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 1d5dab73f2..36bdf56c9f 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -85,5 +85,5 @@ jobs: curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"$(cat coverage_comment.txt | sed ':a;N;$!ba;s/\n/\\n/g')\"}" \ + -d "{\"body\": \"$(cat coverage_comment.txt)\"}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From c6dc1b3509ce5a6994159e4526b77fafad813392 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:10:00 +0530 Subject: [PATCH 41/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 36bdf56c9f..3c773581b3 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -73,6 +73,11 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + - name: Install jq + run: | + sudo apt-get update + sudo apt-get install jq -y + - name: Post Code Coverage Comment run: | echo "Code Coverage Report" > coverage_comment.txt @@ -81,9 +86,10 @@ jobs: cat coverage_report.txt >> coverage_comment.txt + formatted_comment=$(cat coverage_comment.txt | jq -Rs '.') # Post the comment using the GitHub API with PR number directly curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"$(cat coverage_comment.txt)\"}" \ + -d "{\"body\": $formatted_comment}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 17dfef4f1115d259fc0f003b71a2ba77d32b08b2 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:17:29 +0530 Subject: [PATCH 42/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 3c773581b3..fe278ecb02 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -73,11 +73,6 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - - name: Install jq - run: | - sudo apt-get update - sudo apt-get install jq -y - - name: Post Code Coverage Comment run: | echo "Code Coverage Report" > coverage_comment.txt @@ -86,8 +81,8 @@ jobs: cat coverage_report.txt >> coverage_comment.txt - formatted_comment=$(cat coverage_comment.txt | jq -Rs '.') - # Post the comment using the GitHub API with PR number directly + formatted_comment=$(cat coverage_comment.txt) + curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ From 9d43f92073d8a2ae10e2cd5263073191c279fb9c Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:32:54 +0530 Subject: [PATCH 43/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index fe278ecb02..6bd9b5f634 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -73,16 +73,21 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + - name: Install jq + run: | + sudo apt-get update + sudo apt-get install jq -y + - name: Post Code Coverage Comment run: | echo "Code Coverage Report" > coverage_comment.txt echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available below:" >> coverage_comment.txt cat coverage_report.txt >> coverage_comment.txt - formatted_comment=$(cat coverage_comment.txt) + formatted_comment=$(cat coverage_comment.txt | jq -Rs '.') + echo "Coverage details are available below:" >> $formatted_comment curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ From 9d20d5a0e91619974a8454555b760d17a2bce845 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:40:56 +0530 Subject: [PATCH 44/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 6bd9b5f634..f589f3a0f1 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -87,9 +87,13 @@ jobs: formatted_comment=$(cat coverage_comment.txt | jq -Rs '.') - echo "Coverage details are available below:" >> $formatted_comment + formatted_comment=$(echo "$formatted_comment" | sed 's/\x1B\[[0-9;]*[JKmsu]//g') + + echo "Coverage details are available below:" >> coverage_comment.txt + echo "$formatted_comment" >> coverage_comment.txt + curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": $formatted_comment}" \ + -d "{\"body\": \"$formatted_comment\"}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 12c13bee05a0e67d27fb08d82cc16511f63468a0 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 01:48:07 +0530 Subject: [PATCH 45/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index f589f3a0f1..df659a631e 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -95,5 +95,5 @@ jobs: curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"$formatted_comment\"}" \ + -d "{\"body\": $formatted_comment}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 80157975d2d9a232baa60c5a36e8cbcb72afbba2 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 02:30:34 +0530 Subject: [PATCH 46/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index df659a631e..8efb6fc3f9 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -82,16 +82,13 @@ jobs: run: | echo "Code Coverage Report" > coverage_comment.txt echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt + echo "Coverage details are available below:" >> coverage_comment.txt cat coverage_report.txt >> coverage_comment.txt formatted_comment=$(cat coverage_comment.txt | jq -Rs '.') - formatted_comment=$(echo "$formatted_comment" | sed 's/\x1B\[[0-9;]*[JKmsu]//g') - echo "Coverage details are available below:" >> coverage_comment.txt - echo "$formatted_comment" >> coverage_comment.txt - curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ From 2f735b2214afbebf1a61d839baa58d4e69491e9f Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 02:39:49 +0530 Subject: [PATCH 47/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 8efb6fc3f9..c85689bc2f 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -86,8 +86,7 @@ jobs: cat coverage_report.txt >> coverage_comment.txt - formatted_comment=$(cat coverage_comment.txt | jq -Rs '.') - formatted_comment=$(echo "$formatted_comment" | sed 's/\x1B\[[0-9;]*[JKmsu]//g') + formatted_comment=$(cat coverage_comment.txt | jq -Rs '.' | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g') curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ From a5b39aabccd2035e614d963f692948771993a61c Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 02:47:23 +0530 Subject: [PATCH 48/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index c85689bc2f..f7c201ae15 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -80,16 +80,14 @@ jobs: - name: Post Code Coverage Comment run: | - echo "Code Coverage Report" > coverage_comment.txt - echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available below:" >> coverage_comment.txt + echo "### Code Coverage Report" > coverage_comment.md + echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered=\"(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.md + echo "Coverage details are available below:" >> coverage_comment.md - cat coverage_report.txt >> coverage_comment.txt - - formatted_comment=$(cat coverage_comment.txt | jq -Rs '.' | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g') + cat coverage_report.txt >> coverage_comment.md curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": $formatted_comment}" \ + -d "{\"body\": \"$(cat coverage_comment.md)\"}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 4d5034e7fa1d1a8bfd8218bcd535903b9d819aaa Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 02:54:50 +0530 Subject: [PATCH 49/56] Trying to add the redable coverage report in the comment --- .github/workflows/unit-testing.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index f7c201ae15..c85689bc2f 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -80,14 +80,16 @@ jobs: - name: Post Code Coverage Comment run: | - echo "### Code Coverage Report" > coverage_comment.md - echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered=\"(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.md - echo "Coverage details are available below:" >> coverage_comment.md + echo "Code Coverage Report" > coverage_comment.txt + echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt + echo "Coverage details are available below:" >> coverage_comment.txt - cat coverage_report.txt >> coverage_comment.md + cat coverage_report.txt >> coverage_comment.txt + + formatted_comment=$(cat coverage_comment.txt | jq -Rs '.' | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g') curl -X POST \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ - -d "{\"body\": \"$(cat coverage_comment.md)\"}" \ + -d "{\"body\": $formatted_comment}" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 99508252305651ae66bdf0edcdbcec291ce09dad Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 11:54:47 +0530 Subject: [PATCH 50/56] Generate Coverage Text Report & Display Coverage Report while running unit-testing workflow --- .github/workflows/unit-testing.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index c85689bc2f..ef4a64903e 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -72,24 +72,3 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - - - name: Install jq - run: | - sudo apt-get update - sudo apt-get install jq -y - - - name: Post Code Coverage Comment - run: | - echo "Code Coverage Report" > coverage_comment.txt - echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt - echo "Coverage details are available below:" >> coverage_comment.txt - - cat coverage_report.txt >> coverage_comment.txt - - formatted_comment=$(cat coverage_comment.txt | jq -Rs '.' | sed -r 's/\x1B\[[0-9;]*[JKmsu]//g') - - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "{\"body\": $formatted_comment}" \ - "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" From 27c981d33216bf5204e4631a3b8b9c62efccc18d Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 12:30:13 +0530 Subject: [PATCH 51/56] added code coverage badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dce436a878..94c4b49172 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## ColoredCow Portal ![GitHub issues](https://img.shields.io/github/issues/coloredcow/portal) +[![codecov](https://codecov.io/gh/ColoredCow/portal/graph/badge.svg?token=LO38hOYgBT)](https://codecov.io/gh/ColoredCow/portal) [![Coding Standards](https://github.com/coloredcow/portal/actions/workflows/coding-standards.yml/badge.svg?branch=master)](https://github.com/coloredcow/portal/actions/workflows/coding-standards.yml) [![Staging Deployment](https://github.com/ColoredCow/portal/actions/workflows/staging-deployment.yml/badge.svg)](https://github.com/ColoredCow/portal/actions/workflows/staging-deployment.yml) From 3b0edcd85d1d5cbd490909fee0631bd8e5fcf9fc Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 19:11:51 +0530 Subject: [PATCH 52/56] Addded Coverage Report as Comment (Clover) --- .github/workflows/unit-testing.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index ef4a64903e..9cff4a4d0b 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -65,10 +65,15 @@ jobs: - name: Run Test Suit and Generate Coverage Text Report run: | - vendor/bin/phpunit --coverage-text > coverage_report.txt + phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml - name: Display Coverage Report run: cat coverage_report.txt - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 + + - name: Coverage Report as Comment (Clover) + uses: lucassabreu/comment-coverage-clover@main + with: + file: coverage.xml From 5dbc54efa5c0b27f484f5dbf3aef4bff6cbe9719 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 19:22:27 +0530 Subject: [PATCH 53/56] Addded Coverage Report as Comment (Clover) --- .github/workflows/unit-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 9cff4a4d0b..094449b60f 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -63,9 +63,9 @@ jobs: npm install npm run dev - - name: Run Test Suit and Generate Coverage Text Report + - name: Run Test Suit run: | - phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml + vendor/bin/phpunit --coverage-clover coverage.xml - name: Display Coverage Report run: cat coverage_report.txt From 5b2aa9ddda1a6c27b635c96bc82d6965b1042a1c Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Thu, 14 Sep 2023 19:26:30 +0530 Subject: [PATCH 54/56] Addded Coverage Report as Comment (Clover) --- .github/workflows/unit-testing.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 094449b60f..6723799ea7 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -67,9 +67,6 @@ jobs: run: | vendor/bin/phpunit --coverage-clover coverage.xml - - name: Display Coverage Report - run: cat coverage_report.txt - - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 From 1e36b65a8d10dc84603bb24b478057c758fbadd1 Mon Sep 17 00:00:00 2001 From: Sachin Bisht Date: Fri, 15 Sep 2023 11:51:03 +0530 Subject: [PATCH 55/56] Addded Coverage Report as Comment (Clover) --- .github/workflows/unit-testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 6723799ea7..f85a8c68fb 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -71,6 +71,7 @@ jobs: uses: codecov/codecov-action@v3 - name: Coverage Report as Comment (Clover) - uses: lucassabreu/comment-coverage-clover@main + uses: danhunsaker/clover-reporter-action@v0.2.17-clover with: - file: coverage.xml + github-token: ${{ secrets.GITHUB_TOKEN }} + clover-file: coverage.xml From d970b7e43601372a1ca867e3c672891dbbfa2310 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Fri, 15 Sep 2023 12:14:05 +0530 Subject: [PATCH 56/56] fix(*): pubmed imports --- .github/workflows/unit-testing.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index f85a8c68fb..6135908043 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -69,9 +69,3 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 - - - name: Coverage Report as Comment (Clover) - uses: danhunsaker/clover-reporter-action@v0.2.17-clover - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - clover-file: coverage.xml