From 9a83119fbf692f358ee9c414351f90a90c7abfd3 Mon Sep 17 00:00:00 2001 From: Horat1us Date: Wed, 29 Nov 2023 13:27:28 +0100 Subject: [PATCH] Add Github Actions configuration --- .github/workflows/php.yml | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100755 index 0000000..5a822fb --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,56 @@ +name: Test & Lint + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ ubuntu-latest ] + php-versions: [ '7.4', '8.1' ] + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + steps: + - uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + ini-values: "post_max_size=128M" + + - name: Check PHP Version + run: | + php -v + composer --version + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run PHPCS linter + run: composer run-script lint + + - name: Run PHPUnit tests + run: XDEBUG_MODE=coverage composer run-script cover + + - name: Upload coverage to CodeCov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + files: ./coverage.xml