Skip to content

Commit 8e9988b

Browse files
sreichelfballiano
andauthored
Updated github workflow (OpenMage#2608)
* Updated github workflows * Fixed sonar.yml * Test * Test ... * Minor changes * Minor changes * Cache dependencies * Remove --no-suggest * Test * Test * Remove continue on error for syntax check * Updated phpstan level to 3 (4 experimental) * Fixed phpstan-baseline.neon * Update phpstan-baseline.neon * Updated phpstan-baseline.neon - resolved conflicts * Updated phpstan-baseline.neon - again Co-authored-by: Fabrizio Balliano <fabrizio.balliano@gmail.com>
1 parent bab41d1 commit 8e9988b

11 files changed

+4035
-699
lines changed

.github/phpstan-baseline.neon

Lines changed: 3882 additions & 532 deletions
Large diffs are not rendered by default.

.github/phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ parameters:
4545
# Too much noise from "Variable $this might not be defined"
4646
- */app/code/core/*/*/data/*
4747
- */app/code/core/*/*/sql/*
48-
level: 2
48+
level: 3
4949
checkFunctionNameCase: true
5050
checkInternalClassCaseSensitivity: true
5151

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
includes:
22
- phpstan.neon
33
parameters:
4-
level: 3
4+
paths:
5+
- %currentWorkingDirectory%/app/code/core/Mage
6+
- %currentWorkingDirectory%/lib/Mage
7+
- %currentWorkingDirectory%/lib/Magento
8+
- %currentWorkingDirectory%/lib/Varien
9+
level: 4

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
triage:
14-
runs-on: ubuntu-latest
14+
runs-on: [ubuntu-latest]
1515
steps:
1616
- uses: actions/labeler@main
1717
with:

.github/workflows/phpstan.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "PHPStan Static Code Analyses"
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
paths-ignore:
11+
- '**.md'
12+
# Allow manually triggering the workflow.
13+
workflow_dispatch:
14+
15+
jobs:
16+
php_stan:
17+
runs-on: [ubuntu-latest]
18+
19+
strategy:
20+
matrix:
21+
config_files: [
22+
'.github/phpstan.neon',
23+
'.github/phpstan_experimental_level.neon'
24+
]
25+
26+
name: PHP Stan ${{ matrix.config_files }}
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v3
31+
32+
- name: Get composer cache directory
33+
id: composer-cache
34+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
35+
36+
- name: Cache dependencies
37+
uses: actions/cache@v2
38+
with:
39+
path: ${{ steps.composer-cache.outputs.dir }}
40+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
41+
restore-keys: ${{ runner.os }}-composer-
42+
43+
- name: Install dependencies
44+
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*
45+
46+
- name: ensure existance of ./app/code/local
47+
run: mkdir -p app/code/local
48+
49+
- name: PHPStan Static Analysis
50+
run: php vendor/bin/phpstan.phar analyze -c ${{ matrix.config_files }}
51+
continue-on-error: ${{ matrix.config_files == '.github/phpstan_experimental_level.neon' }}

.github/workflows/unit-tests.yml renamed to .github/workflows/phpunit.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
name: OpenMage LTS - Unit Tests
22

33
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
46
push:
7+
paths-ignore:
8+
- '**.md'
59
pull_request:
10+
paths-ignore:
11+
- '**.md'
12+
# Allow manually triggering the workflow.
13+
workflow_dispatch:
614

715
jobs:
816
unit-tests:
9-
10-
runs-on: ubuntu-latest
17+
runs-on: [ubuntu-latest]
1118

1219
steps:
1320
- uses: actions/checkout@v3

.github/workflows/sonar.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
name: OpenMage LTS - Sonar - Full Analyses
22

33
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
46
push:
7+
paths-ignore:
8+
- '**.md'
59
pull_request:
10+
paths-ignore:
11+
- '**.md'
612
types: [opened, synchronize, reopened]
713

8-
9-
1014
jobs:
1115
unit:
12-
name: Unit Tests on ${{ matrix.php-versions }}
13-
runs-on: ${{ matrix.operating-system }}
16+
name: Unit Tests on ${{ matrix.php }}
17+
runs-on: ${{ matrix.os }}
1418
strategy:
1519
max-parallel: 5
1620
matrix:
17-
operating-system: [ubuntu-latest]
18-
php-versions: ['7.4', '8.1']
21+
os: [ubuntu-latest]
22+
php: ['7.4', '8.1']
1923
steps:
2024
- uses: actions/checkout@v3
2125
- name: Setup PHP
2226
uses: shivammathur/setup-php@v2
2327
with:
24-
php-version: ${{ matrix.php-versions }}
28+
php-version: ${{ matrix.php }}
2529
extensions: mbstring
2630
tools: composer, pecl, phpcs, phpstan, phpunit:9.5
27-
ini-values-csv: pcov.directory=api, post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
31+
ini-values: pcov.directory=api, post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
2832
coverage: pcov #optional, setup coverage driver
2933
env:
3034
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -37,7 +41,7 @@ jobs:
3741
run: phpunit --configuration ./dev/phpunit.xml.dist --testsuite=Unit;
3842
- name: prepare SonarCloud Scan Data
3943
continue-on-error: true
40-
if: ${{ matrix.php-versions == '8.1' }}
44+
if: ${{ matrix.php == '8.1' }}
4145
run: |
4246
echo $PWD
4347
ls -la
@@ -49,7 +53,7 @@ jobs:
4953
- name: SonarCloud Scan
5054
uses: SonarSource/sonarcloud-github-action@master
5155
continue-on-error: true
52-
if: ${{ matrix.php-versions == '8.1' }} && SONAR_TOKEN
56+
if: ${{ matrix.php == '8.1' }} && SONAR_TOKEN
5357
with:
5458
args: >
5559
-Dproject.settings=dev/sonar-project.properties

.github/workflows/static-code-analyses.yml

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

.github/workflows/syntax-php.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "PHP Syntax Check"
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
paths-ignore:
11+
- '**.md'
12+
# Allow manually triggering the workflow.
13+
workflow_dispatch:
14+
15+
jobs:
16+
php_syntax:
17+
runs-on: [ubuntu-latest]
18+
19+
strategy:
20+
matrix:
21+
php: ['7.3', '8.1', '8.2']
22+
23+
name: PHP Syntax ${{ matrix.php }}
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v3
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
extensions: mbstring #optional, setup extensions
34+
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
35+
coverage: none #optional, setup coverage driver
36+
37+
- name: Check .php files
38+
run: '! find . -not \( -path ./.phpstorm.meta.php -prune \) -type f -name "*.php" -exec php -d error_reporting=32767 -l {} \; 2>&1 1> /dev/null | grep "^"'
39+
40+
- name: Check .phtml files
41+
run: '! find app/design -type f -name "*.phtml" -exec php -d error_reporting=32767 -l {} \; 2>&1 1> /dev/null | grep "^"'

.github/workflows/syntax-xml.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: XML Validation
2+
3+
on:
4+
# Run on all pushes and on all pull requests.
5+
# Prevent the build from running when there are only irrelevant changes.
6+
push:
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
paths-ignore:
11+
- '**.md'
12+
# Allow manually triggering the workflow.
13+
workflow_dispatch:
14+
15+
jobs:
16+
validate:
17+
runs-on: [ubuntu-latest]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Update APT repositories
24+
run: "sudo apt update"
25+
26+
- name: Install xmllint
27+
run: "sudo apt-get -y install libxml2-utils"
28+
29+
- name: Validate XMLs
30+
run: "find . -type f -iname '*.xml' | xargs -I '{}' xmllint --noout '{}'"

0 commit comments

Comments
 (0)