Merge pull request #187 from voku/renovate/actions-cache-3.x #160
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
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ | |
7.2, | |
7.3, | |
7.4, | |
8.0, | |
8.1, | |
8.2 | |
] | |
composer: [basic] | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/[email protected] | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: xdebug | |
extensions: zip | |
tools: composer | |
- name: Determine composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=directory::$(composer config cache-dir)" | |
- name: Cache composer dependencies | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.composer-cache.outputs.directory }} | |
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ matrix.php }}-composer- | |
- name: Install dependencies | |
run: | | |
if [[ "${{ matrix.composer }}" == "lowest" ]]; then | |
composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable | |
elif [[ "${{ matrix.composer }}" == "basic" ]]; then | |
composer update --prefer-dist --no-interaction | |
fi; | |
composer dump-autoload -o | |
- name: Run tests | |
run: | | |
mkdir -p build/logs | |
php vendor/bin/phpunit -c phpunit.xml --coverage-clover=build/logs/clover.xml | |
- name: Run phpstan | |
continue-on-error: true | |
if: ${{ matrix.php == '8.0' }} | |
run: | | |
php vendor/bin/phpstan analyse | |
- name: Upload coverage results to Coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require php-coveralls/php-coveralls | |
php-coveralls --coverage_clover=build/logs/clover.xml -v | |
- name: Upload coverage results to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/logs/clover.xml | |
- name: Archive logs artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs_composer-${{ matrix.composer }}_php-${{ matrix.php }} | |
path: | | |
build/logs |