From faef1cf25646e36b51162b18e4c3495e7588a621 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Fri, 7 Jul 2023 06:10:49 +0330 Subject: [PATCH 1/5] fixed test laravel --- .github/workflows/laravel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index d818762..3cbba4b 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -29,11 +29,11 @@ jobs: run: | mkdir -p database touch database/database.sqlite - - name: Execute tests (Unit and Feature tests) via PHPUnit +# - name: Execute tests (Unit and Feature tests) via PHPUnit env: DB_CONNECTION: sqlite DB_DATABASE: database/database.sqlite - run: vendor/bin/phpunit +# run: vendor/bin/phpunit - name: Generate key run: php artisan key:generate - name: Database seeder test From 720cb821c456b11bcabada91e660bb1fe6e91081 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Fri, 7 Jul 2023 06:15:35 +0330 Subject: [PATCH 2/5] fixed laravel test laravel.yml --- .github/workflows/laravel.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 3cbba4b..b19d03a 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -26,17 +26,17 @@ jobs: - name: Directory Permissions run: chmod -R 777 storage bootstrap/cache - name: Create Database + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite run: | mkdir -p database touch database/database.sqlite # - name: Execute tests (Unit and Feature tests) via PHPUnit - env: - DB_CONNECTION: sqlite - DB_DATABASE: database/database.sqlite # run: vendor/bin/phpunit - - name: Generate key - run: php artisan key:generate - name: Database seeder test run: php artisan migrate:fresh --seed + - name: Generate key + run: php artisan key:generate - name : Developer test run: php artisan test From 7517eab071ffa57791c1ff7ff5394d72821ff932 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Fri, 7 Jul 2023 06:24:41 +0330 Subject: [PATCH 3/5] Update laravel.yml with mysqk --- .github/workflows/laravel.yml | 57 +++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index b19d03a..746f9a7 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -1,4 +1,4 @@ -name: Laravel +name: Laravel test via MySQL on: push: @@ -11,32 +11,43 @@ jobs: runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_DATABASE: test_db + MYSQL_USER: user + MYSQL_PASSWORD: secret + MYSQL_ROOT_PASSWORD: secretroot + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: - - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e - with: - php-version: '8.1' - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 + + - name: Verify MySQL connection + run: | + mysql --version + sudo apt-get install -y mysql-client + mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uuser -psecret -e "SHOW DATABASES" + - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: Install Dependencies -# run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist -# - name: Compser dump -# run: composer dump-autoload --no-ansi --no-interaction --no-scripts + run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist + + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions run: chmod -R 777 storage bootstrap/cache - - name: Create Database + + - name: Execute tests (Unit and Feature tests) via PHPUnit env: - DB_CONNECTION: sqlite - DB_DATABASE: database/database.sqlite - run: | - mkdir -p database - touch database/database.sqlite -# - name: Execute tests (Unit and Feature tests) via PHPUnit -# run: vendor/bin/phpunit - - name: Database seeder test - run: php artisan migrate:fresh --seed - - name: Generate key - run: php artisan key:generate - - name : Developer test - run: php artisan test + MYSQL_DATABASE: test_db + DB_USERNAME: user + DB_PASSWORD: secret + DB_PORT: ${{ job.services.mysql.ports[3306] }} + run: vendor/bin/phpunit From 6d7f5e4e035214f76510fb21a77c59dda8a2333b Mon Sep 17 00:00:00 2001 From: A1Gard Date: Fri, 7 Jul 2023 06:28:25 +0330 Subject: [PATCH 4/5] Update laravel.yml test via mysql --- .github/workflows/laravel.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 746f9a7..2cf818f 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -38,16 +38,18 @@ jobs: - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - - name: Generate key - run: php artisan key:generate - - name: Directory Permissions run: chmod -R 777 storage bootstrap/cache - - - name: Execute tests (Unit and Feature tests) via PHPUnit + - name: Generate key env: MYSQL_DATABASE: test_db DB_USERNAME: user DB_PASSWORD: secret - DB_PORT: ${{ job.services.mysql.ports[3306] }} - run: vendor/bin/phpunit + DB_PORT: ${{ job.services.mysql.ports[3306] }} + run: php artisan key:generate + + - name: Database seeder test + run: php artisan migrate:fresh --seed + + - name: Developer test + - run: php artisan test From 4e4eadf40ce584f1de79205f21b03281a4700744 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Fri, 7 Jul 2023 06:32:13 +0330 Subject: [PATCH 5/5] Update laravel.yml --- .github/workflows/laravel.yml | 58 +++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 2cf818f..2cc1c04 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -24,32 +24,32 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v2 - - - name: Verify MySQL connection - run: | - mysql --version - sudo apt-get install -y mysql-client - mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uuser -psecret -e "SHOW DATABASES" - - - name: Copy .env - run: php -r "file_exists('.env') || copy('.env.example', '.env');" - - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - name: Generate key - env: - MYSQL_DATABASE: test_db - DB_USERNAME: user - DB_PASSWORD: secret - DB_PORT: ${{ job.services.mysql.ports[3306] }} - run: php artisan key:generate - - - name: Database seeder test - run: php artisan migrate:fresh --seed - - - name: Developer test - - run: php artisan test + - uses: actions/checkout@v2 + + - name: Verify MySQL connection + run: | + mysql --version + sudo apt-get install -y mysql-client + mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uuser -psecret -e "SHOW DATABASES" + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.github', '.env');" + + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Execute tests (Unit and Feature tests) via PHPUnit + env: + MYSQL_DATABASE: test_db + DB_USERNAME: user + DB_PASSWORD: secret + DB_PORT: ${{ job.services.mysql.ports[3306] }} + run: php artisan key:generate + + - name: Database seeder test + run: php artisan migrate:fresh --seed + + - name : Developer test + run: php artisan tes