Skip to content

Commit

Permalink
Update Actions workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
  • Loading branch information
MauricioFauth committed Sep 11, 2023
1 parent 6a1c2d4 commit 63b26a9
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 49 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/lint-and-analyse-php.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
name: Lint and analyse php files
name: Lint and analyse PHP files

on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master

jobs:
lint-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use php 7.1
- name: Checkout code
uses: actions/checkout@v4

- name: Set up PHP 7.1
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:v2

- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache module
uses: actions/cache@v3
run: composer validate --strict

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install
dependency-versions: highest

- name: Lint files
run: composer run phpcs

analyse-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use php 7.1
- name: Checkout code
uses: actions/checkout@v4

- name: Set up PHP 7.1
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:v2
- name: Cache module
uses: actions/cache@v3

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install
dependency-versions: highest

- name: Analyse files
run: composer run phpstan
11 changes: 5 additions & 6 deletions .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: Lint php documentation
name: Lint PHP documentation

on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master

jobs:
lint-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: lint php documentation
- name: Checkout code
uses: actions/checkout@v4

- name: Lint PHP documentation
uses: sudo-bot/action-doctum@v5
with:
config-file: doctum-config.php
Expand Down
39 changes: 17 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Run tests
on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master

jobs:
test-php:
Expand All @@ -14,46 +11,44 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php-version: ["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
extensions: [":apcu, mbstring", "apcu, mbstring"]
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
extensions: [':apcu, mbstring', 'apcu, mbstring']
os: [ubuntu-latest]
experimental: [false]
composer-options: ['']
include:
- { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs', extensions: 'apcu, mbstring' }
- { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs', extensions: ':apcu, mbstring' }
- { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: 'apcu, mbstring' }
- { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-req=php+', extensions: ':apcu, mbstring' }
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch some commits for Scrutinizer coverage upload
fetch-depth: 15
- name: Use php ${{ matrix.php-version }}

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ matrix.extensions }}
ini-values: "apc.enable_cli=1"
coverage: xdebug
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Restore cache
uses: actions/cache@v3

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
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-interaction ${{ matrix.composer-options }}
- name: Run php tests
dependency-versions: highest
composer-options: ${{ matrix.composer-options }}

- name: Run PHP tests
run: composer run phpunit

- name: Send coverage
uses: codecov/codecov-action@v3
with:
flags: unit-${{ matrix.php-version }}-${{ matrix.os }}
name: phpunit-${{ matrix.php-version }}-${{ matrix.os }}

- name: Send coverage to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
# Do not run this step on forked versions of the main repository (example: contributor forks)
Expand Down

0 comments on commit 63b26a9

Please sign in to comment.