rename MasterCRUD to MasterCrud #1209
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Testing | |
on: | |
pull_request: | |
branches: '**' | |
push: | |
branches: '**' | |
schedule: | |
- cron: '0 */6 * * *' | |
jobs: | |
unit-test: | |
name: Unit | |
runs-on: ubuntu-latest | |
container: | |
image: atk4/image:${{ matrix.php }} # https://github.com/atk4/image | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['7.3', 'latest'] | |
type: ['Phpunit'] | |
include: | |
- php: 'latest' | |
type: 'CodingStyle' | |
env: | |
LOG_COVERAGE: "${{ fromJSON('{true: \"1\", false: \"\"}')[matrix.php == 'latest' && matrix.type == 'Phpunit' && (github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))] }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure PHP | |
run: | | |
if [ -n "$LOG_COVERAGE" ]; then echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; else rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; fi | |
php --version | |
- name: Setup cache 1/2 | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Setup cache 2/2 | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.type }}-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install PHP dependencies | |
run: | | |
if [ "${{ matrix.type }}" != "Phpunit" ]; then composer remove --no-interaction --no-update phpunit/phpunit --dev ; fi | |
if [ "${{ matrix.type }}" != "CodingStyle" ]; then composer remove --no-interaction --no-update friendsofphp/php-cs-fixer --dev ; fi | |
composer install --no-suggest --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader | |
- name: Init | |
run: | | |
mkdir -p build/logs | |
- name: "Run tests: Phpunit (only for Phpunit)" | |
if: matrix.type == 'Phpunit' | |
run: "vendor/bin/phpunit \"$(if [ -n \"$LOG_COVERAGE\" ]; then echo '--coverage-text'; else echo '--no-coverage'; fi)\" -v" | |
- name: Lint / check syntax (only for CodingStyle) | |
if: matrix.type == 'CodingStyle' | |
run: find . \( -type d \( -path './vendor/*' \) \) -prune -o ! -type d -name '*.php' -print0 | xargs -0 -n1 php -l | |
- name: Check Coding Style (only for CodingStyle) | |
if: matrix.type == 'CodingStyle' | |
run: vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --diff-format=udiff --verbose --show-progress=dots | |
- name: Upload coverage logs (only for "latest" Phpunit) | |
if: env.LOG_COVERAGE | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: build/logs/clover.xml |