Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php version change #27

Merged
merged 36 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
61190ae
moved php version for master to 8.1 and appended some basic code clea…
Sep 18, 2023
b38399a
extend actions with code coverage
Sep 19, 2023
56f928f
change php version in scruinizer ci
Sep 19, 2023
b57e1e7
change php versions in github matrix
Sep 19, 2023
98d7a02
create an action to build php matrix
Sep 19, 2023
02d1505
change github actions to use php versions from api
Sep 19, 2023
6fd9640
verify corect sub action
Sep 19, 2023
9176309
add diagnostic lines to action
Sep 19, 2023
ed3e9a7
rename action file
Sep 19, 2023
76fe9c8
lower php version constraint
Sep 19, 2023
d34bf45
remove diagnostic checks from github action
Sep 19, 2023
4793978
update composer lock for lower php requirement
Sep 19, 2023
19cd273
change action to remove set output
Sep 19, 2023
809189b
readd set output
Sep 19, 2023
6d65089
re remove set-output calls
Sep 19, 2023
a251b0c
temproarily remove coverage report
Sep 19, 2023
1469fce
readd coverage and try a secondary driver
Sep 19, 2023
78a73db
add xdebug enviroment variable
Sep 19, 2023
de30994
add coverage driver to name
Sep 19, 2023
79f1e8e
move xdebug mode to ini set
Sep 19, 2023
020140f
fix up parsing php lattest
Sep 19, 2023
36ed374
add verbosity to look into phpunit error
Sep 19, 2023
8f4d210
upgrade the code coverage package to see if that resolves issue
Sep 19, 2023
c30bea0
change composer lock to support lowest version
Sep 19, 2023
829d3a8
remove xdebug coverage driver
Sep 19, 2023
50aa60d
readd coveralls carryforward param
Sep 19, 2023
c5bbd97
fixup some basic style stuff
Sep 19, 2023
f0cce6b
trying a commit with branch coverage
Sep 19, 2023
3947dcf
command typo
Sep 19, 2023
5701209
add flag name to coveralls
Sep 19, 2023
fae76a6
upgrade phpunit where supported
Sep 19, 2023
7c3cfd1
trying removing Comparator
Sep 19, 2023
7b5ee46
remove comparator
Sep 19, 2023
da874df
upgrade phpunit config
Sep 19, 2023
984e352
upgrade phpunit config as part of run
Sep 19, 2023
1298d2d
remove last change
Sep 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/actions/php_ver/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: 'PHP Releases'
branding:
icon: 'plus'
color: 'yellow'
description: 'Generates an array of the latest, minimum security, and minimum active PHP releases, along with user defined versions'
inputs:
releases:
required: false
description: 'Add specific versions to the matrix array'
outputs:
range:
description: "Releases Array"
value: ${{ steps.return-response.outputs.releases-array }}
runs:
using: "composite"
steps:
- uses: actions/checkout@v3

- name: Fetch Cache
id: fetch-cache
uses: actions/cache@v3
with:
path: .temp
key: temp

- name: Store user input
id: store-user-input
shell: bash
run: |
echo "user-input=$(echo ${{ inputs.releases }})" >> $GITHUB_OUTPUT


- name: Make Latest Request
id: make-latest-request
uses: fjogeleit/http-request-action@v1
if: steps.fetch-cache.outputs.cache-hit != 'true'
with:
url: 'https://phpreleases.com/api/releases/latest'
method: 'GET'

- name: Make Security Request
id: make-security-request
uses: fjogeleit/http-request-action@v1
if: steps.fetch-cache.outputs.cache-hit != 'true'
with:
url: 'https://phpreleases.com/api/releases/minimum-supported/security'
method: 'GET'

- name: Make Active Request
id: make-active-request
uses: fjogeleit/http-request-action@v1
if: steps.fetch-cache.outputs.cache-hit != 'true'
with:
url: 'https://phpreleases.com/api/releases/minimum-supported/active'
method: 'GET'

- name: Parse Latest
id: parse-latest
if: steps.fetch-cache.outputs.cache-hit != 'true'
shell: bash
run: |
latest=${{ steps.make-latest-request.outputs.response }}
IFS='.'
read -ra arr <<< "$latest"
echo "latest-release=$(echo ${arr[0]}.${arr[1]})" >> $GITHUB_OUTPUT


- name: Parse Minimum Supported
id: parse-min
if: steps.fetch-cache.outputs.cache-hit != 'true'
shell: bash
run: |
echo "min-active-release=$(echo ${{ fromJSON(steps.make-active-request.outputs.response).provided.major }}.${{ fromJSON(steps.make-active-request.outputs.response).provided.minor }})" >> $GITHUB_OUTPUT
echo "min-security-release=$(echo ${{ fromJSON(steps.make-security-request.outputs.response).provided.major }}.${{ fromJSON(steps.make-security-request.outputs.response).provided.minor }})" >> $GITHUB_OUTPUT


- name: Return Response
id: return-response
run: |
if [ "${{ steps.fetch-cache.outputs.cache-hit }}" != 'true' ]; then
echo "Data fetched from Api"
latest="${{ steps.parse-latest.outputs.latest-release }}"
minAct="${{ steps.parse-min.outputs.min-active-release }}"
minSec="${{ steps.parse-min.outputs.min-security-release }}"
else
echo "Data fetched from cache"
latest=$(cat .temp/latest.txt)
minAct=$(cat .temp/min-active.txt)
minSec=$(cat .temp/min-security.txt)
fi

if [ -z "${{ steps.store-user-input.outputs.user-input }}" ]; then
echo "releases-array=$(echo [${latest}, ${minAct}, ${minSec}])" >> $GITHUB_OUTPUT

else
userInput="${{ steps.store-user-input.outputs.user-input }}"
IFS=', ' read -r -a array <<< "$userInput"
array+=(${latest} ${minAct} ${minSec})
deduped=($(echo "${array[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))

printf -v formatted ',%s' "${deduped[@]}"
formatted=${formatted:1}

echo "releases-array=$(echo [${formatted}])" >> $GITHUB_OUTPUT

fi
shell: bash
38 changes: 30 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,28 @@ on:
- main
- master
jobs:
output_releases:
name: Generate PHP Releases Array
runs-on: ubuntu-latest
outputs:
range: ${{ steps.releases.outputs.range }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch Current Releases
uses: ./.github/actions/php_ver
id: releases
tests:
needs: output_releases
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest ]
php-version: ['7.4', '8.0', '8.4' ]
operating-system: [ ubuntu-latest]
php-version: ${{ fromJSON(needs.output_releases.outputs.range) }}
dependencies: [locked, lowest, highest ]
coverage-driver: [ pcov ]
name: Tests on ${{ matrix.operating-system }}, PHP ${{ matrix.php-version }} (${{ matrix.dependencies }};)
coverage-driver: [ xdebug ]
name: Tests on ${{ matrix.operating-system }}, PHP ${{ matrix.php-version }} (${{ matrix.dependencies }}; ${{ matrix.coverage-driver }})
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -26,7 +38,7 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
coverage: ${{ matrix.coverage-driver }}
ini-values: memory_limit=512M, xdebug.mode=off
ini-values: memory_limit=512M, xdebug.mode=coverage
tools: composer
env:
GITHUB_TOKEN: ${{ secrets.COMPOSER_GITHUB_TOKEN }}
Expand Down Expand Up @@ -65,7 +77,14 @@ jobs:

- name: Run unit tests
shell: bash
run: vendor/bin/phpunit
run: |
vendor/bin/phpunit --coverage-clover=clover.xml --path-coverage

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: "${{ matrix.operating-system }}, PHP ${{ matrix.php-version }} (${{ matrix.dependencies }}; ${{ matrix.coverage-driver }})"

# This is a meta job to avoid to have to constantly change the protection rules
# whenever we touch the matrix.
Expand All @@ -78,12 +97,15 @@ jobs:
- name: Successful run
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0

- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "run-1,run-2"
- name: Failing run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1


infection:
runs-on: ubuntu-latest
needs: tests-status
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ build_failure_conditions:

build:
environment:
php: 7.4
php: 8.2
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@
}
},
"require": {
"php": ">=7.1 | >=8.0",
"php": ">=8.0",
"myclabs/php-enum": "^1.7"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5|10.*",
"phpunit/php-code-coverage": "^9.2.28|10.*"
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
}
}
}
16 changes: 8 additions & 8 deletions composer.lock

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

2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</coverage>
<testsuites>
<testsuite name="PHP Enum Test Suite">
<directory suffix=".php">./tests</directory>
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
Loading
Loading