Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to run checks on push and pr to main #35

Merged
merged 3 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/matchers/phpcs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"problemMatcher": [
{
"owner": "phpcs",
"fileLocation": "relative",
"pattern": [
{
"regexp": "^\"(.+)\",(\\d+),(\\d+),(.+),\"(.+)\",(.+),(\\d+),(\\d+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}
16 changes: 16 additions & 0 deletions .github/matchers/phplint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "phplint",
"fileLocation": "relative",
"pattern": [
{
"regexp": "^(.+)\\sin\\s(\\./.+\\.php)\\son\\sline\\s(\\d+)$",
"message": 1,
"file": 2,
"line": 3
}
]
}
]
}
25 changes: 25 additions & 0 deletions .github/matchers/phpunit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"problemMatcher": [
{
"owner": "phpunit",
"fileLocation": "absolute",
"pattern": [
{
"regexp": "^\\d+\\)\\s.*$"
},
{
"regexp": "^(.*)$",
"message": 1
},
{
"regexp": "^\\s*$"
},
{
"regexp": "^(.*):(\\d+)$",
"file": 1,
"line": 2
}
]
}
]
}
58 changes: 58 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
php-checks:
name: php checks
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: 7.2
extensions: mbstring

- name: Validate composer.json and composer.lock
run: composer validate

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
run: |
echo "::add-matcher::.github/matchers/phplint.json"
composer install --prefer-dist --no-progress

- name: Run checks
run: |
echo "::add-matcher::.github/matchers/phpcs.json"
echo "::add-matcher::.github/matchers/phpunit.json"

export PHPLINT_FLAGS="--no-progress"
export PHPCS_FLAGS="--report=csv -q"
export PHPSTAN_FLAGS="--no-progress"

composer check

echo "::remove-matcher owner=phpunit::"
echo "::remove-matcher owner=phpcs::"
echo "::remove-matcher owner=phplint::"
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Antilope
# Antilope

[![build][build-badge]][build-url] ![style][codestyle] ![phpstan][phpstan]

__Antilope__ is the name of this __Sharable Network Tracker__.

Expand Down Expand Up @@ -131,3 +133,8 @@ For now, the only way to install an Antilope app is via Symfony and `composer`.

bin/console doctrine:migrations:diff --db-configuration sqlite

<!-- long url references -->
[build-badge]:https://img.shields.io/github/workflow/status/vincent-peugnet/antilope/build/main
[build-url]:https://github.com/vincent-peugnet/antilope/actions?query=branch%3Amain++workflow%3Abuild
[codestyle]: https://img.shields.io/badge/code%20style-PSR12-brightgreen
[phpstan]: https://img.shields.io/badge/phpstan-level%205-green
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
},
"scripts": {
"auto-scripts": {
"parallel-lint src": "script",
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
Expand All @@ -110,12 +111,12 @@
"fix": [
"@phpcbf"
],
"lint": "parallel-lint --exclude app --exclude var --exclude vendor .",
"phpcs": "phpcs --runtime-set ignore_warnings_on_exit 1",
"lint": "parallel-lint $PHPLINT_FLAGS --exclude app --exclude var --exclude vendor .",
"phpcs": "phpcs $PHPCS_FLAGS --runtime-set ignore_warnings_on_exit 1",
"phpcbf": "phpcbf",
"phpstan": [
"@php bin/console cache:warmup -q",
"phpstan analyse --ansi"
"phpstan analyse $PHPSTAN_FLAGS --ansi"
],
"post-install-cmd": [
"@auto-scripts"
Expand Down