Skip to content

Commit

Permalink
update CI actions
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed May 14, 2024
1 parent 15467bd commit 0f63009
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 38 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: phpstan

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
analyze:
Expand All @@ -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'
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
11 changes: 6 additions & 5 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pint

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
analyze:
Expand All @@ -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'
php-version: "8.3"
coverage: none
tools: laravel/pint

- name: Run analysis
- name: 🧪 Analyse code
run: pint
38 changes: 32 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,50 @@ name: Publish
on:
push:
tags:
- '**'
- "**"

jobs:
# @see https://stackoverflow.com/a/72959712/8179249
check-current-branch:
runs-on: ubuntu-latest

outputs:
branch: ${{ steps.check_step.outputs.branch }}

steps:
- name: 🏗 Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🏗 Get current branch
id: check_step
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch="$(echo ${raw//origin\//} | tr -d '\n')"
echo "{name}=branch" >> $GITHUB_OUTPUT
echo "Branches where this tag exists : $branch."
build:
runs-on: ubuntu-latest

needs: check-current-branch

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: contains(${{ needs.check.outputs.branch }}, 'main')
# prerelease: true
# files: '*.vsix'
34 changes: 18 additions & 16 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]
stability: [prefer-stable]
laravel: [10.*, 11.*]
dependency-version: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*

- laravel: 11.*
testbench: 9.*
exclude:
- php: 8.1
laravel: 11.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
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
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
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ parameters:

excludePaths:
- src/Redirector.php

checkMissingIterableValueType: false

0 comments on commit 0f63009

Please sign in to comment.