Skip to content

Commit

Permalink
add Laravel 11 support & refine CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Mar 13, 2024
1 parent e116a1f commit 4e253ca
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 34 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@ jobs:
name: PHPStan

steps:
- uses: actions/checkout@v4
- name: 🏗 Checkout code
uses: actions/checkout@v4

- name: Setup PHP
- name: 🏗 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: phpstan

- name: Get composer cache directory
- name: 🏗 Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
- name: 🏗 Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: phpstan-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: phpstan-composer-

- name: Install dependencies
- name: 📦 Install dependencies
run: composer install --no-interaction --no-suggest

- name: Run analysis
- name: 🧪 Analyse code
run: phpstan analyse
7 changes: 4 additions & 3 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
name: Laravel Pint

steps:
- uses: actions/checkout@v4
- name: 🏗 Checkout code
uses: actions/checkout@v4

- name: Setup PHP
- name: 🏗 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none
tools: laravel/pint

- name: Run analysis
- name: 🧪 Analyse code
run: pint
12 changes: 7 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 🏗 Checkout code
uses: actions/checkout@v4

- name: Get release info
- name: 🏗 Get release info
id: query-release-info
uses: release-flow/keep-a-changelog-action@v2
uses: release-flow/keep-a-changelog-action@v3
with:
command: query
version: latest

- name: Publish to Github releases
uses: softprops/action-gh-release@v1
- name: 🚀 Publish to Github releases
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.query-release-info.outputs.release-notes }}
make_latest: ${{ $GITHUB_REF_NAME == 'main' && true || false }}
# prerelease: true
# files: '*.vsix'
36 changes: 19 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,53 @@ jobs:
matrix:
os: [ ubuntu-latest ]
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 9.*, 10.* ]
dependency-version: [ prefer-stable ]
stability: [prefer-lowest, prefer-stable]
laravel: [ 9.*, 10.*, 11.* ]
include:
- laravel: 9.*
testbench: 7.*

- laravel: 10.*
testbench: 8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
- name: 🏗 Checkout code
uses: actions/checkout@v4

- name: Setup PHP
- name: 🏗 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, exif
coverage: pcov

- name: Get composer cache directory
- name: 🏗 Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v3
- name: 🏗 Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.dependency-version }}-
key: dependencies-composer-laravel-${{ matrix.laravel }}-${{ hashFiles('**/composer.lock') }}
restore-keys: dependencies-composer-laravel-${{ matrix.laravel }}-

- name: Install dependencies
- name: 📦 Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer update --prefer-dist --no-interaction --no-progress --${{ matrix.stability }}
- name: Execute tests
- name: 🧪 Execute tests
run: vendor/bin/phpunit -c phpunit.coverage.dist.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: 🚀 Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./clover.xml
fail_ci_if_error: true
verbose: true
# verbose: true
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
},
"require-dev": {
"larastan/larastan": "^2.0",
"orchestra/testbench": "^7.0 || ^8.0",
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": "^9.0 || ^10.0"
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"autoload": {
"psr-4": {
"OpenSoutheners\\PhpPackage\\": "src"
Expand Down

0 comments on commit 4e253ca

Please sign in to comment.