-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub pipeline, PHP 8.4 support (#25)
* #17 - fix getting rates for day before if there are gaps in table * #24 - updates preparing for 7.x support drop * #24 - ci updates; remove circleci * #24 - update test pipeline * #24 - update ref commit to run * #24 - added coverage * #24 - moved validation of composer.json before adjustments * #24 - removed validation of composer.json * #24 - workflow split based on php versions * #24 - moved caching before update * #24 - testing php version on pipeline * #24 - testing php version on pipeline * #24 - testing php version on pipeline * #24 - new adjust system for older php versions; coverage retrieval script * #24 - remove php 8.1 from GH workflow * #24 - test pipeline status send * #24 - test pipeline status send * #24 - test pipeline status send * #24 - test pipeline status send * #24 - test pipeline status send * #24 - split test and coverage workflows * #24 - split test and coverage workflows * #24 - updated php-version variable * #24 - updated php-version variable * #24 - moved the php-version variable to env * #24 - added delta coverage from main branch * #24 - downgrade PHP version to run coverage * #24 - ignore test result on main branch for coverage purposes * #24 - preserve get-coverage.php scripts * #24 - applied cs-fixer fixes * #24 - added cs-fixer workflow * #24 - added cs-fixer workflow * #24 - added PHPStan workflow * #24 - added Deptrac workflow * #24 - added cs-fix composer script * #24 - added deptrac, updated some array type annotations * #24 - fix after rebasing master * #24 - revert the change `new` to `create` as it would cause too much BC
- Loading branch information
Showing
72 changed files
with
3,481 additions
and
2,792 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: PHP CS Fixer | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
env: | ||
PHP_VERSION: '8.3' | ||
|
||
jobs: | ||
cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
extensions: mbstring, xml, json | ||
tools: composer:v2 | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-8.3-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.PHP_VERSION }}- | ||
- name: Run PHP CS Fixer | ||
run: | | ||
vendor/bin/php-cs-fixer check --config=./.php-cs-fixer.dist.php --diff --allow-risky=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Deptrac | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
env: | ||
PHP_VERSION: '8.3' | ||
|
||
jobs: | ||
deptrac: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
extensions: mbstring, xml, json | ||
tools: composer:v2 | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-8.3-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.PHP_VERSION }}- | ||
- name: Run Deptrac | ||
run: | | ||
vendor/bin/deptrac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: PHP Tests | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: ['8.1', '8.2', '8.3', '8.4'] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: mbstring, xml, json, xdebug, curl | ||
coverage: pcov | ||
tools: composer:v2 | ||
|
||
- name: Adjust composer dependencies for older PHP versions | ||
run: php scripts/adjust-deps-for-older-php-versions.php | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php-${{ matrix.php-version }}- | ||
- name: Run all test suites | ||
run: composer run-script test-all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: PHPStan | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
env: | ||
PHP_VERSION: '8.3' | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
extensions: mbstring, xml, json | ||
tools: composer:v2 | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-8.3-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.PHP_VERSION }}- | ||
- name: Run PHPStan | ||
run: | | ||
vendor/bin/phpstan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: PR Test Coverage | ||
|
||
on: | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
env: | ||
PHP_VERSION: '8.3' | ||
|
||
jobs: | ||
check-coverage: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Indicate pending code coverage check | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ | ||
-d '{ | ||
"state": "pending", | ||
"context": "Test Coverage", | ||
"description": "Coverage: ?%", | ||
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}' | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
extensions: mbstring, xml, json, xdebug, curl | ||
coverage: pcov | ||
tools: composer:v2 | ||
|
||
- name: Cache Composer packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ env.PHP_VERSION }}-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php-${{ env.PHP_VERSION }}- | ||
- name: Run test suites with coverage on PR branch | ||
run: | | ||
cp scripts/get-coverage.php var/coverage/ | ||
php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-text --coverage-clover=var/coverage/clover-pr.xml | ||
- name: Checkout main branch | ||
if: success() | ||
run: | | ||
git fetch origin master | ||
git checkout master | ||
- name: Run test suites with coverage on main branch. Ignore test result for the coverage purpose. | ||
if: success() | ||
run: php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-text --coverage-clover=var/coverage/clover-main.xml || true | ||
|
||
- name: Extract coverage | ||
if: success() | ||
run: | | ||
COVERAGE_PR=$(php var/coverage/get-coverage.php var/coverage/clover-pr.xml) | ||
COVERAGE_MAIN=$(php var/coverage/get-coverage.php var/coverage/clover-main.xml) | ||
DIFF=$(echo "$COVERAGE_PR - $COVERAGE_MAIN" | bc) | ||
DIFF_DISPLAY=$DIFF | ||
if [ $(echo "$DIFF > 0" | bc) -eq 1 ]; then | ||
DIFF_DISPLAY="+$DIFF" | ||
fi | ||
if [ $(echo "$DIFF >= 0" | bc) -eq 1 ]; then | ||
STATE="success" | ||
EMOJI="✅" | ||
else | ||
STATE="failure" | ||
EMOJI="❌" | ||
fi | ||
DESCRIPTION="Coverage: $COVERAGE_PR%. Change from main branch: $DIFF_DISPLAY% $EMOJI" | ||
echo "COVERAGE_DESCRIPTION=${DESCRIPTION}" >> $GITHUB_ENV | ||
echo "COVERAGE_STATE=${STATE}" >> $GITHUB_ENV | ||
- name: Update GitHub status with code coverage | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ | ||
-d '{ | ||
"state": "${{ env.COVERAGE_STATE }}", | ||
"context": "Test Coverage", | ||
"description": "${{ env.COVERAGE_DESCRIPTION }}", | ||
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
vendor/ | ||
var/ | ||
!var/coverage/.gitkeep | ||
.idea | ||
tests/php-unit/reports/ | ||
.phpunit.result.cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.