Skip to content

Commit c3f2618

Browse files
authored
Update CI (#9)
1 parent 6d56ad2 commit c3f2618

5 files changed

Lines changed: 156 additions & 43 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'main'
8+
9+
jobs:
10+
composer-validate:
11+
runs-on: ubuntu-latest
12+
name: "Composer Validate"
13+
steps:
14+
- name: 'Checkout Code'
15+
uses: actions/checkout@v2
16+
17+
- name: 'Validate composer.json'
18+
run: composer validate --no-check-all --strict --no-check-lock
19+
20+
composer-install:
21+
needs: composer-validate
22+
runs-on: ubuntu-latest
23+
name: "Composer Install"
24+
steps:
25+
- name: 'Checkout Code'
26+
uses: actions/checkout@v2
27+
28+
- name: 'Install Dependencies'
29+
run: composer install --prefer-dist --no-progress --no-interaction
30+
31+
code-style:
32+
needs: composer-install
33+
runs-on: ubuntu-latest
34+
name: "Code Style"
35+
strategy:
36+
fail-fast: false
37+
steps:
38+
- name: 'Checkout Code'
39+
uses: actions/checkout@v2
40+
41+
- name: 'Setup PHP'
42+
uses: shivammathur/setup-php@v2
43+
with:
44+
php-version: 8.0
45+
ini-values: memory_limit=-1
46+
coverage: none
47+
tools: composer:v2
48+
49+
- name: 'Install PHP dependencies with Composer'
50+
run: composer install --prefer-dist --no-progress --optimize-autoloader
51+
working-directory: './'
52+
53+
- name: 'Run CodeSniffer'
54+
run: ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=phpcs.xml
55+
56+
static-analysis:
57+
needs: composer-install
58+
runs-on: ubuntu-latest
59+
name: "Static Analysis"
60+
strategy:
61+
fail-fast: false
62+
steps:
63+
- name: 'Checkout Code'
64+
uses: actions/checkout@v2
65+
66+
- name: 'Setup PHP'
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
php-version: 8.0
70+
ini-values: memory_limit=-1
71+
coverage: none
72+
tools: composer:v2
73+
74+
- name: 'Install PHP dependencies with Composer'
75+
run: composer install --prefer-dist --no-progress --optimize-autoloader
76+
working-directory: './'
77+
78+
- name: 'Run PHPStan'
79+
run: ./vendor/bin/phpstan analyse --no-progress -c phpstan.neon ./
80+
81+
test:
82+
needs: composer-install
83+
runs-on: ubuntu-latest
84+
name: "Tests (PHP ${{ matrix.php-version }})"
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
php-version:
89+
- '7.3'
90+
- '7.4'
91+
- '8.0'
92+
steps:
93+
- name: 'Checkout Code'
94+
uses: actions/checkout@v2
95+
96+
- name: 'Setup PHP'
97+
uses: shivammathur/setup-php@v2
98+
with:
99+
php-version: ${{ matrix.php-version }}
100+
ini-values: memory_limit=-1
101+
coverage: none
102+
tools: composer:v2
103+
104+
- name: 'Install PHP dependencies with Composer'
105+
run: composer install --prefer-dist --no-progress --optimize-autoloader
106+
working-directory: './'
107+
108+
- name: 'Run PHPUnit'
109+
run: ./vendor/bin/phpunit -v -c phpunit.xml.dist
110+
111+
code-coverage:
112+
needs: test
113+
runs-on: ubuntu-latest
114+
name: "Code Coverage"
115+
strategy:
116+
fail-fast: false
117+
steps:
118+
- name: 'Checkout Code'
119+
uses: actions/checkout@v2
120+
121+
- name: 'Setup PHP'
122+
uses: shivammathur/setup-php@v2
123+
with:
124+
php-version: 7.4
125+
ini-values: memory_limit=-1
126+
coverage: pcov
127+
tools: composer:v2
128+
129+
- name: 'Install PHP dependencies with Composer'
130+
run: composer install --prefer-dist --no-progress --optimize-autoloader
131+
working-directory: './'
132+
133+
- name: 'Run PHPUnit with Code Coverage'
134+
run: ./vendor/bin/phpunit -v -c phpunit.xml.dist --coverage-clover=coverage.xml
135+
136+
- name: 'Download Coverage Files'
137+
uses: actions/download-artifact@v2
138+
with:
139+
path: reports
140+
141+
- name: 'Upload to Codecov'
142+
uses: codecov/codecov-action@v1
143+
with:
144+
files: ./coverage.xml
145+
fail_ci_if_error: true
146+
verbose: true

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
🕒 📅 🐘 PHP library that provides additional functions for processing dates & times.
44

55
[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/fre5h/datetime-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/fre5h/datetime-php/)
6-
[![Build Status](https://img.shields.io/travis/fre5h/datetime-php/master.svg?style=flat-square)](https://travis-ci.com/fre5h/datetime-php)
6+
[![Build Status](https://img.shields.io/github/workflow/status/fre5h/datetime-php/CI/main?style=flat-square)](https://github.com/fre5h/datetime-php/actions?query=workflow%3ACI+branch%3Amain+)
77
[![CodeCov](https://img.shields.io/codecov/c/github/fre5h/datetime-php.svg?style=flat-square)](https://codecov.io/github/fre5h/datetime-php)
88
[![License](https://img.shields.io/packagist/l/fresh/datetime.svg?style=flat-square)](https://packagist.org/packages/fresh/datetime)
99
[![Latest Stable Version](https://img.shields.io/packagist/v/fresh/datetime.svg?style=flat-square)](https://packagist.org/packages/fresh/datetime)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"php": ">=7.3.0"
2121
},
2222
"require-dev": {
23-
"friendsofphp/php-cs-fixer": "^2.16",
23+
"friendsofphp/php-cs-fixer": "^2.18",
2424
"phpstan/phpstan": "^0.12",
2525
"phpstan/phpstan-phpunit": "^0.12",
2626
"phpunit/phpunit": "^9.5",

phpunit.xml.dist

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
</testsuite>
1212
</testsuites>
1313

14-
<filter>
15-
<whitelist>
16-
<directory>./src/</directory>
17-
<exclude>
18-
<file>./src/TimeConstants.php</file>
19-
</exclude>
20-
</whitelist>
21-
</filter>
14+
<coverage includeUncoveredFiles="false">
15+
<include>
16+
<directory suffix=".php">./src/</directory>
17+
</include>
18+
<exclude>
19+
<file>./src/TimeConstants.php</file>
20+
</exclude>
21+
</coverage>
2222
</phpunit>

0 commit comments

Comments
 (0)