Skip to content

Commit ccf6040

Browse files
committed
feat(ci): Github Actions workflow for automated CI.
1 parent 5e46e47 commit ccf6040

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
branches: [ "**" ]
8+
9+
jobs:
10+
tests:
11+
name: PHP Tests and Coverage
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.4'
22+
coverage: xdebug
23+
tools: composer
24+
ini-values: |
25+
memory_limit=1G
26+
error_reporting=E_ALL
27+
display_errors=On
28+
29+
- name: Cache Composer dependencies
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.composer/cache/files
34+
vendor
35+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-composer-
38+
39+
- name: Install dependencies
40+
run: composer install --no-interaction --prefer-dist --no-progress
41+
42+
- name: Run tests with coverage
43+
run: |
44+
mkdir -p coverage
45+
./vendor/bin/pest --coverage --coverage-clover=coverage/clover.xml
46+
47+
- name: Upload coverage artifact
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: coverage-php
51+
path: coverage/
52+
53+
- name: Upload coverage to Codecov
54+
uses: codecov/codecov-action@v4
55+
with:
56+
files: coverage/clover.xml
57+
flags: php
58+
fail_ci_if_error: true
59+
verbose: true
60+
env:
61+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)