Skip to content

Commit 5c19f5d

Browse files
committed
Github Actions
1 parent 40ea7ac commit 5c19f5d

File tree

4 files changed

+176
-0
lines changed

4 files changed

+176
-0
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Coding Standards"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*.x"
7+
- "main"
8+
push:
9+
branches:
10+
- "*.x"
11+
- "main"
12+
13+
jobs:
14+
coding-standards:
15+
name: "Coding Standards"
16+
uses: "doctrine/.github/.github/workflows/[email protected]"
17+
with:
18+
php-version: '8.0'
19+
composer-options: '--prefer-dist --ignore-platform-req=php'
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*.x"
7+
- "main"
8+
push:
9+
branches:
10+
- "*.x"
11+
- "main"
12+
13+
jobs:
14+
phpunit:
15+
name: "PHPUnit"
16+
runs-on: "ubuntu-20.04"
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php-version:
22+
- "8.0"
23+
- "8.1"
24+
dependencies:
25+
- "highest"
26+
optional-dependencies:
27+
- true
28+
- false
29+
include:
30+
- php-version: "8.0"
31+
dependencies: "lowest"
32+
optional-dependencies: false
33+
- php-version: "8.0"
34+
dependencies: "lowest"
35+
optional-dependencies: true
36+
37+
steps:
38+
- name: "Checkout"
39+
uses: "actions/checkout@v2"
40+
with:
41+
fetch-depth: 2
42+
43+
- name: "Install PHP"
44+
uses: "shivammathur/setup-php@v2"
45+
with:
46+
php-version: "${{ matrix.php-version }}"
47+
coverage: "pcov"
48+
ini-values: "zend.assertions=1"
49+
extensions: "pdo_mysql"
50+
51+
- name: "Install dependencies with Composer"
52+
uses: "ramsey/composer-install@v1"
53+
if: "! startsWith(matrix.php-version, '8')"
54+
with:
55+
dependency-versions: "${{ matrix.dependencies }}"
56+
composer-options: "--prefer-dist --no-suggest"
57+
58+
- name: "Install dependencies with Composer (--ignore-platform-req=php)"
59+
uses: "ramsey/composer-install@v1"
60+
if: "startsWith(matrix.php-version, '8')"
61+
with:
62+
dependency-versions: "${{ matrix.dependencies }}"
63+
composer-options: "--prefer-dist --no-suggest --ignore-platform-req=php"
64+
65+
- name: "Run PHPUnit"
66+
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
67+
68+
- name: "Upload coverage file"
69+
uses: "actions/upload-artifact@v2"
70+
with:
71+
name: "phpunit-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ matrix.dbal-version }}.coverage"
72+
path: "coverage.xml"
73+
74+
upload_coverage:
75+
name: "Upload coverage to Codecov"
76+
runs-on: "ubuntu-20.04"
77+
needs:
78+
- "phpunit"
79+
80+
steps:
81+
- name: "Checkout"
82+
uses: "actions/checkout@v2"
83+
with:
84+
fetch-depth: 2
85+
86+
- name: "Download coverage files"
87+
uses: "actions/download-artifact@v2"
88+
with:
89+
path: "reports"
90+
91+
- name: "Upload to Codecov"
92+
uses: "codecov/codecov-action@v2"
93+
with:
94+
directory: "reports"

.github/workflows/php.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Validate composer.json and composer.lock
18+
run: composer validate --strict
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v2
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-php-
28+
29+
- name: Install dependencies
30+
run: composer install --prefer-dist --no-progress
31+
32+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
33+
# Docs: https://getcomposer.org/doc/articles/scripts.md
34+
35+
# - name: Run test suite
36+
# run: composer run-script test

.github/workflows/static-analysis.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Static analysis"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*.x"
7+
- "main"
8+
push:
9+
branches:
10+
- "*.x"
11+
- "main"
12+
13+
jobs:
14+
psalm:
15+
name: "Static Analysis"
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
20+
with:
21+
php-version: '8.0'
22+
- uses: actions/checkout@v2
23+
- name: Install Dependencies
24+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
25+
- name: Execute tests (Unit and Feature tests) via PHPUnit
26+
run: vendor/bin/psalm

0 commit comments

Comments
 (0)