Skip to content

Merge pull request #410 from CPS-IT/renovate/github-artifact-actions #947

Merge pull request #410 from CPS-IT/renovate/github-artifact-actions

Merge pull request #410 from CPS-IT/renovate/github-artifact-actions #947

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- '**'
jobs:
tests:
name: Tests (PHP ${{ matrix.php-version }} & ${{ matrix.dependencies }} dependencies)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ["8.1", "8.2", "8.3", "8.4", "8.5"]
dependencies: ["highest", "lowest"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v${{ matrix.composer-version }}
coverage: none
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@5c2bcf28d7b060ef3c601d7b476d5430a7b46c27 # v4
with:
dependency-versions: ${{ matrix.dependencies }}
# Run tests
- name: Run tests
run: composer test
coverage:
name: Test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
with:
php-version: 8.5
tools: composer:v2
coverage: pcov
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@5c2bcf28d7b060ef3c601d7b476d5430a7b46c27 # v4
with:
dependency-versions: highest
# Run Unit tests
- name: Build coverage directory
run: mkdir -p .build/coverage
- name: Run Unit tests with coverage
run: composer test:coverage
# Upload artifact
- name: Fix coverage path
working-directory: .build/coverage
run: sed -i 's#/home/runner/work/php-cs-fixer-config/php-cs-fixer-config#${{ github.workspace }}#g' clover.xml
- name: Upload coverage artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
# Download artifact
- name: Download coverage artifact
id: download
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: coverage
# Coveralls
- name: Coveralls report
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2
with:
file: ${{ steps.download.outputs.download-path }}/clover.xml