Skip to content

Commit

Permalink
Replaces travis with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pmishev committed Apr 6, 2024
1 parent c3dfbbb commit e7f8d70
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 58 deletions.
3 changes: 0 additions & 3 deletions .coveralls.yml

This file was deleted.

106 changes: 106 additions & 0 deletions .github/workflows/code_style_and_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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/[email protected]
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
54 changes: 0 additions & 54 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This library is a PHP client for working with a ClamAV daemon. It also provides optional Symfony integration.

[![Build Status](https://app.travis-ci.com/sineflow/clamav.svg?branch=master)](https://app.travis-ci.com/github/sineflow/clamav)
![Workflow status](https://github.com/sineflow/clamav/actions/workflows/code_style_and_tests.yml/badge.svg)

# Requirements:

Expand Down

0 comments on commit e7f8d70

Please sign in to comment.