Skip to content

Commit

Permalink
Merge 9bc2c9c into 102fec1
Browse files Browse the repository at this point in the history
  • Loading branch information
coldacid committed Nov 3, 2022
2 parents 102fec1 + 9bc2c9c commit 9a37ea7
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 11 deletions.
51 changes: 48 additions & 3 deletions .github/workflows/unit-tests.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit Tests
name: CI

on:
push:
Expand All @@ -7,8 +7,8 @@ on:
branches: [ master ]

jobs:
phpunit-tests:
name: PHPUnit tests
phpunit:
name: PHPUnit
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -71,3 +71,48 @@ jobs:
with:
name: Test results
path: test-results

phpstan:
name: PHPStan
runs-on: ubuntu-latest

steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2

# Install Composer dependencies
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys:
${{ runner.os }}-composer-

- name: Install dependencies
uses: php-actions/composer@v6
with:
working_dir: PodcastGenerator
php_version: "8.0"
php_extensions: gettext xdebug

# For some reason output from the phpunt step doesn't overwrite the
# output.log from the composer step? Also, for some reason phpunit runs as
# root, which leads to unwanted permissions for the test-results dir, so
# we need to create it ourselves first
- run: |
rm -f PodcastGenerator/output.log
mkdir test-results
# Run PHPStan
- name: PHPStan
uses: php-actions/phpstan@v2
with:
php_version: "8.0"
php_extensions: gettext xdebug
configuration: phpstan.dist.neon
memory_limit: 512M
error_format: github
args: --no-progress
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"neilbrayfield.php-docblocker",
"mehedidracula.php-namespace-resolver",
"obliviousharmony.vscode-php-codesniffer",
"recca0120.vscode-phpunit"
"renandelmonico.vscode-php-test-explorer",
"sanderronde.phpstan-vscode"
]
}
13 changes: 9 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"composer.workingPath": "PodcastGenerator/composer.json",
"cSpell.words": [
"phpcs"
],
"phpCodeSniffer.autoExecutable": true,
"phpCodeSniffer.exclude": [
"**/vendor/**",
"tests/coverage/**"
],
"phpCodeSniffer.standard": "Default",
"phpCodeSniffer.executable": "PodcastGenerator/vendor/bin/phpcs",
"phpunit.logpanel": true
"phpstan.binPath": "PodcastGenerator/vendor/bin/phpstan",
"phpstan.configFile": "phpstan.dist.neon",
"phpunit.logpanel": true,
"spellchecker.ignoreWordsList": [
"phpcs",
"PodcastGenerator",
"analyse",
"excludePaths"
]
}
3 changes: 2 additions & 1 deletion PodcastGenerator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"phpunit/phpunit": "^9.5",
"phpunit/php-code-coverage": "^9.2",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2"
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"phpstan/phpstan": "^1.8"
},
"config": {
"allow-plugins": {
Expand Down
63 changes: 61 additions & 2 deletions PodcastGenerator/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
parameters:
level: 5
paths:
- PodcastGenerator
- tests
excludePaths:
analyse:
- PodcastGenerator/vendor
ignoreErrors:
- '#Variable \$(config|version) might not be defined.#'
-
message: '#Variable \$([a-zA-Z0-9\\_]+) might not be defined.#'
paths:
- PodcastGenerator/themes

0 comments on commit 9a37ea7

Please sign in to comment.