Skip to content

Commit

Permalink
Fix mutation tests workflow for push events
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed May 31, 2023
1 parent b11d81b commit 1f734f9
Showing 1 changed file with 8 additions and 48 deletions.
56 changes: 8 additions & 48 deletions .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ permissions:
contents: read

jobs:
infection-changed-files:
name: Infection for changed files
if: github.event_name == 'pull_request' || github.event_name == 'push'
infection:
name: Infection
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
Expand Down Expand Up @@ -65,56 +64,17 @@ jobs:
run: composer run phpunit -- --testsuite unit --stop-on-failure

- name: Run Infection for changed files only
if: github.event_name == 'pull_request'
run: |
infection -j$(nproc) --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF \
--logger-github --ignore-msi-with-no-mutations --only-covered \
--skip-initial-tests --coverage=build/logs --no-interaction --no-progress
- name: Run Infection for changed files only
if: github.event_name == 'push'
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: |
infection -j$(nproc) --git-diff-lines --git-diff-base=origin/$GITHUB_REF_NAME \
if [ "$GITHUB_EVENT_NAME" = "push" ]; then \
INFECTION_GIT_DIFF_BASE="origin/$GITHUB_REF_NAME^"; else \
INFECTION_GIT_DIFF_BASE="origin/$GITHUB_BASE_REF"; fi
infection -j$(nproc) --git-diff-lines --git-diff-base="$INFECTION_GIT_DIFF_BASE" \
--logger-github --ignore-msi-with-no-mutations --only-covered \
--skip-initial-tests --coverage=build/logs --no-interaction --no-progress
infection-all-files:
name: Infection for all files
if: github.event_name == 'schedule'
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
php-version:
- "8.2"
operating-system:
- ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Gettext
run: sudo apt-get install -y gettext

- name: Generate mo files
run: ./scripts/generate-mo --quiet

- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: memory_limit=-1
tools: composer:v2, infection

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest

- name: Collect coverage report
run: composer run phpunit -- --testsuite unit --stop-on-failure

- name: Run Infection for all files
if: github.event_name == 'schedule'
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}
run: infection -j$(nproc) --skip-initial-tests --coverage=build/logs --no-interaction --no-progress

0 comments on commit 1f734f9

Please sign in to comment.