Skip to content

Commit

Permalink
refactor github workflow config
Browse files Browse the repository at this point in the history
  • Loading branch information
gregor-j committed Jul 23, 2024
1 parent 48dfc96 commit 53c0557
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 70 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: "CI"
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: "read"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# composer validation
composer:
name: "composer config validation"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Validate composer.json"
run: "composer validate --strict"
# PHP lint and PHPStan for different PHP versions
php:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
name: "PHP ${{ matrix.php-version }}"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "xdebug"
- name: "check PHP version"
run: "php -v"
- name: "lint PHP files"
run: "php -l src/ tests/"
- name: "install composer dependencies"
run: "composer install --prefer-dist --no-progress"
# PHPStan
- name: "PHPStan static analysis"
uses: "php-actions/phpstan@v3"
with:
php_version: "${{ matrix.php-version }}"
configuration: "phpstan.neon"
path: "src/ tests/"
# run unit tests
phpunit:
runs-on: "ubuntu-latest"
env:
CC_TEST_REPORTER_ID: "a8cbf54ef2884175dc3bb747b33c826351d3a2d758f9145a5eeac97e48b36a34"
name: "PHPUnit"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
coverage: "xdebug"
- name: "check PHP version"
run: "php -v"
- name: "install composer dependencies"
run: "composer install --prefer-dist --no-progress"
- name: "CodeClimate reporter setup"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: "run PHPUnit"
run: |
php vendor/bin/phpunit --coverage-clover clover.xml --coverage-text
./cc-test-reporter after-build -t clover --exit-code $?
70 changes: 0 additions & 70 deletions .github/workflows/php.yml

This file was deleted.

0 comments on commit 53c0557

Please sign in to comment.