chore(deps/actions): bump actions/checkout from 3 to 4 (#22) #82
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: PHP CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
PHP_LATEST: 8.2 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2 | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Run test suite | |
run: composer test | |
docs: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_LATEST }} | |
tools: composer:v2, phpdoc | |
- name: Build documentation | |
run: composer docs | |
- name: Deploy documentation | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/build | |
ci-success-pr: | |
runs-on: ubuntu-latest | |
name: ci-success (PR) | |
if: ${{ success() && github.event_name == 'pull_request' }} | |
needs: | |
- build | |
steps: | |
- name: ✅ CI succeeded | |
run: exit 0 | |
ci-success: | |
runs-on: ubuntu-latest | |
name: ci-success | |
if: ${{ success() && github.event_name == 'push' }} | |
needs: | |
- build | |
- docs | |
steps: | |
- name: ✅ CI succeeded | |
run: exit 0 |