Skip to content

Commit

Permalink
Merge pull request #321 from WordPress/add-codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Nov 15, 2023
2 parents db28ffe + 9222e1a commit b041f6b
Show file tree
Hide file tree
Showing 50 changed files with 656 additions and 2,028 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ concurrency:

jobs:
php-test:
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}${{ matrix.experimental && ' (experimental)' || '' }}
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}${{ matrix.experimental && ' (experimental)' || '' }}${{ matrix.coverage && ' (with coverage)' || '' }}
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
Expand All @@ -55,9 +55,11 @@ jobs:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
wordpress: [ 'latest' ]
include:
- php: '8.2'
wordpress: 'latest'
coverage: true
- php: '8.2'
wordpress: 'trunk'
experimental: true
Expand All @@ -70,7 +72,7 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Setup Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
Expand All @@ -80,11 +82,27 @@ jobs:
- name: npm install
run: npm ci

- name: Install WordPress
run: npm run wp-env start
- name: Start WordPress
run: |
if [[ ${{ matrix.coverage == true }} == true ]]; then
npm run wp-env start -- --xdebug=coverage
else
npm run wp-env start
fi
- name: Running php unit tests
run: npm run test-php
- name: Run tests
run: |
if [[ ${{ matrix.coverage == true }} == true ]]; then
npm run test-php-coverage
npm run test-php-multisite-coverage
else
npm run test-php
npm run test-php-multisite
fi
- name: Running multisite unit tests
run: npm run test-php-multisite
- name: Upload code coverage report
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
file: build/logs/*.xml
flags: unit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ build
node_modules/
vendor/
build-cs/vendor/
build-cs/composer.lock
build-phpunit/vendor/
build-phpunit/composer.lock

############
## OSes
Expand Down
5 changes: 1 addition & 4 deletions build-cs/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"phpcompatibility/php-compatibility": "^9.3",
"phpmd/phpmd": "^2.9",
"phpstan/phpstan": "^1.10",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10",
"slevomat/coding-standard": "^8.9",
"szepeviktor/phpstan-wordpress": "^1.1",
"wp-coding-standards/wpcs": "^3.0.0"
Expand All @@ -13,9 +13,6 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
},
"platform": {
"php": "8.0"
}
}
}
Loading

0 comments on commit b041f6b

Please sign in to comment.