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 complex CI #3

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ insert_final_newline = true
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
block_comment_start = /*
block_comment = *
block_comment_end = */

[*.md]
trim_trailing_whitespace = false
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: "Integrate"

on:
push:
branches:
- "develop"
- "trunk"
pull_request: null

jobs:
byte_level:
name: "0️⃣ Byte-level"
runs-on: "ubuntu-20.04"
steps:
- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Check file permissions"
run: |
test "$(find . -type f -not -path './.git/*' -executable)" == ""

- name: "Find non-printable ASCII characters"
run: |
! LC_ALL=C.UTF-8 find . -type f -name "*.php" -print0 | xargs -0 -- grep -PHn "[^\t -~]"

syntax_errors:
name: "1️⃣ Syntax errors"
runs-on: "ubuntu-20.04"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.2"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- name: "Check source code for syntax errors"
run: "composer exec -- parallel-lint src/"

unit_tests:
name: "2️⃣ Unit and functional tests"
needs:
- "byte_level"
- "syntax_errors"
runs-on: "ubuntu-20.04"
strategy:
fail-fast: false
matrix:
php-version:
- "7.2"
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "highest"
- "lowest"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Execute unit tests"
run: "composer run test:phpunit"
# @TODO Functional tests

# - name: "Tests have failed: display logs"
# if: "${{ failure() }}"
# run: "cat storage/logs/*.log"

# - name: Send coverage to Coveralls
# if: "matrix.php-version == '8.1' && matrix.dependencies == 'highest'"
# env:
# COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# run: |
# wget "https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.2/php-coveralls.phar"
# php ./php-coveralls.phar -v

static_analysis:
name: "3️⃣ Static Analysis"
needs:
- "byte_level"
- "syntax_errors"
runs-on: "ubuntu-20.04"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Validate Composer configuration"
run: "composer validate --strict"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- name: "Execute static analysis"
run: "composer run test:phpstan"
# @TODO Magic Number Detector, Copy-Paste Detector

coding_standards:
name: "4️⃣ Coding Standards"
needs:
- "byte_level"
- "syntax_errors"
runs-on: "ubuntu-20.04"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"

- name: "Checkout code"
uses: "actions/checkout@v3"

- name: "Check adherence to EditorConfig"
uses: "greut/eclint-action@v0"

- name: "Install dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- name: "Check coding style"
run: "composer run test:phpcs"
49 changes: 0 additions & 49 deletions .github/workflows/tests.yml

This file was deleted.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ergebnis/composer-normalize": "^2.0",
"ergebnis/phpstan-rules": "^1.0",
"humanmade/coding-standards": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
Expand Down