diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..f9ecf876 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,34 @@ +name: Test +permissions: + contents: write +on: + pull_request: + push: + branches: + - master + +jobs: + phpstan: + name: Static Analysis with PHPStan and php-cs-fixer + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + coverage: pcov + ini-values: zend.assertions=1, assert.exception=1 + php-version: 8.1 + extensions: memcached + tools: cs2pr + + - name: Install dependencies with Composer + uses: ramsey/composer-install@v2 + + - name: PHPStan Analysis + run: vendor/bin/phpstan analyze diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 00000000..93ad45dc --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,34 @@ +name: Test +permissions: + contents: write +on: + pull_request: + push: + branches: + - master + +jobs: + phpstan: + name: Linting with php-cs-fixer + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + coverage: pcov + ini-values: zend.assertions=1, assert.exception=1 + php-version: 8.1 + extensions: memcached + tools: cs2pr + + - name: Install dependencies with Composer + uses: ramsey/composer-install@v2 + + - name: Run PHP-CS-Fixer + run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --format checkstyle | cs2pr diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 52d8efa2..30ff068e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,7 +50,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -64,9 +64,6 @@ jobs: - name: Install dependencies with Composer uses: ramsey/composer-install@v2 - - name: Run PHP-CS-Fixer - run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --format checkstyle | cs2pr - - name: Create and set permissions on SQLite Database run: | touch test.db @@ -92,10 +89,7 @@ jobs: - name: Run PHPUnit run: | - vendor/bin/phpunit -c phpunit.xml.dist - - - name: PHPStan Analysis - run: vendor/bin/phpstan analyze + vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 diff --git a/README.md b/README.md index 3681074b..1e53cb0c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PHP ActiveRecord [![Test](https://github.com/php-activerecord/activerecord/actions/workflows/test.yml/badge.svg)](https://github.com/php-activerecord/activerecord/actions/workflows/test.yml) -[![Coverage Status](https://codecov.io/gh/shmax/graphql-php-validation-toolkit/branch/master/graph/badge.svg)](https://codecov.io/gh/shmax/graphql-php-validation-toolkit/branch/master) +[![codecov](https://codecov.io/github/php-activerecord/activerecord/graph/badge.svg?token=IJBKNRHVOC)](https://codecov.io/github/php-activerecord/activerecord) **We encourage pull requests, and issues will be dealt with thoroughly and in a timely manner.**