From 63b26a92a06040d968973f884db586a7719ff416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 11 Sep 2023 10:18:01 -0300 Subject: [PATCH] Update Actions workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- .github/workflows/lint-and-analyse-php.yml | 42 +++++++++++----------- .github/workflows/lint-docs.yml | 11 +++--- .github/workflows/tests.yml | 39 +++++++++----------- 3 files changed, 43 insertions(+), 49 deletions(-) diff --git a/.github/workflows/lint-and-analyse-php.yml b/.github/workflows/lint-and-analyse-php.yml index 530b55f..24dd987 100644 --- a/.github/workflows/lint-and-analyse-php.yml +++ b/.github/workflows/lint-and-analyse-php.yml @@ -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 diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 0cce94b..b5139e7 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7a17e8e..5ff1cbf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,9 +3,6 @@ name: Run tests on: push: pull_request: - types: [opened, synchronize, reopened] - branches: - - master jobs: test-php: @@ -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)