Restore composer version for Packagist #348
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: CI | |
on: | |
workflow_dispatch: # Can manually run from any branch | |
push: | |
branches: | |
- trunk | |
pull_request: | |
jobs: | |
php-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
php: [ '8.3', '8.2', '8.1' ] | |
os: [ 'ubuntu-latest' ] | |
include: | |
- php: '8.0' | |
os: 'ubuntu-20.04' | |
- php: '7.4' | |
os: 'ubuntu-20.04' | |
fail-fast: false | |
env: | |
COVERAGE_CACHE_PATH: phpunit-coverage-cache | |
PHP_VERSION: ${{ matrix.php }} | |
steps: | |
- uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # v2.4.2 | |
- name: Set up PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35 # v2.28.0 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: pcov | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # v2.1.7 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Restore phpunit coverage cache | |
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # v2.1.7 | |
with: | |
path: ${{ env.COVERAGE_CACHE_PATH }} | |
key: ${{ runner.os }}-coverage-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-coverage-${{ github.ref }}- | |
${{ runner.os }}-coverage- | |
- name: Execute tests with PHPUnit and output code coverage report | |
env: | |
DB_CONNECTION: sqlite | |
DB_DATABASE: database/database.sqlite | |
# Generate coverage file, so it can be uploaded later if we choose. | |
# Otherwise, current coverage can be viewed in the action output. | |
# Tests should be run randomly to catch any test dependency issue. | |
run: | | |
vendor/bin/phpunit --order-by="random" --coverage-cache="$COVERAGE_CACHE_PATH" --coverage-clover=./clover.xml --coverage-text | |
- name: Upload test coverage results to Coveralls | |
if: ${{ env.PHP_VERSION == '8.1' }} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
vendor/bin/php-coveralls --coverage_clover="./clover.xml" --json_path="./coveralls-upload.json" -v | |
php-compatibility: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Dependencies | |
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --ignore-platform-req php | |
- name: Run PHP Code Sniffer using the PHPCompatibility standard | |
run: vendor/bin/phpcs | |
php-static-analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Dependencies | |
run: | | |
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Run phpstan | |
run: vendor/bin/phpstan |