Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
304 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,321 @@ | ||
name: Documentation | ||
name: CI | ||
|
||
on: | ||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: [ master, release-* ] | ||
paths: | ||
branches: ['**'] | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
branches: [ master, release-* ] | ||
paths: | ||
branches: [master, release-*] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
linter: | ||
name: Linter | ||
runs-on: ['ubuntu-latest'] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Lint Code Base | ||
uses: github/super-linter/slim@v4 | ||
env: | ||
VALIDATE_ALL_CODEBASE: true | ||
LINTER_RULES_PATH: 'tools/linters' | ||
VALIDATE_CSS: true | ||
VALIDATE_JAVASCRIPT_ES: true | ||
VALIDATE_JSON: true | ||
VALIDATE_PHP_BUILTIN: true | ||
VALIDATE_YAML: true | ||
VALIDATE_GITHUB_ACTIONS: true | ||
|
||
quality: | ||
name: Quality checks | ||
name: Quality control | ||
runs-on: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Setup PHP, with composer and extensions | ||
id: setup-php | ||
# https://github.com/shivammathur/setup-php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
tools: composer:v2 | ||
extensions: dom, mbstring, openssl, xml, zlib | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Lint markdown files | ||
uses: nosborn/github-action-markdown-cli@v3.1.0 | ||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: $COMPOSER_CACHE | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: PHP Code Sniffer | ||
run: php vendor/bin/phpcs | ||
|
||
- name: Psalm | ||
continue-on-error: true | ||
run: | | ||
php vendor/bin/psalm \ | ||
-c psalm.xml \ | ||
--show-info=true \ | ||
--shepherd \ | ||
--php-version=${{ steps.setup-php.outputs.php-version }} | ||
- name: Psalm (testsuite) | ||
run: | | ||
php vendor/bin/psalm \ | ||
-c psalm-dev.xml \ | ||
--show-info=true \ | ||
--shepherd \ | ||
--php-version=${{ steps.setup-php.outputs.php-version }} | ||
- name: Psalter | ||
run: | | ||
php vendor/bin/psalter \ | ||
--issues=UnnecessaryVarAnnotation \ | ||
--dry-run \ | ||
--php-version=${{ steps.setup-php.outputs.php-version }} | ||
basic-tests: | ||
name: Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }} | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
php-versions: ['8.0', '8.1', '8.2'] | ||
|
||
steps: | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
with: | ||
files: . | ||
ignore_path: .markdownlintignore | ||
php-version: ${{ matrix.php-versions }} | ||
ini-values: error_reporting=E_ALL^E_DEPRECATED | ||
extensions: dom, mbstring, openssl, xml, zlib | ||
coverage: xdebug | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- name: Setup problem matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- name: Perform spell check | ||
uses: codespell-project/actions-codespell@master | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get composer cache directory (linux) | ||
if: ${{ matrix.operating-system == 'ubuntu-latest' }} | ||
run: echo "COMPOSER_CACHE=$(composer config cache-files-dir)" >> $GITHUB_ENV | ||
|
||
- name: Get composer cache directory (windows) | ||
if: ${{ matrix.operating-system == 'windows-latest' }} | ||
run: echo "COMPOSER_CACHE=$(composer config cache-files-dir)" >> $env:GITHUB_ENV | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: $COMPOSER_CACHE | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader | ||
|
||
- name: Syntax check PHP | ||
run: bash vendor/bin/check-syntax-php.sh | ||
|
||
- name: Decide whether to run code coverage or not | ||
if: ${{ matrix.php-versions != '8.1' || matrix.operating-system != 'ubuntu-latest' }} | ||
run: | | ||
echo "NO_COVERAGE=--no-coverage" >> $GITHUB_ENV | ||
- name: Run unit tests | ||
run: | | ||
echo $NO_COVERAGE | ||
./vendor/bin/phpunit $NO_COVERAGE | ||
- name: Save coverage data | ||
if: ${{ matrix.php-versions == '8.1' && matrix.operating-system == 'ubuntu-latest' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-data | ||
path: ${{ github.workspace }}/build | ||
|
||
security: | ||
name: Security checks | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | ||
with: | ||
php-version: '8.1' | ||
extensions: dom, mbstring, openssl, xml, zlib | ||
tools: composer:v2 | ||
coverage: none | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: $COMPOSER_CACHE | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Security check for locked dependencies | ||
run: composer audit | ||
|
||
- name: Update Composer dependencies | ||
run: composer update --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Security check for locked dependencies | ||
run: composer audit | ||
|
||
unit-tests-linux: | ||
name: "Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}" | ||
runs-on: ${{ matrix.operating-system }} | ||
needs: [linter, quality, security] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: ['8.0', '8.1', '8.2'] | ||
|
||
steps: | ||
- name: Setup PHP, with composer and extensions | ||
# https://github.com/shivammathur/setup-php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: intl, mbstring, mysql, pdo, pdo_sqlite, xml | ||
tools: composer:v2 | ||
ini-values: error_reporting=E_ALL | ||
coverage: xdebug | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- name: Setup problem matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get composer cache directory | ||
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: $COMPOSER_CACHE | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Run unit tests with coverage | ||
if: ${{ matrix.php-versions == '8.1' }} | ||
run: ./vendor/bin/phpunit | ||
|
||
- name: Run unit tests (no coverage) | ||
if: ${{ matrix.php-versions != '8.1' }} | ||
run: ./vendor/bin/phpunit --no-coverage | ||
|
||
- name: Save coverage data | ||
if: ${{ matrix.php-versions == '8.1' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-data | ||
path: ${{ github.workspace }}/build | ||
|
||
unit-tests-windows: | ||
name: "Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}" | ||
runs-on: ${{ matrix.operating-system }} | ||
needs: [linter, quality, security] | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
operating-system: [windows-latest] | ||
php-versions: ['8.0', '8.1', '8.2'] | ||
|
||
steps: | ||
- name: Setup PHP, with composer and extensions | ||
# https://github.com/shivammathur/setup-php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: intl, mbstring, mysql, pdo, pdo_sqlite, xml | ||
tools: composer:v2 | ||
ini-values: error_reporting=E_ALL | ||
coverage: xdebug | ||
|
||
- name: Setup problem matchers for PHP | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
|
||
- name: Setup problem matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Get composer cache directory | ||
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: $COMPOSER_CACHE | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install Composer dependencies | ||
run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Run unit tests | ||
run: ./vendor/bin/phpunit --no-coverage | ||
|
||
coverage: | ||
name: Code coverage | ||
runs-on: [ubuntu-latest] | ||
needs: [unit-tests-linux] | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: '**/*.md' | ||
check_filenames: true | ||
ignore_words_list: tekst | ||
name: coverage-data | ||
path: ${{ github.workspace }}/build | ||
|
||
- name: Codecov | ||
uses: codecov/codecov-action@v3 |