From ba1a43eea401bfe910cedec4f602774b8df0c388 Mon Sep 17 00:00:00 2001 From: Aryan Ahmed Anik Date: Sun, 29 May 2022 02:01:01 +0600 Subject: [PATCH 1/4] Added github workflow to run tests --- .github/workflows/run-tests.yml | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..877b9d3 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,38 @@ +name: "Run Tests" + +on: [push, pull_request] + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [8.1, 8.0] + laravel: [9.*] + dependency-version: [prefer-lowest, prefer-stable] + include: + - laravel: 9.* + testbench: 7.* + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv + coverage: none + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" --no-interaction --no-update + composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + + - name: Execute tests + run: vendor/bin/phpunit From 6452cc7b52b6728de65437b369cc59e43910ff64 Mon Sep 17 00:00:00 2001 From: Aryan Ahmed Anik Date: Sun, 29 May 2022 02:07:03 +0600 Subject: [PATCH 2/4] Updated workflow to use sqlite as db --- .github/workflows/run-tests.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 877b9d3..b9c4785 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -34,5 +34,17 @@ jobs: composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" --no-interaction --no-update composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + - name: Create Environment file and generate app key + run: | + cp .env.example .env + + php artisan key:generate + + - name: Create database and run migration + run: | + touch database/hydra.sqlite + php artisan migrate + php artisan db:seed + - name: Execute tests run: vendor/bin/phpunit From 6bd5097c68e14fcd7282ddd3e05fc6c3a87ecb19 Mon Sep 17 00:00:00 2001 From: Aryan Ahmed Anik Date: Sun, 29 May 2022 02:07:34 +0600 Subject: [PATCH 3/4] Fixed yml formatting --- .github/workflows/run-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b9c4785..b99b366 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -42,9 +42,9 @@ jobs: - name: Create database and run migration run: | - touch database/hydra.sqlite - php artisan migrate - php artisan db:seed + touch database/hydra.sqlite + php artisan migrate + php artisan db:seed - name: Execute tests run: vendor/bin/phpunit From 0b0b51517c65e49ed75cd7b3fdf54f5cbe8ab83b Mon Sep 17 00:00:00 2001 From: Aryan Ahmed Anik Date: Sun, 29 May 2022 02:09:33 +0600 Subject: [PATCH 4/4] Updated workflow to install dependencies from composer.json --- .github/workflows/run-tests.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b99b366..377ab42 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,13 +10,8 @@ jobs: fail-fast: false matrix: php: [8.1, 8.0] - laravel: [9.*] - dependency-version: [prefer-lowest, prefer-stable] - include: - - laravel: 9.* - testbench: 7.* - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} + name: PHP${{ matrix.php }} steps: - name: Checkout code @@ -30,9 +25,7 @@ jobs: coverage: none - name: Install dependencies - run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" --no-interaction --no-update - composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction + run: composer install - name: Create Environment file and generate app key run: |