Replaces travis with github actions #6
Workflow file for this run
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: 'Static code analysis and tests' | |
concurrency: | |
group: code-analysis-and-tests-${{ github.ref_name }} | |
cancel-in-progress: true | |
on: ['push', 'pull_request', 'workflow_dispatch'] | |
env: | |
CLAMAV_SOCKET: '/tmp/clamd.socket' | |
CLAMAV_HOST: 127.0.0.1 | |
CLAMAV_PORT: 3310 | |
jobs: | |
static_code_analysis: | |
runs-on: 'ubuntu-22.04' | |
name: 'Static code analysis' | |
steps: | |
- name: 'Setup PHP' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Validate composer.json and composer.lock' | |
run: composer validate | |
- name: 'Install dependencies with Composer' | |
uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: 'highest' | |
composer-options: '--prefer-dist' | |
- name: 'Check PHP coding standards' | |
run: php vendor/bin/phpcs -np --standard=PSR2 --ignore=vendor/,tests/,var/ ./ | |
phpunit: | |
needs: [ static_code_analysis ] | |
runs-on: 'ubuntu-22.04' | |
name: 'PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}' | |
timeout-minutes: 30 | |
continue-on-error: true | |
strategy: | |
matrix: | |
php: ['7.3', '8.1', '8.2', '8.3'] | |
symfony: ['~5.0', '~6.0', '~7.0'] | |
dependencies: | |
- 'highest' | |
exclude: | |
- php: '7.3' | |
symfony: '~6.0' | |
- php: '7.3' | |
symfony: '~7.0' | |
- php: '8.1' | |
symfony: '~7.0' | |
fail-fast: false | |
steps: | |
- name: 'Start ClamAV daemon (clamd)' | |
uses: toblux/start-clamd-github-action@v0.2 | |
with: | |
unix_socket: $CLAMAV_SOCKET | |
tcp_port: $CLAMAV_PORT | |
stream_max_length: 1M | |
db_main: true | |
db_daily: true | |
- name: 'Ping clamd on TCP port $CLAMAV_PORT' | |
run: echo PING | nc $CLAMAV_HOST $CLAMAV_PORT | |
- name: 'Ping clamd using the Unix socket' | |
run: echo PING | nc -U $CLAMAV_SOCKET | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Setup PHP' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '${{ matrix.php }}' | |
coverage: 'pcov' | |
tools: 'composer:v2' | |
extensions: 'sockets' | |
- name: 'Fix symfony/framework-bundle version' | |
run: composer require --no-update symfony/framework-bundle:${{ matrix.symfony }} | |
- name: 'Install dependencies with Composer' | |
uses: ramsey/composer-install@v3 | |
with: | |
dependency-versions: '${{ matrix.dependencies }}' | |
composer-options: '--prefer-dist' | |
- name: 'Dump composer autoloader' | |
run: composer dump-autoload --classmap-authoritative --no-ansi --no-interaction --no-scripts | |
- name: 'Run phpunit tests' | |
run: | | |
vendor/bin/phpunit --coverage-clover=tests/build/clover.xml 2>/dev/null | |
- name: 'Upload coverage results to Coveralls' | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} | |
run: | | |
vendor/bin/php-coveralls --coverage_clover=tests/build/clover.xml --json_path=tests/build/coveralls.json -v |