Merge pull request #83 from Icinga/chore/more-tests #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP Tests | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- main | |
- release/* | |
jobs: | |
lint: | |
name: Lint and Code Style | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.2', '8.3'] | |
os: ['ubuntu-latest'] | |
steps: | |
- name: Checkout code base | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: phpcs | |
- name: Setup dependencies | |
run: composer require -n --no-progress overtrue/phplint | |
- name: PHP Lint | |
if: success() || matrix.allow_failure | |
run: ./vendor/bin/phplint -n --exclude={^vendor/.*} -- . | |
- name: PHP CodeSniffer | |
if: success() || matrix.allow_failure | |
run: phpcs -wps --colors | |
test: | |
name: Unittest | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.2', '8.3'] | |
os: ['ubuntu-latest'] | |
steps: | |
- name: Checkout code base | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: 'phpunit:10.4' | |
- name: Setup Libraries | |
run: | | |
mkdir -p _libraries | |
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git _libraries/ipl | |
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git _libraries/vendor | |
git clone --depth 1 https://github.com/Icinga/icingaweb2.git _icingaweb2 | |
git clone --depth 1 https://github.com/Icinga/icingadb-web.git _icingaweb2/modules/icingadb | |
ln -s `pwd` _icingaweb2/modules/toplevelview | |
- name: PHPUnit | |
env: | |
ICINGAWEB_LIBDIR: _libraries/ | |
run: phpunit |