Skip to content

Schedule CI

Schedule CI #218

Workflow file for this run

name: Schedule CI
# https://github.com/shivammathur/setup-php
on:
schedule:
- cron: '0 4 * * sun' # Sundays at 04 am
env:
extensions: mbstring #intl, pcov
codecoverage_path: reports/coverage
infection_path: reports/infection
phpmetrics_path: reports/phpmetrics
jobs:
code_coverage:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.3']
name: Code Coverage
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }} #optional
tools: phpcs, phpcbf, phpmd, phpstan, phpcpd, parallel-Lint
ini-values: "post_max_size=256M" #optional
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
chmod -R +x tools/*
- name: Tests with code coverage
run: >
vendor/bin/phpunit --coverage-html ${{ env.codecoverage_path }}/coverage-html
--coverage-xml ${{ env.codecoverage_path }}/coverage-xml
--log-junit ${{ env.codecoverage_path }}/junit.xml
--testdox-html ${{ env.codecoverage_path }}/documentation.html
- uses: actions/upload-artifact@v4
with:
name: CodeCoverage
path: ${{ env.codecoverage_path }}
infection:
needs: code_coverage
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.3']
name: Infection
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }} #optional
tools: phpcs, phpcbf, phpmd, phpstan, phpcpd, infection, parallel-Lint
ini-values: "post_max_size=256M" #optional
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
chmod -R +x tools/*
- uses: actions/download-artifact@v4
with:
name: CodeCoverage
- name: Infection execute
run: >
infection --threads=10 --skip-initial-tests --no-progress
--coverage=./
--logger-html=${{ env.infection_path }}/mutation-report.html
- uses: actions/upload-artifact@v4
with:
name: Infection
path: ${{ env.infection_path }}
phpMetrics:
needs: code_coverage
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.3']
name: PhpMetrics
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }} #optional
tools: phpcs, phpcbf, phpmd, phpstan, phpcpd, parallel-Lint
ini-values: "post_max_size=256M" #optional
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
chmod -R +x tools/*
- name: Install Global PhPMetrics
run: composer global require phpmetrics/phpmetrics
- uses: actions/download-artifact@v4
with:
name: CodeCoverage
- name: PhPMetrics Report
run: phpmetrics --report-html=${{ env.phpmetrics_path }} --junit=junit.xml ./src
- uses: actions/upload-artifact@v4
with:
name: PhPMetrics
path: ${{ env.phpmetrics_path }}
reports:
name: Reports
needs: [phpMetrics, infection]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: reports
- name: Check Reports
run: ls reports
- name: Get Time
id: time
uses: nanzm/get-time-action@master
with:
timeZone: 1
format: 'DD-MM-YYYY'
- uses: actions/upload-artifact@v4
with:
name: GitHooks Metrics - ${{ steps.time.outputs.time }}
path: reports