fix: only throw exception on negative error code #2499
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: Fireping CI/CD | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
DATABASE_URL: mysql://[email protected]:3306/fireping_test | |
RRDCACHED_TEST: 127.0.0.1:42217 | |
XDEBUG_MODE: coverage | |
SYMFONY_DEPRECATIONS_HELPER: max[direct]=0 | |
jobs: | |
symfony: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php-versions: ['8.1', '8.2'] | |
services: | |
# https://docs.docker.com/samples/library/mysql/ | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: fireping_test | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Install packages | |
run: sudo apt-get install librrd-dev rrdtool fping | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, intl, rrd | |
coverage: pcov | |
tools: pecl | |
- name: Start Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: 6 | |
- name: Start rrdcached | |
run: docker run -d -p 127.0.0.1:42217:42217 --name rrdcached -v /tmp/fireping/rrd:/data/db -e TZ="Europe/Paris" -e PUID=$(id -u $(whoami)) -e PGID=$(id -g $(whoami)) crazymax/rrdcached | |
- name: Install symfony | |
run: export PATH="$HOME/.symfony/bin:$PATH" ; if symfony self:version; then symfony self:update --yes ; else wget https://get.symfony.com/cli/installer -O - | bash ; fi | |
- uses: actions/checkout@v2 | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v2 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --prefer-dist --no-progress | |
- name: Dump Autoload (composer) | |
run: composer dump-autoload --optimize | |
- name: Create folders | |
run: mkdir build | |
- name: Run phpstan | |
run: composer phpstan | |
- name: Lint yaml | |
run: ./bin/console lint:yaml config --parse-tags | |
- name: Lint container | |
run: ./bin/console lint:container | |
- name: Set up Symfony path | |
run: export PATH="$HOME/.symfony5/bin:$PATH" | |
- name: Check Symfony Security | |
id: security_check | |
run: symfony check:security || echo "::warning::Security check failed" | |
- name: Continue execution | |
if: ${{ steps.security_check.outcome == 'success' }} | |
run: echo "Security check succeeded" | |
- name: Check doctrine mapping | |
run: ./bin/console doctrine:schema:validate --skip-sync -vvv --no-interaction | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Run phpunit | |
run: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: artifact | |
path: ./var/log/test.log | |
- name: Upload coverage results to Coveralls | |
if: ${{ matrix.php-versions == '8.2' }} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require php-coveralls/php-coveralls | |
php-coveralls --coverage_clover=build/logs/clover.xml -v |