Skip to content

Phalcon CI

Phalcon CI #95

# This file is part of Phalcon.
#
# (c) Phalcon Team <[email protected]>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
name: "Phalcon CI"
on:
schedule:
- cron: '0 2 * * *' # Daily at 02:00 runs only on default branch
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
workflow_dispatch:
env:
fail-fast: true
# All versions should be declared here
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
permissions: { }
jobs:
# PHP CodeSniffer inspection
phpcs:
name: "Validate Tests code style"
if: "!contains(github.event.head_commit.message, 'ci skip')"
permissions:
contents: read
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- uses: actions/checkout@v3
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist"
- name: "PHPCS"
run: |
vendor/bin/phpcs --standard=./phpcs.xml.dist
unit-tests:
needs: phpcs
permissions:
contents: read # to fetch code (actions/checkout)
name: Unit tests / PHP-${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- uses: actions/checkout@v3
- name: "Setup platform specific environment"
shell: pwsh
run: |
git config --global core.autocrlf false
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: pecl, composer:v2
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Validate composer"
run: composer validate --no-check-all --no-check-publish
- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist"
- name: "Run Unit Tests"
if: always()
run: |
composer test
upload-coverage:
needs: unit-tests
permissions:
contents: read # to fetch code (actions/checkout)
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Setup platform specific environment"
shell: pwsh
run: |
git config --global core.autocrlf false
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: pecl, composer:v2
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Validate composer"
run: composer validate --no-check-all --no-check-publish
- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist"
- name: "Run Unit Tests with coverage"
if: always()
run: |
composer test-coverage
- name: "Upload coverage to Codacy"
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) \
report -r ./build/coverage.xml