diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..5a6985d --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,45 @@ +name: Run Tests + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [7.4, 8.0, 8.1, 8.2, 8.3] + + name: PHP ${{ matrix.php }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: xdebug + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run tests + run: ./vendor/bin/pest --ci \ No newline at end of file diff --git a/.gitignore b/.gitignore index e4252e7..006e148 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ composer.phar composer.lock .DS_Store .idea -tests/_output/* +.phpunit.cache +.phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index 81ae4dc..e3f15c4 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": ">=5.4.0" }, "require-dev": { - "pestphp/pest": "^3.8", + "pestphp/pest": "^1.0", "rector/rector": "^2.0" }, "autoload": { diff --git a/phpunit.xml b/phpunit.xml index e13c8d6..d70d85f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,12 +6,12 @@ > - ./tests/Unit + tests/Unit - ./src + src