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