Skip to content

Commit d6d86c1

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

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
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: [ '7.4', '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

0 commit comments

Comments
 (0)