-
Notifications
You must be signed in to change notification settings - Fork 5
140 lines (121 loc) · 5.02 KB
/
build.ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Continuous Integration
on:
push:
tags-ignore:
- "**"
branches:
- "**"
paths-ignore:
- "**.md"
- ".github/**"
- "examples/**"
- "make/**"
pull_request:
types:
- opened
branches:
- "master"
workflow_dispatch:
env:
VALIDATORURL: https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip
VALIDATORSCENARIOURL: https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2024-10-31/validator-configuration-xrechnung_3.0.2_2024-10-31.zip
VALIDATORPATH: build/validator
VALIDATORZIPFILENAME: validator.zip
VALIDATORSCENARIOZIPFILENAME: validator-configuration.zip
VALIDATORJARFILENAME: validationtool-1.5.0-standalone.jar
VALIDATORSCENARIOFILENAME: scenarios.xml
PHPDOCUMENTORURL: https://phpdoc.org/phpDocumentor.phar
PHPDOCUMENTORFILENAME: phpDocumentor.phar
VERAPDFURL: https://software.verapdf.org/rel/verapdf-installer.zip
VERAPDFPATH: build/verapdf
VERAPDFZIPFILENAME: verapdf.zip
jobs:
build:
permissions: write-all
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ["ubuntu-22.04", "ubuntu-24.04"]
phpversion: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.phpversion }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, gd, exif, iconv, imagick, json, xdebug
coverage: xdebug
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.phpversion }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.phpversion }}-composer-
- name: Install composer dependencies
run: |
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer install
- name: Prepare Directories
run: |
mkdir build/builddoc
mkdir build/doc
mkdir build/coverage
mkdir build/coverage-html
mkdir build/logs
mkdir build/pdepend
mkdir build/dist
mkdir build/phpdoc
- name: Run Lint
run: |
for afile in $(find . -type f -name '*.php' -path './src*/*' -print); do
php -l $afile
done
for afile in $(find . -type f -name '*.php' -path './tests*/*' -print); do
php -l $afile
done
- name: Run PHPLOC
continue-on-error: true
run: |
vendor/bin/phploc --count-tests --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src tests
- name: Run PDEPEND
continue-on-error: true
run: |
vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --jdepend-chart=build/pdepend/dependencies.svg --overview-pyramid=build/pdepend/overview-pyramid.svg src
- name: Run PHPMD
continue-on-error: true
run: |
vendor/bin/phpmd src xml build/phpmd.xml --reportfile build/logs/pmd.xml --exclude src/entities/
vendor/bin/phpmd src github build/phpmd.xml --exclude src/entities/
- name: Run PHPCS
continue-on-error: true
run: |
vendor/bin/phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=build/phpcsrules.xml --extensions=php --ignore=autoload.php src tests
- name: Run PHPSTAN
continue-on-error: true
run: |
vendor/bin/phpstan analyze -c build/phpstan.neon --autoload-file=vendor/autoload.php --no-interaction --no-progress --error-format=checkstyle > build/logs/checkstyle_phpstan.xml
- name: Run PHPCPD
continue-on-error: true
run: |
vendor/bin/phpcpd --log-pmd build/logs/pmd-cpd.xml --exclude src/entities/ src
- name: Run Tests (PHPUnit)
run: |
vendor/bin/phpunit --stop-on-failure --configuration build/phpunit.xml
env:
XDEBUG_MODE: coverage
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: github.event_name != 'pull_request'
with:
files: "build/logs/junit.xml"
comment_mode: ${{ ((github.event.workflow_run && github.event.workflow_run.event == 'pull_request') || github.event_name == 'pull_request') && 'failures' || 'always' }}
- name: Publish Build Logs
uses: actions/upload-artifact@v4
with:
name: Build log artifacts for ${{ matrix.operating-system }} PHP ${{ matrix.phpversion }}
path: build/logs