[BUGFIX] Simplify installation process in CGL workflow #584
Workflow file for this run
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
- 'renovate/**' | |
# @todo Remove once 2.x branch is merged | |
- 2.x | |
pull_request: | |
branches: | |
- main | |
# @todo Remove once 2.x branch is merged | |
- 2.x | |
jobs: | |
tests: | |
name: Tests (PHP ${{ matrix.php-version }}, Composer ${{ matrix.composer-version }} & ${{ matrix.dependencies }} dependencies) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: ["8.1", "8.2", "8.3"] | |
composer-version: ["2.2", "2.3", "2.4", "2.5", "2.6", "2.7"] | |
dependencies: ["highest", "lowest"] | |
# Avoid incompatible interface implementations in Composer v2.6 & symfony/console v7 | |
include: | |
- php-version: "8.2" | |
composer-version: "2.6" | |
dependencies: "highest" | |
composer-extra-options: '--with="symfony/console:^6.0"' | |
- php-version: "8.3" | |
composer-version: "2.6" | |
dependencies: "highest" | |
composer-extra-options: '--with="symfony/console:^6.0"' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Prepare environment | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
tools: composer:${{ matrix.composer-version }} | |
coverage: none | |
# Install dependencies | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
dependency-versions: ${{ matrix.dependencies }} | |
composer-options: '--with="composer/composer:~${{ matrix.composer-version }}.0" ${{ matrix.composer-extra-options }}' | |
# Run tests | |
- name: Run tests | |
run: composer test | |
coverage: | |
name: Test coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Prepare environment | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
tools: composer:v2 | |
coverage: pcov | |
# Install dependencies | |
- name: Install Composer dependencies | |
uses: ramsey/composer-install@v2 | |
# Run tests | |
- name: Run tests with coverage | |
run: composer test:coverage | |
# Upload artifact | |
- name: Fix coverage path | |
working-directory: .build/coverage | |
run: sed -i 's#/home/runner/work/composer-update-check/composer-update-check#${{ github.workspace }}#g' clover.xml | |
- name: Upload coverage artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: .build/coverage/clover.xml | |
retention-days: 7 | |
coverage-report: | |
name: Report test coverage | |
runs-on: ubuntu-latest | |
needs: coverage | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Download artifact | |
- name: Download coverage artifact | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
# CodeClimate | |
- name: CodeClimate report | |
uses: paambaati/codeclimate-action@v5.0.0 | |
if: env.CC_TEST_REPORTER_ID | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
coverageLocations: | | |
${{ steps.download.outputs.download-path }}/clover.xml:clover | |
# codecov | |
- name: codecov report | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: | | |
${{ steps.download.outputs.download-path }}/clover.xml | |
fail_ci_if_error: true | |
verbose: true |