diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 58e9d475f7..de29dac6e3 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -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: @@ -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' + if: github.event_name == 'push' || github.event_name == 'pull_request' run: | - infection -j$(nproc) --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF \ + 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 - - name: Run Infection for changed files only - if: github.event_name == 'push' - run: | - infection -j$(nproc) --git-diff-lines --git-diff-base=origin/$GITHUB_REF_NAME \ - --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