From 24396d4c82a68042130efd822a6b7ee27ff47715 Mon Sep 17 00:00:00 2001 From: Darlan Rodrigues Schmeller Date: Fri, 23 Jan 2026 17:02:44 -0300 Subject: [PATCH 1/2] ci: Add PHPUnit test step to GitHub Actions workflow --- .github/workflows/php.yml | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..5193ec7 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,40 @@ +name: PHP Composer + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - 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 PHPUnit tests + run: vendor/bin/phpunit --colors=always + # run: composer run-script test From 139f340355b87ca37db62925c179c731bb0500ca Mon Sep 17 00:00:00 2001 From: Darlan Rodrigues Schmeller Date: Fri, 23 Jan 2026 17:09:13 -0300 Subject: [PATCH 2/2] refactor: Modify PHPUnit command to run tests from 'tests' directory Update PHPUnit test command to specify test directory. --- .github/workflows/php.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 5193ec7..34eaeee 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -32,9 +32,5 @@ jobs: - 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 PHPUnit tests - run: vendor/bin/phpunit --colors=always - # run: composer run-script test + run: vendor/bin/phpunit tests --colors=always