Skip to content

Commit fca7028

Browse files
committed
Added github workflow build.yml configuration
1 parent 5fbfebe commit fca7028

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

.github/workflows/build.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: build
2+
on: [push, pull_request]
3+
4+
jobs:
5+
full-build:
6+
runs-on: ${{ matrix.operating-system }}
7+
strategy:
8+
matrix:
9+
operating-system: [ubuntu-latest]
10+
php-versions: ["7.4"]
11+
env:
12+
extensions: pcov, dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
13+
key: cache-v2
14+
steps:
15+
- name: "Checkout"
16+
uses: actions/checkout@v2
17+
- name: "Setup PHP extensions cache environment"
18+
id: cache-env
19+
uses: shivammathur/cache-extensions@v1
20+
with:
21+
php-version: ${{ matrix.php-versions }}
22+
extensions: ${{ env.extensions }}
23+
key: ${{ env.key }}
24+
- name: "Cache PHP extensions"
25+
uses: actions/cache@v2
26+
with:
27+
path: ${{ steps.cache-env.outputs.dir }}
28+
key: ${{ steps.cache-env.outputs.key }}
29+
restore-keys: ${{ steps.cache-env.outputs.key }}
30+
- name: "Install PHP with extensions"
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php-versions }}
34+
coverage: pcov
35+
extensions: ${{ env.extensions }}
36+
ini-values: assert.exception=1, zend.assertions=1
37+
- name: "Validate composer.json"
38+
run: composer validate
39+
- name: "Set composer cache directory"
40+
id: composer-cache-full-build
41+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
- name: "Setup composer cache"
43+
uses: actions/cache@v2
44+
with:
45+
path: ${{ steps.composer-cache-full-build.outputs.dir }}
46+
key: ${{ runner.os }}-composer-full-${{ hashFiles('**/composer.json') }}
47+
restore-keys: ${{ runner.os }}-composer-full-
48+
- name: "Install highest dependencies"
49+
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable
50+
- name: "Coding standard Php-CS-Fixer checks"
51+
run: vendor/bin/php-cs-fixer --dry-run -v --config=cs-fixer.php.dist --path-mode=intersection fix src tests
52+
- name: "Coding standard CodeSniffer checks"
53+
run: |
54+
vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml src
55+
vendor/bin/phpcs --extensions=php --standard=vendor/polymorphine/dev/phpcs.xml --ignore=*/CodeSamples/* tests
56+
- name: "Run PhpUnit tests with coverage"
57+
run: |
58+
mkdir -p build/logs
59+
vendor/bin/phpunit --coverage-clover build/logs/clover.xml
60+
- name: "Send coverage report to coveralls.io"
61+
run: vendor/bin/php-coveralls -v
62+
env:
63+
COVERALLS_RUN_LOCALLY: 1
64+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
65+
66+
lowest-build:
67+
runs-on: ${{ matrix.operating-system }}
68+
strategy:
69+
matrix:
70+
operating-system: [ubuntu-latest]
71+
php-versions: ["7.4"]
72+
env:
73+
extensions: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter
74+
key: cache-v2
75+
steps:
76+
- name: "Checkout"
77+
uses: actions/checkout@v2
78+
- name: "Setup PHP extensions cache environment"
79+
id: cache-env
80+
uses: shivammathur/cache-extensions@v1
81+
with:
82+
php-version: ${{ matrix.php-versions }}
83+
extensions: ${{ env.extensions }}
84+
key: ${{ env.key }}
85+
- name: "Cache PHP extensions"
86+
uses: actions/cache@v2
87+
with:
88+
path: ${{ steps.cache-env.outputs.dir }}
89+
key: ${{ steps.cache-env.outputs.key }}
90+
restore-keys: ${{ steps.cache-env.outputs.key }}
91+
- name: "Install PHP with extensions"
92+
uses: shivammathur/setup-php@v2
93+
with:
94+
php-version: ${{ matrix.php-versions }}
95+
coverage: none
96+
extensions: ${{ env.extensions }}
97+
ini-values: assert.exception=1, zend.assertions=1
98+
- name: "Set composer cache directory"
99+
id: composer-cache-lowest-build
100+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
101+
- name: "Setup composer cache"
102+
uses: actions/cache@v2
103+
with:
104+
path: ${{ steps.composer-cache-lowest-build.outputs.dir }}
105+
key: ${{ runner.os }}-composer-low-${{ hashFiles('**/composer.json') }}
106+
restore-keys: ${{ runner.os }}-composer-low-
107+
- name: "Install lowest dependencies"
108+
run: composer update --no-interaction --no-ansi --no-progress --no-suggest --prefer-stable --prefer-lowest
109+
- name: "Run PhpUnit tests (no coverage)"
110+
run: vendor/bin/phpunit --no-coverage

0 commit comments

Comments
 (0)