Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 23, 2024
1 parent 4578e5b commit 068387c
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 87 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/cacert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
schedule:
- cron: '0 0 * * *' # Midnight - every night

permissions:
contents: read

jobs:
update:
strategy:
Expand All @@ -14,8 +17,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}

Expand Down
45 changes: 18 additions & 27 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
- push
- pull_request

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
permissions:
contents: read

jobs:
tests:
name: "CI"

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}

strategy:
matrix:
Expand All @@ -25,33 +25,24 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
experimental: [false]
os: [ubuntu-latest]
include:
- php-version: "8.3"
os: windows-latest
experimental: false

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
coverage: none

- name: Get composer cache directory
id: composercache
run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT"

- name: Cache dependencies
uses: actions/cache@v4
- uses: ramsey/composer-install@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install latest dependencies"
run: |
# Remove PHPStan as it requires a newer PHP
composer remove phpstan/phpstan --dev --no-update
composer update ${{ env.COMPOSER_FLAGS }}
- name: "Run tests"
run: "vendor/bin/simple-phpunit --verbose"
dependency-versions: highest

- name: Run tests
run: composer test
27 changes: 20 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
- push
- pull_request

permissions:
contents: read

jobs:
tests:
name: "Lint"
Expand All @@ -14,17 +17,27 @@ jobs:
matrix:
php-version:
- "7.2"
- "8.3"
- "nightly"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
coverage: none

- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"
run: |
hasErrors=0
for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*' ! -path '*/Fixtures/*')
do
{ error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1;
if [ "$error" != "" ]; then
while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error"
hasErrors=1
fi
done
if [ $hasErrors -eq 1 ]; then
exit 1
fi
34 changes: 9 additions & 25 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
- push
- pull_request

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_VERSION: ""
permissions:
contents: read

jobs:
tests:
Expand All @@ -21,31 +20,16 @@ jobs:
- "8.3"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
coverage: none

- name: Get composer cache directory
id: composercache
run: "echo \"dir=$(composer config cache-files-dir)\" >> $GITHUB_OUTPUT"

- name: Cache dependencies
uses: actions/cache@v4
- uses: ramsey/composer-install@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install latest dependencies"
run: "composer update ${{ env.COMPOSER_FLAGS }}"

- name: "Initialize PHPUnit sources"
run: "vendor/bin/simple-phpunit --filter NO_TEST_JUST_AUTOLOAD_THANKS"
dependency-versions: highest

- name: "Run PHPStan"
run: "composer phpstan"
- name: Run PHPStan
run: composer phpstan
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"php": "^7.2 || ^8.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.2 || ^5",
"phpunit/phpunit": "^8 || ^9",
"phpstan/phpstan": "^1.10",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0"
Expand All @@ -48,7 +48,7 @@
}
},
"scripts": {
"test": "vendor/bin/simple-phpunit",
"phpstan": "vendor/bin/phpstan analyse"
"test": "@php phpunit",
"phpstan": "@php phpstan analyse"
}
}
36 changes: 13 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false">

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0"/>
</php>

processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix=".php">./tests/</directory>
<testsuite name="CaBundle Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-html" target="report/"/>
</logging>

<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
</phpunit>

0 comments on commit 068387c

Please sign in to comment.