Skip to content

Commit 5ebebea

Browse files
committed
cicd: Add badge and tests workflow
1 parent c727dda commit 5ebebea

File tree

5 files changed

+331
-502
lines changed

5 files changed

+331
-502
lines changed

.github/workflows/badges.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Badges
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
tests:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
php: [ '8.4' ]
20+
wp_version: [ 'latest' ]
21+
22+
name: PHP ${{ matrix.php }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
tools: composer:v2
33+
coverage: pcov
34+
35+
- name: Install PHP dependencies
36+
run: composer update --prefer-stable --no-interaction --no-progress --ansi
37+
38+
- name: Setup WordPress
39+
run: composer run-script setup:wp:${{ matrix.wp_version }}
40+
41+
- name: Code coverage
42+
run: composer run-script test:coverage
43+
44+
- name: Upload coverage reports to Codecov
45+
uses: codecov/codecov-action@v5
46+
with:
47+
directory: tests/coverage
48+
files: tests/coverage/clover.xml
49+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
tests:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: true
18+
matrix:
19+
php: [ '8.1', '8.4' ]
20+
wp_version: [ 'latest' ]
21+
22+
name: PHP ${{ matrix.php }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
tools: composer:v2
33+
coverage: pcov
34+
35+
- name: Install PHP dependencies
36+
run: composer update --prefer-stable --no-interaction --no-progress --ansi
37+
38+
- name: Setup WordPress
39+
run: composer run-script setup:wp:${{ matrix.wp_version }}
40+
41+
- name: Run test suite
42+
run: composer run-script test

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}
2727
},
2828
"require": {
29-
"php": "^7.4|^8.0"
29+
"php": "^8.1"
3030
},
3131
"require-dev": {
3232
"mockery/mockery": "^1.6",
@@ -45,7 +45,7 @@
4545
"setup:wp:6.4": "rm -rf wp/ && ./vendor/bin/wp-pest setup plugin --plugin-slug fastendpoints --wp-version 6.4.4 --skip-delete --no-interaction",
4646
"setup:wp:latest": "rm -rf wp/ && ./vendor/bin/wp-pest setup plugin --plugin-slug fastendpoints --skip-delete --no-interaction",
4747
"test:lint": "./vendor/bin/pint --test",
48-
"test:coverage": "./vendor/bin/pest --coverage",
48+
"test:coverage": "./vendor/bin/pest --coverage --exclude-group=integration",
4949
"test:unit": "./vendor/bin/pest --colors=always --exclude-group=integration",
5050
"test:integration": "./vendor/bin/pest --colors=always --group=integration",
5151
"test": [

0 commit comments

Comments
 (0)