feat: new v4 version (#5)

This commit is contained in:
2024-03-04 22:02:49 +00:00
committed by GitHub
parent f1b14d4d40
commit 8d5b060acf
28 changed files with 5385 additions and 522 deletions

39
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: "Chilean Rut CI"
on:
pull_request:
branches: ['master']
paths:
- '**.php'
- 'composer.json'
- '.github/workflows/ci.yml'
- '.github/workflows/php.yml'
push:
branches: ['master']
paths:
- '**.php'
- 'composer.json'
- '.github/workflows/ci.yml'
- '.github/workflows/php.yml'
jobs:
ci:
name: 'CI'
uses: ./.github/workflows/php.yml
with:
php-version: 8.2
composer-cmd: install --ansi --no-interaction --no-progress --no-suggest --prefer-dist
secrets: inherit
# Publishes code coverage report
publish-coverage:
name: "Publish Coverage"
needs: ['ci']
if: ${{ github.ref_name == 'master' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

51
.github/workflows/php.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: "PHP Checks"
on:
workflow_call:
inputs:
php-version:
description: 'The version of PHP to use'
default: '8.2'
type: string
composer-cmd:
description: 'Command to install dependencies'
type: string
default: 'install --ansi --no-interaction --no-progress --no-suggest --prefer-dist'
jobs:
php-checks:
name: "PHP Checks"
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ inputs.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"
- name: "Install dependencies"
run: "composer ${{ inputs.composer-cmd }}"
- name: "Check Code Style"
run: "composer fmt:check"
- name: "Run Psalm"
run: "composer psalm:gh"
- name: "Run Test Suite"
run: "composer test"
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.dev/coverage'

View File

@@ -1,122 +0,0 @@
name: "Review PR"
on:
pull_request:
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
jobs:
# This job ensures the coding standard is followed
coding-standards:
name: "Coding Standards"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-version:
- "7.4"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout Code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "composer-cache"
restore-keys: "composer-cache"
- name: "Install dependencies"
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Coding Standard"
run: "vendor/bin/php-cs-fixer fix --dry-run -vvv"
type-analysis:
name: "Type Coverage"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-version:
- "7.4"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout Code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "composer-cache"
restore-keys: "composer-cache"
- name: "Install dependencies"
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Run Psalm"
run: "vendor/bin/psalm --output-format=github --shepherd --stats"
continue-on-error: true
unit-test:
name: "Unit Testing"
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
dependencies:
- "lowest"
- "highest"
php-version:
- "7.4"
- "8.0"
operating-system:
- "ubuntu-latest"
steps:
- name: "Checkout Code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "composer-cache"
restore-keys: "composer-cache"
- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest"
- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer install ${{ env.COMPOSER_FLAGS }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit --testdox --coverage-text"