Skip to content

Commit

Permalink
ci: update CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhelias committed Apr 3, 2024
1 parent 42e3184 commit 3c5b307
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 59 deletions.
23 changes: 23 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7

# Issues with these labels will never be considered stale
exemptLabels:
- bug
- enhancement
- RFC

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
134 changes: 95 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,99 @@
name: ci
name: PHPUnit

on:
pull_request:
branches: [ master ]
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php-version: [ '7.4', '8.0', '8.1', '8.2' ]

steps:
- name: checkout
uses: actions/checkout@v3

- name: php-setup
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: composer-validate
run: composer validate

- name: composer-cache
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php-version }}-composer-
- name: composer-install
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: phpunit
run: vendor/bin/phpunit

test:
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.can-fail }}

strategy:
fail-fast: false
matrix:
include:
# Lowest Deps 5.4
- php: lowest
symfony: 5.4.*
coverage: 'none'
composer-flags: '--prefer-stable --prefer-lowest'
can-fail: false
# LTS with latest stable PHP 5.4
- php: latest
symfony: 5.4.*
coverage: 'none'
composer-flags: '--prefer-stable'
can-fail: false
# LTS with latest stable PHP 6.4
- php: latest
symfony: 6.4.*
coverage: 'none'
composer-flags: '--prefer-stable'
can-fail: false
# Active release
- php: latest
symfony: 7.0.*
coverage: pcov
composer-flags: '--prefer-stable'
can-fail: false
# Development release
- php: nightly
symfony: 7.1.*@dev
coverage: 'none'
composer-flags: ''
can-fail: true

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2, flex
coverage: ${{ matrix.coverage }}
ini-values: date.timezone=UTC,memory_limit=-1,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1
env:
fail-fast: true

- name: Set Composer stability
if: matrix.php == 'nightly'
run: "composer config minimum-stability dev"

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-

- name: Install Composer dependencies
run: composer update ${{ matrix.composer-flags }} --no-interaction --no-progress --optimize-autoloader
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

- name: Run tests
run: composer test

- name: Monitor coverage
if: matrix.coverage != 'none'
uses: slavcodev/coverage-monitor-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_path: coverage-report.xml
threshold_alert: 60
threshold_warning: 80
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/.idea/
/var/
/vendor/
.DS_Store
.php_cs.cache
.phpunit.result.cache
composer.lock
phpunit.xml
coverage-report.xml
43 changes: 27 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,58 @@
{
"name": "odandb/xhprof-bundle",
"description": "This bundle add additional XHProf menu item in symfony debug toolbar & makes things easier to handle XHProf profiling",
"license": "MIT",
"type": "symfony-bundle",
"keywords": [
"symfony",
"bundle",
"xhprof",
"profiling",
"debug",
"tideways",
"xhgui"
],
"authors": [
{
"name": "Mathieu Girard",
"email": "[email protected]"
},
{
"name": "OD&B",
"homepage": "https://www.odandb.com/"
}
],
"require": {
"php": ">=7.4",
"perftools/php-profiler": "^1.1",
"symfony/config": "^5.4 || ^6.4 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.4 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^6.2"
"phpunit/phpunit": "^9.5",
"symfony/phpunit-bridge": "^7.0"
},
"suggest": {
"perftools/xhgui": "To view the profiling results in a web interface"
},
"license": "MIT",
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"Odandb\\XhprofBundle\\": "src/",
"Odandb\\XhprofBundle\\Tests\\": "tests/"
"Odandb\\XhprofBundle\\": "src/"
}
},
"authors": [
{
"name": "Mathieu Girard",
"email": "[email protected]"
},
{
"name": "OD&B",
"homepage": "https://www.odandb.com/"
"autoload-dev": {
"psr-4": {
"Odandb\\XhprofBundle\\Tests\\": "tests/"
}
]
},
"config": {
"sort-packages": true
},
"scripts": {
"test": "vendor/bin/phpunit --coverage-clover=coverage-report.xml"
}
}
6 changes: 6 additions & 0 deletions phpunit.xml.dist → phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<include>
<directory>./src/</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 3c5b307

Please sign in to comment.