# https://docs.github.com/en/actions name: Mutation tests on: push: branches: - master paths: - 'src/**.php' - 'tests/unit/**.php' pull_request: branches: - master paths: - 'src/**.php' - 'tests/unit/**.php' workflow_dispatch: schedule: - cron: '0 0 * * *' permissions: contents: read jobs: infection: name: Infection runs-on: ${{ matrix.operating-system }} strategy: matrix: php-version: - "8.2" operating-system: - ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 with: fetch-depth: 2 persist-credentials: false - name: Checkout base ref code if: github.event_name == 'pull_request' uses: actions/checkout@v7 with: ref: ${{ github.base_ref }} persist-credentials: false - name: Install gettext and generate translation files run: | sudo apt-get install -y gettext ./bin/generate-mo --quiet - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} coverage: pcov tools: infection:0.27.11 - name: Install Composer dependencies uses: ramsey/composer-install@v4 - name: Run Infection for changed files only if: github.event_name == 'push' || github.event_name == 'pull_request' run: | 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 --threads=max --git-diff-lines --git-diff-base="$INFECTION_GIT_DIFF_BASE" \ --logger-github --ignore-msi-with-no-mutations --only-covered --no-interaction --no-progress - name: Run Infection for all files if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' env: INFECTION_DASHBOARD_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} run: infection --threads=max --no-interaction --log-verbosity=none --logger-github=false