From 6a4d725e3c9a9d63d79e56ed2167963dede200b3 Mon Sep 17 00:00:00 2001 From: Iman Ghafoori Date: Mon, 11 Dec 2023 21:20:36 +0330 Subject: [PATCH] add github actions --- .gitattributes | 1 + .github/workflows/php.yml | 41 +++++++++++++++++++++++++++++++++++++++ composer.json | 3 ++- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/php.yml diff --git a/.gitattributes b/.gitattributes index 7b69013..92d82bb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,3 +12,4 @@ /.scrutinizer.yml export-ignore /tests export-ignore /.editorconfig export-ignore +/.github export-ignore diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..2539af3 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,41 @@ +name: PHP Composer + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" + # Docs: https://getcomposer.org/doc/articles/scripts.md + + - name: Run test suite + run: composer run-script test + - name: Check Imports + run: composer run-script imports diff --git a/composer.json b/composer.json index 5098d97..b11a175 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,8 @@ "imanghafoori/laravel-terminator": "Gives you opportunity to refactor your controllers." }, "scripts": { - "test": "./vendor/bin/phpunit" + "test": "./vendor/bin/phpunit", + "imports": "./vendor/bin/check_imports" }, "extra": { "laravel": {