Skip to content

Commit

Permalink
Re-enable code coverage analysis as PHPUnit 11 is now supported by `i…
Browse files Browse the repository at this point in the history
…nfection/infection`
  • Loading branch information
Slamdunk committed Aug 21, 2024
1 parent d4844d0 commit 9bdfaf2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 36 deletions.
66 changes: 32 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,40 +83,38 @@ jobs:
timeout-minutes: 3
run: "vendor/bin/phpunit --no-coverage --no-logging"

# code-coverage:
# name: "Code Coverage"
# runs-on: "ubuntu-latest"
# strategy:
# matrix:
# php-version:
# - "8.2"
#
# steps:
# - uses: "actions/checkout@v4"
# - uses: "shivammathur/setup-php@v2"
# with:
# coverage: "pcov"
# php-version: "${{ matrix.php-version }}"
# ini-values: "${{ env.INI_VALUES }}"
# - uses: "ramsey/composer-install@v2"
#
# - name: "Gather base branch for diff"
# if: ${{ github.event_name == 'pull_request' }}
# run: git fetch origin --no-tags --prune --depth=1 ${{ github.base_ref }} ${{ github.event.pull_request.base.sha }}
#
# - name: "Infection on DIFF"
# if: ${{ github.event_name == 'pull_request' }}
# timeout-minutes: 30
# run: make code-coverage INFECTION_ARGS="--logger-github"
# env:
# BASE_BRANCH: origin/${{ github.base_ref }}
#
# - name: "Infection on complete code base"
# if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref_name, 'renovate/') }}
# timeout-minutes: 30
# run: "vendor/bin/infection run --ansi --threads=$(nproc) --skip-initial-tests --coverage=coverage"
# env:
# INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}
code-coverage:
name: "Code Coverage"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.2"

steps:
- uses: "actions/checkout@v4"
- uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: "${{ env.INI_VALUES }}"
- uses: "ramsey/composer-install@v2"

- name: "Gather base branch for diff"
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin --no-tags --prune --depth=1 ${{ github.base_ref }} ${{ github.event.pull_request.base.sha }}

- name: "Infection on DIFF"
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 30
run: "vendor/bin/infection run --ansi --threads=$(nproc) --skip-initial-tests --coverage=coverage --git-diff-lines --git-diff-base=origin/${{ github.base_ref }} --show-mutations --verbose --ignore-msi-with-no-mutations --min-msi=100"

- name: "Infection on complete code base"
if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref_name, 'renovate/') }}
timeout-minutes: 30
run: "vendor/bin/infection run --ansi --threads=$(nproc) --skip-initial-tests --coverage=coverage"
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

coding-standards:
name: "Coding Standards"
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM php:8.3

# git needed for Infection
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
git

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN install-php-extensions @composer pcov
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ ifeq ($(strip $(LOCAL_BASE_BRANCH)),)
endif
BASE_BRANCH ?= $(LOCAL_BASE_BRANCH)

#all: csfix static-analysis code-coverage
all: csfix static-analysis test
all: csfix static-analysis code-coverage
@echo "Done."

.env: /etc/passwd /etc/group Makefile
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"ext-pcov": "*",
"ext-posix": "*",
"doctrine/coding-standard": "^12.0.0",
"infection/infection": "^0.29.6",
"phpstan/phpstan": "^1.11.11",
"phpstan/phpstan-deprecation-rules": "^1.2.0",
"phpstan/phpstan-phpunit": "^1.4.0",
Expand Down

0 comments on commit 9bdfaf2

Please sign in to comment.