Skip to content

Commit

Permalink
Api 734 setup a GitHub actions (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Dec 25, 2023
1 parent aa33d38 commit f30fd10
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 69 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/codecov.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/php-cs-fixer.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Check & fix styling

on: [push, pull_request]
on:
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/phpmd.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: PHPMD

on: [push, pull_request]
on:
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
phpmd:
name: PHPMD
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP environment
uses: shivammathur/setup-php@v2
with:
coverage: none
tools: phpmd
- name: Run PHPMD
run: phpmd . github ruleset.xml --exclude 'Tests/*,vendor/*'
phpmd:
name: PHPMD
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP environment
uses: shivammathur/setup-php@v2
with:
coverage: none
tools: phpmd
- name: Run PHPMD
run: phpmd . github ruleset.xml --exclude 'Tests/*,vendor/*'
52 changes: 28 additions & 24 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,33 @@ jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2 ]
fail-fast: true
matrix:
php: [ 8.1, 8.2 ]
name: PHP ${{ matrix.php }}

timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: xdebug
tools: phpunit:10.*

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Execute tests
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
29 changes: 16 additions & 13 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Unit">
<directory>./Tests</directory>
<directory>./Tests</directory>
</testsuite>
</testsuites>
<coverage ignoreDeprecatedCodeUnits="true" pathCoverage="true">
<!-- <report>-->
<!-- <html outputDirectory="html_coverage"/>-->
<!-- </report>-->
</coverage>
<php>
</testsuites>
<coverage ignoreDeprecatedCodeUnits="true" pathCoverage="true"/>
<php>
<env name="DB_CONNECTION" value="testing"/>
</php>
</php>
<source>
<include>
<directory suffix=".php">./</directory>
</include>
<exclude>
<directory suffix=".php">./Tests</directory>
<directory suffix=".php">./vendor</directory>
</exclude>
</source>
</phpunit>

0 comments on commit f30fd10

Please sign in to comment.