Skip to content

Commit 70def2a

Browse files
authored
Merge pull request #94 from brefphp/v2
2 parents 984aac6 + 2598c91 commit 70def2a

File tree

100 files changed

+1791
-9659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1791
-9659
lines changed

.codespellrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[codespell]
2+
skip=./.git
3+
check-hidden=
4+
check-filenames=
5+
builtin=clear,rare,informal,usage,code,names
6+
ignore-words-list=master,iam

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
block_comment_start = /*
11+
block_comment = *
12+
block_comment_end = */
13+
14+
[*.md]
15+
indent_size = unset
16+
trim_trailing_whitespace = false
17+
18+
[*.yml]
19+
indent_size = 2

.gitattributes

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Do not export those files in the Composer archive (lighter dependency)
2-
tests/ export-ignore
1+
* text=auto eol=lf
2+
3+
/.github export-ignore
4+
/examples export-ignore
5+
.codespellrc export-ignore
6+
.editorconfig export-ignore
37
.gitattributes export-ignore
48
.gitignore export-ignore
5-
.phpcs.xml.dist export-ignore
6-
phpunit.xml.dist export-ignore
7-
phpstan.neon.dist export-ignore
8-
9-
# Auto detect text files and perform LF normalization
10-
* text=auto
9+
CHANGELOG.md export-ignore
10+
phpcs.xml.dist export-ignore

.github/FUNDING.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Linters
2+
3+
on:
4+
pull_request: null
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: "${{ github.workflow }}-${{ github.ref }}"
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
spelling:
19+
name: Spell check
20+
runs-on: ubuntu-22.04
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
26+
- name: Cache pip
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.cache/pip
30+
key: "${{ runner.os }}-pip-codespell"
31+
32+
- name: Install codespell
33+
run: |
34+
pip install --user 'codespell>=2.2'
35+
36+
- name: Search for misspellings
37+
run: |
38+
"$(python -m site --user-base)/bin/codespell"

.github/workflows/static.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
2+
3+
name: "Tests"
4+
5+
on:
6+
pull_request: null
7+
push:
8+
branches:
9+
- "main"
10+
11+
permissions:
12+
contents: "read"
13+
14+
concurrency:
15+
group: "${{ github.workflow }}-${{ github.ref }}"
16+
cancel-in-progress: true
17+
18+
jobs:
19+
20+
byte_level:
21+
name: "Byte-level"
22+
runs-on: "ubuntu-22.04"
23+
steps:
24+
- name: "Checkout repository"
25+
uses: "actions/checkout@v3"
26+
27+
- name: "Check file permissions"
28+
run: |
29+
test "$(find . -type f -not -path './.git/*' -executable)" = ""
30+
31+
- name: "Find non-printable ASCII characters"
32+
run: |
33+
! LC_ALL=C.UTF-8 find . -type f -name '*.php' -print0 | xargs -0 -- grep -PHn '[^ -~]'
34+
35+
syntax_errors:
36+
name: "Syntax errors"
37+
runs-on: "ubuntu-22.04"
38+
steps:
39+
- name: "Set up PHP"
40+
uses: "shivammathur/setup-php@v2"
41+
with:
42+
php-version: "8.0"
43+
coverage: "none"
44+
45+
- name: "Checkout repository"
46+
uses: "actions/checkout@v3"
47+
48+
- name: "Install dependencies"
49+
uses: "ramsey/composer-install@v2"
50+
with:
51+
dependency-versions: "highest"
52+
53+
- name: "Check source code for syntax errors"
54+
run: "composer exec -- parallel-lint src/ config/ stubs/"
55+
56+
unit_tests:
57+
name: "Unit and functional tests"
58+
needs:
59+
- "byte_level"
60+
- "syntax_errors"
61+
strategy:
62+
matrix:
63+
php-version:
64+
- "8.0"
65+
- "8.1"
66+
- "8.2"
67+
dependencies:
68+
- "lowest"
69+
- "highest"
70+
runs-on: "ubuntu-22.04"
71+
72+
steps:
73+
- name: "Set up PHP"
74+
uses: "shivammathur/setup-php@v2"
75+
with:
76+
php-version: "${{ matrix.php-version }}"
77+
78+
- name: "Checkout repository"
79+
uses: "actions/checkout@v3"
80+
81+
- name: "Install dependencies"
82+
uses: "ramsey/composer-install@v2"
83+
with:
84+
dependency-versions: "${{ matrix.dependencies }}"
85+
86+
- name: "Execute unit tests"
87+
run: "composer exec -- phpunit -v || true"
88+
89+
static_analysis:
90+
name: "Static Analysis"
91+
needs:
92+
- "byte_level"
93+
- "syntax_errors"
94+
runs-on: "ubuntu-22.04"
95+
96+
steps:
97+
- name: "Set up PHP"
98+
uses: "shivammathur/setup-php@v2"
99+
with:
100+
php-version: "8.0"
101+
coverage: "none"
102+
103+
- name: "Checkout repository"
104+
uses: "actions/checkout@v3"
105+
106+
- name: "Check JSON files"
107+
run: |
108+
find . -type f -name '*.json' | xargs -t -L 1 -- php -r 'json_decode(file_get_contents($argv[1]), null, 512, JSON_THROW_ON_ERROR);'
109+
110+
- name: "Validate Composer configuration"
111+
run: "composer validate --no-interaction --strict"
112+
113+
- name: "Install dependencies"
114+
uses: "ramsey/composer-install@v2"
115+
with:
116+
dependency-versions: "highest"
117+
118+
- name: "Check PSR-4 mapping"
119+
run: "composer dump-autoload --no-interaction --optimize --strict-psr"
120+
121+
- name: "Perform static analysis"
122+
run: "composer exec -- phpstan analyze -c vendor/nunomaduro/larastan/extension.neon -l 5 src/ stubs/"
123+
124+
coding_standards:
125+
name: "Coding Standards"
126+
needs:
127+
- "byte_level"
128+
- "syntax_errors"
129+
runs-on: "ubuntu-22.04"
130+
131+
steps:
132+
- name: "Set up PHP"
133+
uses: "shivammathur/setup-php@v2"
134+
with:
135+
php-version: "8.0"
136+
coverage: "none"
137+
138+
- name: "Checkout repository"
139+
uses: "actions/checkout@v3"
140+
141+
- name: "Check EditorConfig configuration"
142+
run: "test -f .editorconfig"
143+
144+
- name: "Check adherence to EditorConfig"
145+
uses: "greut/eclint-action@v0"
146+
147+
- name: "Install dependencies"
148+
uses: "ramsey/composer-install@v2"
149+
with:
150+
dependency-versions: "highest"
151+
152+
- name: "Check coding style"
153+
run: "composer exec -- phpcs -s src/ stubs/"
154+
155+
# Move TODO-s into GitHub issues!
156+
- name: "Search for TODO-s and FIXME-s"
157+
run: |
158+
! git grep --extended-regexp --ignore-case '\b(TODO|FIXME)\b' -- ':/' ':!*/test\.yml'
159+
160+
exported_files:
161+
name: "Exported files"
162+
needs:
163+
- "byte_level"
164+
- "syntax_errors"
165+
runs-on: "ubuntu-22.04"
166+
167+
steps:
168+
- name: "Checkout repository"
169+
uses: "actions/checkout@v3"
170+
171+
- name: "Check exported files"
172+
run: |
173+
EXPECTED="LICENSE,README.md,composer.json"
174+
CURRENT="$(git archive HEAD | tar --list --exclude="src" --exclude="src/*" --exclude="config" --exclude="config/*" --exclude="stubs" --exclude="stubs/*" | paste --serial --delimiters=",")"
175+
echo "CURRENT =${CURRENT}"
176+
echo "EXPECTED=${EXPECTED}"
177+
test "${CURRENT}" = "${EXPECTED}"

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
/vendor
2-
/.idea
3-
/.phpcs-cache
42
/composer.lock
5-
.DS_Store
6-
.phpunit.result.cache

.phpcs.xml.dist

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)