From e0ba2e153879513dd338a7ccbe5f58ac3c2d662e Mon Sep 17 00:00:00 2001 From: Mohamed Abdessamed <75367288+Brivan-26@users.noreply.github.com> Date: Wed, 11 Oct 2023 11:50:48 +0100 Subject: [PATCH 1/3] Create api-test.yml --- .github/workflows/api-test.yml | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/api-test.yml diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml new file mode 100644 index 0000000..9c4f9ea --- /dev/null +++ b/.github/workflows/api-test.yml @@ -0,0 +1,35 @@ +name: Api test + +on: + push: + branches: [ "master", "dev"] + pull_request: + branches: [ "master", "dev" ] + +jobs: + laravel-tests: + + runs-on: ubuntu-latest + + steps: + - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e + with: + php-version: '8.0' + - uses: actions/checkout@v3 + - 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 + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + - name: Create Database + 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: php artisan test From 8c1924c9df2817721e1e7c6034fad2285940e114 Mon Sep 17 00:00:00 2001 From: Brivan-26 Date: Wed, 11 Oct 2023 14:22:30 +0100 Subject: [PATCH 2/3] Added composer update to workflow file --- .github/workflows/api-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml index 9c4f9ea..0a5b5e5 100644 --- a/.github/workflows/api-test.yml +++ b/.github/workflows/api-test.yml @@ -18,6 +18,8 @@ jobs: - uses: actions/checkout@v3 - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: Update Dependencies + run: composer update - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Generate key From 1ab86a841d2f90e46682e307ddde9ff8410d0f3c Mon Sep 17 00:00:00 2001 From: Brivan-26 Date: Wed, 11 Oct 2023 14:23:50 +0100 Subject: [PATCH 3/3] Updated php version in api-test workflow file --- .github/workflows/api-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml index 0a5b5e5..7f0c397 100644 --- a/.github/workflows/api-test.yml +++ b/.github/workflows/api-test.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e with: - php-version: '8.0' + php-version: '8.1' - uses: actions/checkout@v3 - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');"