Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into documentation-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-T committed May 12, 2024
2 parents 0c81d72 + 1f270e9 commit ba8449e
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 36 deletions.
143 changes: 107 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: PHP CI

on:
schedule:
- cron: '0 17 * * 5'
push:
pull_request:
branches:
Expand All @@ -11,113 +13,182 @@ permissions:
contents: read

jobs:
build:
stable-build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.lexer-version == '3.1.x-dev' }}
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
lexer-version: [ '^2.1', '~3.0.0', '3.1.x-dev' ]
# exclude:
# - php-version: '8.1'
# lexer-version: '^3.1'

name: Doctrine Lexer ${{ matrix.lexer-version }} - PHP ${{ matrix.php-version }}

name: PHP 8.3 - Doctrine Lexer 3.0
env:
HAS_CC_SECRET: ${{secrets.CC_TEST_REPORTER_ID != '' }}
HAS_CA_SECRET: ${{secrets.COVERALLS_REPO_TOKEN != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Validate composer.json
run: composer validate --strict

- name: Cache Composer packages
- name: Display Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer packages
id: composer-cache-stable
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.lexer-version }}${{ hashFiles('**/composer.lock') }}
key: ${{ format('{0}_php_lexer_stable_', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.lexer-version }}
${{ format('{0}-php-lexer-stable-', runner.os) }}
- name: Set up PHP ${{ matrix.php-version }}
- name: Set up PHP 8.3
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: 8.3
coverage: pcov
tools: composer:v2

- name: Install dependencies
run: composer --prefer-source require doctrine/lexer:${{ matrix.lexer-version }}
run: composer --prefer-source update

- name: Show libraries
run: composer show

- name: Run test with coverage
uses: paambaati/[email protected]
if: env.HAS_CC_SECRET == 'true'
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageCommand: vendor/bin/phpunit --coverage-clover=.phpunit.cache/clover-${{ matrix.php-version }}.xml
coverageCommand: vendor/bin/phpunit --coverage-clover=.phpunit.cache/clover-8.3.xml
coverageLocations: ${{github.workspace}}/.phpunit.cache/clover*.xml:clover

- name: Run tests for forks
- name: Run tests for forks or version without code coverage
if: env.HAS_CC_SECRET != 'true'
run: vendor/bin/phpunit

- name: Coveralls.io steps
if: ${{ env.HAS_CA_SECRET == 'true' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
file: ${{github.workspace}}/.phpunit.cache/clover-8.3.xml


## Quality checks
## PHP-CS-Fixer
- name: Cache Composer PHP-CS-FIXER packages
if: ${{ matrix.lexer-version == '~3.0.0' }}
id: composer-phpcsfixer-cache
uses: actions/cache@v4
with:
path: quality/php-cs-fixer/vendor/
key: ${{ runner.os }}-phpcsfixer-${{ hashFiles('**/composer.lock') }}
key: ${{ format('{0}-phpcsfixer-{1}', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ runner.os }}-phpcsfixer-
${{ format('{0}-phpcsfixer-', runner.os) }}
- name: Install PHP-CS-Fixer
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: composer update --working-dir=quality/php-cs-fixer

- name: Run PHP-CS-Fixer
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: ./quality/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=quality/php-cs-fixer/.php-cs-fixer.php --dry-run --allow-risky=yes

## PHP-MESS-DETECTOR
- name: Cache Composer PHP-MESS-DETECTOR packages
if: ${{ matrix.lexer-version == '~3.0.0' }}
id: composer-phpmd-cache
uses: actions/cache@v4
with:
path: quality/php-cs-fixer/vendor/
key: ${{ runner.os }}-phpmd-${{ hashFiles('**/composer.lock') }}
key: ${{ format('{0}-phpmd-{1}', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ runner.os }}-phpmd-
${{ format('{0}-phpmd-', runner.os) }}
- name: Install PHP-MESS-DETECTOR
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: composer update --working-dir=quality/php-mess-detector
- name: Run PHP-MESS-DETECTOR on lib directory
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: ./quality/php-mess-detector/vendor/bin/phpmd lib text quality/php-mess-detector/ruleset.xml
- name: Run PHP-MESS-DETECTOR on tests directory
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: ./quality/php-mess-detector/vendor/bin/phpmd tests text quality/php-mess-detector/test-ruleset.xml

## PHP-STAN
- name: Cache Composer PHP-STAN packages
if: ${{ matrix.lexer-version == '~3.0.0' }}
id: composer-php-stan-cache
uses: actions/cache@v4
with:
path: quality/php-cs-fixer/vendor/
key: ${{ runner.os }}-php-stan-${{ hashFiles('**/composer.lock') }}
key: ${{ format('{0}-phpstan-{1}', runner.os, hashFiles('**/composer.lock')) }}
restore-keys: |
${{ runner.os }}-php-stan-
${{ format('{0}-phpstan-', runner.os) }}
- name: Install PHP-STAN
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: composer update --working-dir=quality/php-stan
- name: Run PHP-STAN
if: ${{ matrix.lexer-version == '~3.0.0' }}
run: ./quality/php-stan/vendor/bin/phpstan analyse --configuration=quality/php-stan/php-stan.neon lib tests --error-format=table --no-progress --no-interaction --no-ansi --level=9 --memory-limit=256M -v
old-version-build:
needs: stable-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
lexer: [ '2.1', '3.0']
exclude:
# Already tested
- php: '8.3'
lexer: '3.0'

name: PHP ${{ matrix.php }} - Doctrine Lexer ${{ matrix.lexer }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer packages
id: composer-cache-old
uses: actions/cache@v4
with:
path: vendor
key: ${{ format('{0}-php-{1}-lexer-{2}-{3}', runner.os, matrix.php, matrix.lexer, hashFiles('**/composer.lock')) }}
restore-keys: ${{ format('{0}-php-{1}-lexer-{2}-', runner.os, matrix.php, matrix.lexer) }}
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Install dependencies
run: composer --prefer-source require doctrine/lexer:${{ matrix.lexer }}

- name: Show libraries
run: composer show

- name: Run tests for forks or version without code coverage
run: vendor/bin/phpunit
dev-version-build:
needs: stable-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
name: PHP ${{ matrix.php }} - Doctrine Lexer 3.1.x-dev
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Composer packages
id: composer-cache-x-dev
uses: actions/cache@v4
with:
path: vendor
key: ${{ format('{0}-php-{1}-lexer-x-dev-{2}', runner.os, matrix.php, hashFiles('**/composer.lock')) }}
restore-keys: ${{ format('{0}-php-{1}-lexer-x-dev-', runner.os, matrix.php) }}
- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Install dependencies
run: composer --prefer-source require doctrine/lexer:3.1.x-dev

- name: Show libraries
run: composer show

- name: Run tests for forks or version without code coverage
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Lexer and parser library for geographic point string values.
[![PHP CI](https://github.com/longitude-one/geo-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/longitude-one/geo-parser/actions/workflows/ci.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/395f661509f03ebed0ee/maintainability)](https://codeclimate.com/github/longitude-one/geo-parser/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/395f661509f03ebed0ee/test_coverage)](https://codeclimate.com/github/longitude-one/geo-parser/test_coverage)
[![Coverage Status](https://coveralls.io/repos/github/longitude-one/geo-parser/badge.svg)](https://coveralls.io/github/longitude-one/geo-parser)
![Minimum PHP Version](https://img.shields.io/packagist/php-v/longitude-one/geo-parser.svg?maxAge=3600)
[![Tested on PHP 8.1 to 8.3](https://img.shields.io/badge/tested%20on-PHP%20%208.1%20|%208.2%20|%208.3-brightgreen.svg?maxAge=2419200)](https://github.com/longitude-one/geo-parser/actions)

Expand Down

0 comments on commit ba8449e

Please sign in to comment.